i2c
AHMET AKSU
Posts: 62
· is it possible to do that
·a have variable which name vra can I use·· @vra (which will return the address of a variable in RAM)·to write to the EEPROM at that same offset
and then when propeller restart update variable vra from eeprom
·a have variable which name vra can I use·· @vra (which will return the address of a variable in RAM)·to write to the EEPROM at that same offset
and then when propeller restart update variable vra from eeprom
Comments
actually I m using 24lc512 on 28 29 pin of propeller.How can I use second 32 k byte part of eeeprom device for reading and writing long variable
PUB ReadLong(SCL, devSel, addrReg) : data
'' Read in a single long of i2c data. Device select code is devSel. Device
'' starting address is addrReg. The device select code is modified using the
'' upper 3 bits of the 19 bit addrReg. This returns true if an error occurred.
'' Note that you can't distinguish between a return value of -1 and true error.
if ReadPage(SCL, devSel, addrReg, @data, 4)
return -1
SCL is the pin number used as the clock pin for I2C. SDA is the next higher numbered pin. In your case, SCL should be 28.
devSel is the device select or device address value to be used. For EEPROMs this is $A0. The routines automatically change
this to $A2, $A4, ..., $AE for addresses greater than $FFFF and they automatically add the read/write bit (odd/even).
To use the second 32K byte part, just use an address (addrReg) in the range $8000 to $FFFF.
···· Dear Mike Green
· thanks for your answer.on my project there are only one 24lc512 .and a1,a2,a3 pins of it is connected to the graund .in this case what is the devsel value for me and what is the addrreg value for the starting point of second 32 kbyte .
·
As I said previously, the device select value is $A0 and the address range for the second 32K of the EEPROM is $8000 through $FFFF.