Hello,
I did test the example program downloaded on the Matrix website and it did work.
But, in order to well understand what is done and how to use it in my programs. In the example we write 2 values "H" or 72 and "i" or 105:
- but are they store in 0,0 and 0,1 ?
- is it possible to store more than 2 values by each command ?
- is it also possible to read more than 2 values by each command ?
Thanks for your help,
Jeff
I2C EEPROM
- Steve
- Matrix Staff
- Posts: 3422
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: I2C EEPROM
In the I2C program, the commands to set the EEPROM values (at addresses 0 and 1) to "Hi" are:
Reading works in a similar way, but with this implementation in Flowcode you need to specify whether or not the call to "I2C_Receive_Byte" is expecting to receive the last byte or not.
There should be more info in the datasheet for the EEPROM itself.
- Send <start>
Send device address
Send Internal address 1 (0)
Send internal address 2 (0)
Send 'H'
Send 'i'
Send <stop>
Reading works in a similar way, but with this implementation in Flowcode you need to specify whether or not the call to "I2C_Receive_Byte" is expecting to receive the last byte or not.
There should be more info in the datasheet for the EEPROM itself.
-
- Posts: 209
- Joined: Thu Oct 19, 2006 11:46 am
- Location: Bakewell, UK
- Has thanked: 20 times
- Been thanked: 16 times
- Contact:
Re: I2C EEPROM
Hi,
Each EEPROM has a different buffer size, the smaller ones are about 16 bytes, the larger about 64 bytes. The problem being that writing the, say 17th byte, rolls the write around back to 0. Hence, unless your programme is in need of speed (where you could use the 1MHz clock speed versions) then I usually wite each address before every write. Otherwise you have to keep track of how many bytes are written.
Also, I think a write does not acually start until the last write byte is put in the buffer before it is closed, hence, it could be possible to end data storage but without actaully ever writing any data, or to try and read back data not already written. Hence, it is easier to write address and data values singly (in my view).
Regards,
Mark
Each EEPROM has a different buffer size, the smaller ones are about 16 bytes, the larger about 64 bytes. The problem being that writing the, say 17th byte, rolls the write around back to 0. Hence, unless your programme is in need of speed (where you could use the 1MHz clock speed versions) then I usually wite each address before every write. Otherwise you have to keep track of how many bytes are written.
Also, I think a write does not acually start until the last write byte is put in the buffer before it is closed, hence, it could be possible to end data storage but without actaully ever writing any data, or to try and read back data not already written. Hence, it is easier to write address and data values singly (in my view).
Regards,
Mark
Go with the Flow.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: I2C EEPROM
Hello
I have updated the example file to add more comments and definitions. Hopefully it is now more understandable.
http://www.matrixmultimedia.com/Downloa ... .php?id=39
I have updated the example file to add more comments and definitions. Hopefully it is now more understandable.
http://www.matrixmultimedia.com/Downloa ... .php?id=39
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: I2C EEPROM
Hello Jeff
If you want to save up to 32 values at once then you will have to do the following.
I2C Start
I2C Send address with 0 read/write bit
I2C Send the two byte initial data address
I2C Send the first data byte
...
I2C Send the nth data byte
I2C Stop
Hope this helps.
If you want to save up to 32 values at once then you will have to do the following.
I2C Start
I2C Send address with 0 read/write bit
I2C Send the two byte initial data address
I2C Send the first data byte
...
I2C Send the nth data byte
I2C Stop
Hope this helps.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel