24FC512 using I2C W/BS2p code sample?
Jonathan
Posts: 1,023
Hi All,
I really did give it a college try, but I couldn't find an example of using the 24FC512 eeprom using the I2C commands with a BS2p. Anyone know of a code snip? I tried using the forum search and digging through my stash of the old e-mail forum, but couldn't find anything. I was sure I had seen mention of it· somewhere though...
Thanks!
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
I really did give it a college try, but I couldn't find an example of using the 24FC512 eeprom using the I2C commands with a BS2p. Anyone know of a code snip? I tried using the forum search and digging through my stash of the old e-mail forum, but couldn't find anything. I was sure I had seen mention of it· somewhere though...
Thanks!
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Comments
Parallax published an app note for the xicor X25640 8K EEPROM.· It shows the hookup for the·spi bus to the chip, as well as lots of code.· Search for the part, and then download the datasheet/appkit pdf.·
peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Peter C. Charles
Director, Research and Technology
CyberBiota, Incorporated
Peter.charles@cyberbiota.com
http://www.cyberbiota.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
That got me started, but it still isn't working right. using this code:
address VAR Word
result VAR Word
main:
FOR address = 0 TO 9
I2COUT 0,$A0,address.BYTE1\address.BYTE0,[noparse][[/noparse]address]
NEXT
FOR address = 0 TO 9
I2CIN 0,$A0,address.BYTE1\address.BYTE0,[noparse][[/noparse]result]
DEBUG DEC result, CR
NEXT
PAUSE 1000
GOTO main
The program debugs the numbers 1-9 correctly, but 0 is always a 255 instead. It can run up to 254 with the same error. How would I address the eeprom above 65534? I have been poring over the data sheet and docs, and I think I'm missing a vital point or two somewhere.
Peter, I'm going to go look at that article now.
Many thanks,
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
My apologies- the app note is for an SPI device (all I ever use).· It isn't likely to be much use to you.· Sorry.
peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Peter C. Charles
Director, Research and Technology
CyberBiota, Incorporated
Peter.charles@cyberbiota.com
http://www.cyberbiota.com
James
Try the stamp works app note 32:
http://www.parallax.com/dl/docs/books/sw/exp/sw32.pdf
It covers I2C coms with Microchip eeproms.
peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Peter C. Charles
Director, Research and Technology
CyberBiota, Incorporated
Peter.charles@cyberbiota.com
http://www.cyberbiota.com
The Stampworks #32 doesn't use the I2C commands, which I had hoped to use. Why? Just because they are there. I guess I will try the SW #32 code and see if I can get to work. However, I am so close with the I2C commands. All I need to do is figure out how to address the memory above space 254.
James, I too thought there was a N&V column about eeproms and I2C, but I couldn't find it and Jon didn't mention it, so I guess there isn't.
Thanks for all the help!
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
address VAR Word
result VAR Word
dat VAR Word
address = 0
dat = 17
I2COUT 0,$A0,address.BYTE1\address.BYTE0,[noparse][[/noparse]dat.Byte1]
address = address + 1
I2COUT 0,$A0,address.BYTE1\address.BYTE0,[noparse][[/noparse]dat.Byte0]
address = 0
I2CIN 0,$A1,address.BYTE1\address.BYTE0,[noparse][[/noparse]result.BYTE1]
address = address + 1
I2CIN 0,$A1,address.BYTE1\address.BYTE0,[noparse][[/noparse]result.BYTE0]
DEBUG DEC result, CR
END
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Thanks for all the help folks!
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
FOR address = 0 TO $FFFF STEP 2
· I2COUT SDA, $A1, address.BYTE1\address.BYTE0, [noparse][[/noparse]value.BYTE0, value.BYTE1]
· ...
NEXT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office