24lc32 eeprom
Earl Foster
Posts: 185
I just received 10 of the 24LC32 EEPROM's for Christmas, along with a bunch of other Parallax electronic goodies, but I don't know how to use them.· I downloaded the data sheet I found in the archieves but I am still confused - I do better by example.· I have looked around and haven't·been able to find·any examples of how to use them in the Stamps in Class series or in Nuts & Volts examples.· Are there any examples available with schemics that show how to use it for external data logging?· If so, can they be posted for downloaded?
Comments
Try this thread in the forum:
http://forums.parallax.com/forums/default.aspx?f=15&m=93373&g=93380#m93380
peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Peter C. Charles
Director, Research and Technology
CyberBiota, Incorporated
Peter.charles@cyberbiota.com
http://www.cyberbiota.com
Or, if you are not using a BS-2P, this might be more helpfull:
http://forums.parallax.com/forums/default.aspx?f=5&m=2373&g=2388#m2388
peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Peter C. Charles
Director, Research and Technology
CyberBiota, Incorporated
Peter.charles@cyberbiota.com
http://www.cyberbiota.com
Check out Stampworks 2, expeiment # 32 I2C communications. You can download Stampworks 2 PDF form here:
http://www.parallax.com/dl/docs/books/sw/Web-sw-v2.0.pdf
Hope this helps.
Jim K
First, I thought the I2C commands were only available for BS2P and above?
And secondly, is SW20-EX32-24LC32-BSP available for download?
http://www.parallax.com/detail.asp?product_id=27297
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I assumed you had a BS2. You can do I2C communications with a BS2, but it takes more code than BS2p that has I2C instructions. You can download the source code for the Stampworks 2 experiments·SW20-EX32-24LC32.BS2 and SW20-EX32-24LC32.BSP along with all of the Stampworks 2 source code from here http://www.parallax.com/detail.asp?product_id=27297·at the bottom of the page.
Sorry for the confusion
Jim K
PS, I see Jon beat me to it. Thanks Jon for following up on my less than concise posts!!
*********************************************************
' {$STAMP BS2p}
' {$PBASIC 2.5}
SCL············PIN···· 1··············' I2C serial clock line
wrdAddr······VAR···· Word········' word address
X·············· VAR···· Word········' General purpose variable
y·············· VAR···· Word······· ' General purpose variable
wrdAddr = 0·························' Initialize address location
x = 100
DO
·· I2COUT 0, $A0, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 x]
·· DEBUG HOME
·· DEBUG ? x
·· DEBUG ? wrdAddr
·· I2CIN 0, $A1, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 y]
·· DEBUG ? y
·· wrdAddr = wrdAddr + 2
·· x = x + 100
·· PAUSE 1000
LOOP UNTIL wrdAddr = 20
***********************************************************
This next one writes properly but reads junk back and I don't understand why.
***********************************************************
' {$STAMP BS2p}
' {$PBASIC 2.5}
SCL············PIN···· 1··············' I2C serial clock line
wrdAddr······VAR···· Word········' word address
X·············· VAR···· Word········' General purpose variable
y·············· VAR···· Word······· ' General purpose variable
wrdAddr = 0
x = 100
DO······················· ' Works
·· I2COUT 0, $A0, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 x]
·· DEBUG HOME
·· DEBUG ? x
·· DEBUG ? wrdAddr
·· wrdAddr = wrdAddr + 2
·· x = x + 100
·· PAUSE 1000
LOOP UNTIL wrdAddr = 20
wrdAddr = 0
DEBUG CLS
DO······················ 'Doesn't work
·· I2CIN 0, $A1, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 y]
·· DEBUG HOME
·· DEBUG ? y
·· DEBUG ? wrdAddr
·· wrdAddr = wrdAddr + 2
·· PAUSE 1000
LOOP UNTIL wrdAddr = 20
***********************************************************
Can someone straighten me out and tell·what I am doing wrong?
I2COUT 0, $A0, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 x.byte1]
I2COUT 0, $A0, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 x.byte0]
or could I do
I2COUT 0, $A0, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]DEC5 x.BYTE1, DEC5 x.BYTE0]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
DO
I2COUT 0, $A0, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]x.BYTE0, x.BYTE1]
DEBUG ? x 'show me the value I am storing
DEBUG ? wrdAddr 'show me the address location
x = x + 200 'increment the value of x
wrdAddr = wrdAddr + 1 'increment to next memory location
PAUSE 1000 'slow down the read out
LOOP UNTIL wrdAddr = 5
This seems to be working properly but when I go to read the values starting at location 0 using this code:
wrdAddr = $0 'Go back to address 0
DO
I2CIN 0, $A1, wrdAddr.BYTE1\wrdAddr.BYTE0, [noparse][[/noparse]x.BYTE0, x.BYTE1]
DEBUG ? x 'show me the value in memory
DEBUG ? wrdAddr 'show me the address location
wrdAddr = wrdAddr + 1 'increment to next memory location
PAUSE 1000 'slow down the read out
LOOP UNTIL wrdAddr = 5
I get completely different values back (37064, 22672, 8280, 59424, 1000). Apparently I am still missing something in my understanding on how to write and read to memory.
· wrdAddr = wrdAddr + 2
... as you are writing/reading two bytes. In your current program each write to the EE is clobbering the previous value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax