need help to read an entire 16k eeprom
ion
Posts: 101
I need help to check the data stored in a 24LC16B eeprom.
I know there is an example on the help file, but is not exactly what I want.
I need to read this chip from location· 0 to the end and display in a debug windows· in the format ·DEC4, CR ·the numbers stored on it. I have the feeling that I have wrong data in some places.
All the locations store decimal numbers no ASCII. Lets say as example, at the beginning I have stored 1234 from the location 0. At location 2 and 3 I have 5678, and so on until the end.
Can somebody give me a clue how to read the entire chip. What is the magic formula in a kind of loop from start to end. I can read individual location, but I have no idea how to make a general syntax to read all locations.
Thanks
Ion
I know there is an example on the help file, but is not exactly what I want.
I need to read this chip from location· 0 to the end and display in a debug windows· in the format ·DEC4, CR ·the numbers stored on it. I have the feeling that I have wrong data in some places.
All the locations store decimal numbers no ASCII. Lets say as example, at the beginning I have stored 1234 from the location 0. At location 2 and 3 I have 5678, and so on until the end.
Can somebody give me a clue how to read the entire chip. What is the magic formula in a kind of loop from start to end. I can read individual location, but I have no idea how to make a general syntax to read all locations.
Thanks
Ion
Comments
Test:
· FOR wrdAddr = 0 TO 2047
··· slvAddr = $A0 | (wrdAddr.BYTE1 << 1)
··· I2CIN 0, slvAddr, wrdAddr.BYTE0, [noparse][[/noparse]regValue]
··· DEBUG DEC4 wrdAddr, TAB, DEC3 regValue, CR
· NEXT
Keep in mind that all locations in the 24LC16B are bytes (0 - 255), so to store words (16-bits, 0 - 65535) you need to use two bytes. If you're reading back words, you could do it like this (assuming words are stored in the 24LC16B in "little endian" mode):
Test:
· FOR wrdAddr = 0 TO 2047 STEP 2
··· slvAddr = $A0 | (wrdAddr.BYTE1 << 1)
··· I2CIN 0, slvAddr, wrdAddr.BYTE0, [noparse][[/noparse]value.BYTE0, value.BYTE1]
··· DEBUG DEC4 wrdAddr, TAB, DEC5 value, CR
· NEXT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Ion
Test:
· FOR wrdAddr = 0 TO 2047 STEP 4
··· slvAddr = $A0 | (wrdAddr.BYTE1 << 1)
··· I2CIN 0, slvAddr, wrdAddr.BYTE0, [noparse][[/noparse]DEC4 value]
··· DEBUG DEC4 wrdAddr, TAB, DEC4 value, CR
· NEXT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Thanks
Ion