November 07, 2024, 06:51:32 PM

i2c eeprom 24lc32 example code

Started by venatici, October 16, 2012, 05:20:16 PM

Previous topic - Next topic

venatici

Hi, I have make code to read i2c eeprom both to pic and pinguino in past days but i can't make a program to read  eeprom to duinomite.
Does anyone has an example.
Thank you.

taucapic

Hi, I'm also experimenting with I2C and EEPROM 24CXX.
Set of conditions is so : Duinomite + StickOS BASIC (cpustick.com).
Pin D12 for SDA, Pin D11 for  SCL,pullup resistors 6.8 k to 5 V.
Results are expected in 2 weeks (+ or -).
I chose this because it is written in DMBasic
Language Manual Ver 3.2 Appendix B,
I2C Communications ,Maximite family only (not for Duinomite ??).







taucapic

         Hi  venatici, Hello everyone who is interested in I2C bus !
Then came the first snow and it will be a chance to experience DUINO at low temperatures
in  our labs !  :D
We tested the DUINOMITE and I2C bus with 24CXX EEPROM.
The  I2C bus has been configured in such a way -
SCL line from pin 5 UEXT, SDA line from pin 6 UEXT  DUINOMITE .
It was discovered, under these conditions, we need to make additional HARDWARE.
    1. Organize additional source 3. 3 V. Not from pin 3.3 V on the  DUINOMITE board.
In the first steps of the test , additional source was  5 V from the  DUINOMITE board.
In this case, I2C bus  works on a grand scale of 5 volts !
We made the voltage divider 200 om/100 om for 5 V  from  DUINOMITE board.
    2. 24CXX  EEPROM pins 1,2,3,4,7 - GND DUINOMITE board, pin 8 - additional source 3. 3 V, pin 5 - SDA,
        pin 6 SCL - I2C bus.
    3. Pin D12  from DUINOMITE board via pullup resistor 6.8 K to additional source 3. 3 V
         Pin D11 from  DUINOMITE board via  pullup resistor 6.8 K to additional source 3. 3 V
24CXX EEPROM chip was programmed by PonyProg2000 (www.LancOS.com)
in such a way to see each page ( 8 ) separately.
    To be continued ...















taucapic

          Hi all, we continue to explore the I2C of the platform DUINOMITE.
For these tests was chosen StickOS BASIC  Software.
Its light was seen in the understanding and application. There is support on the site www.cpustick.com
Code example
10  dim x2 as pin an2 for digital output
   11  dim x3 as pin an3 for digital output
   12  dim x4 as pin an4 for digital output
   13  dim x6 as pin an6 for digital output
   22    x2 = 0
   23    x3 = 0
   24    x4 = 0
   26    x6 = 0
   30  dim i
   50  dim data[2] as short
   70  i2c start 0x53
   75   for i = 1 to 64 step 1
   80   i2c read data
   90   print data
   115 next
   120 i2c stop
   130 end
    save I2C_test
    run

Result of the program - something like this -
   13107 13107
   13107 13107
   13107 13107
   13107 13107
    ..................
   13107 13107
   13107 13107
   13107 13107
   13107 13107

13107 is the  decimal form number 3333  HEX form which is recorded in each cell of page 4 at 0h53 adress, total 256.   
   Start page 0х50, final page 0x57.
            Acknowledgements for the support of Mr. Rich Testardi support@cpustick.com
            Acknowledgements to my wife for understanding.
It will be interesting to see similar results for DM - MM Basic and  discussion.


taucapic

         P.S.
    For DUINOMITE-Mini + DM. BASIC v.4.0
    code example such a:

CLS
DIM DATA (256)
DIM I
I2CEN 100, 100
FOR I - 1 TO 256
I2CRCV &H52, 0,1,DATA
PRINT "" DATA ,;
NEXT
I2CDIS



     DM. BASIC v.4.0 has 7 commands I2C,
    1 System Variables -mm.I2C.
    This allows fine-tuning of  I2C bus.