12cwrite not working with 24LC08 SEEPROM ??
I'm trying to fill a SEEPROM with a data lookup table so I can read it later. I'm using a 24LC08 and writing a series of word constants to it. As a test I'm just using a loop to write a sequence of numbers equivalent to the addresses, but that is not working. The loop tries to write values 0-20 to locations 0-20 (actually 0-40 for word vars) but it's only writing the 1st 3 bytes in the EEPROM.
I can take the LC08 out of the circuit and read it with a prom burner to verify the results and it verifies that all I'm writing is the 1st 3 bytes - and those values do not reflect what I'm trying to write.
Here's my code loop:
for temp = 0 to 20
i2cwrite eedat,eeclk,$A0,Temp,[temp] ' write
pause 400 ' hold for display
i2cread eedat,eeclk,$A0,temp,[Mode] ' read it back
lcdout lcdcmd,lcdline2,#temp," ",#Mode ' display it
pulsout piezo,10 ' diagnostic "tic" sound
next temp
My LCD shows reads of 0 (zero), but the chip reads as:
10 00 10 FF FF FF FF...
I'm really frustrated, nothing is adding up here. Am I doing something dumb?
2 byte increments for word values - duh! But...
Thanks Darrel,
I had mis-read the manual and assumed that the compiler took care of the stepping by 2 bytes. I was aware of the 4 blocks, and planned to break my data into 128 word chunks for fit into each block.
I tried your revised code and the LCD shows a correct read-back, but when I read the EEPROM in my PROM reader all I get is the 1st 3 bytes changed and the rest remains FF.
It's as if the address increment is not working and I'm just overwriting the same data. I just can't see why that would happen.
I have checked the hardware over carefully - not much to screw up there. Data and clock are pulled up with 10K and the WP line (pin 7) is wired to GND. Power is good, filtered, clean 5V. Signals all look "textbook".
[QUOTE=Darrel Taylor;91895]tekart,
With the 24LC08, the address needs to be a BYTE.
There are also 4 "blocks" of 256 bytes that can be selected in the "control" byte.
And the address should increment (STEP) by 2 for word sized data.
More assistance with this?
So Darrell,
My ultimate goal is to get 256 word variables into the EEPROM chip from a comma delimited text file in decimal. My plan was to put them into on-chip EPROM first in 128 word chunks then read them out in a loop and write them to the external EEPROM chip. This is pretty tedious though. So I'm wondering if you have any thoughts on a way to simplify the process?
Once I have the chip programmed, I can then read it out to create a file for burning them in production. Wish I could just get the data directly into my PROM burner...
BTW This is a temperature look-up table for a thermostat type device. The values are ADC readings for the degrees F from 0 to 255.
Guy
sounds too good to be true
Darrel,
Your offer sounds too good to be true. Therefore it must be! ;)
We're getting into my proprietary info at this point. How can we continue the dialog outside the Forum? This is for a product that I'm developing for my own company so I can pay for your time - if you're willing.
Guy
Quote:
Originally Posted by
Darrel Taylor
One day, you will learn not to say things like that. :)
Can I see your data table?
If I can't "Curve Fit" it, I'll show you how to put the table in Code Memory.
Then you can either use the table from there, or take the data and write it to EEPROM.
If I can fit the curve, you won't need a table.