PDA

View Full Version : reading, writing, and displaying from eeprom



Rhatidbwoy
- 8th January 2006, 20:16
The problem that I am having is that I would like to read from the eeprom and then display it on a LCD screen. What I have done first was to print the screen to how I want the information to be seen on the LCD then to follow I would read the information on the eeprom. After reading the eeprom and putting the data into predefine variables it would be displayed. All of this can be seen in the Tranmitter ver 7.txt ( this starts under ther label of CHANNELS).

Then when I move from line to line I would do the same thing over by reading what line number/channel number then write this information back into the eeprom.

The problem that I am having is that I know or presume that the commands that I have written are correct but am not getting what I would like to get on my LCD screen. What i get is the same value that I start out with will stay for any channel and menu selection that I have. The only way that I can change the value is inc or dec the value or to turn off the micocontroller.

Is there any help or suggetions that anyone can give.

Thank You

Jerson
- 9th January 2006, 04:40
Perhaps the record_address variable needs to be looked at. I am not so sure, but your enter routine seems to read from eeprom address base 7 onwards
ENTER1: read 7,ee7:read 8,ee8:read 9,ee9:read 10,ee10:read 11,ee11:read 12,ee12:read 13,ee13:read 14,ee14:read 15,ee15:read 16,ee16
read 17,ee17:read 18,ee18:read 19,ee19:read 20,ee10:read 21,ee21:read 22,ee22:read 23,ee23:read 24,ee24:read 25,ee25:read 26,ee26
read 27,ee27:read 28,ee28:read 29,ee29:read 30,ee10:read 31,ee31:read 32,ee32:read 33,ee33:read 34,ee34:read 35,ee35:read 36,ee36
read 37,ee37:read 38,ee38:read 39,ee39:read 40,ee10:read 41,ee41:read 42,ee42:read 43,ee43:read 44,ee44:read 45,ee45:read 46,ee46
read 47,ee47:read 48,ee48:read 49,ee49:read 50,ee50:read 51,ee51:read 52,ee52:read 53,ee53:read 54,ee54:read 55,ee55


You seem to read/write from address base 0 using this computation

record_address = channel_number * 7
read record_address + 1, h
read record_address + 2, t
read record_address + 3, o

Hope this helps

Jerson

Rhatidbwoy
- 9th January 2006, 21:32
Jerson

From the label ENTER and to the equation that you presented is correct. When I do the MENIN and CHNL labels everything should be based off of the channels 1-7. If that is the case to the equation of record_address = channel_number * 7 then everything works out to be 7 to 54 on the eeprom.

What the labels of MENIN and CHNL is to do is put the correct information from eeprom by the equation to the correct H,T, and O. That is to read or to write depending on the part of theprogram sequence.

Then when I am to enter the information, label ENTER, I would read the eeprom then put it into RAM then SEROUT AND WRITE.

To clarify what you last talked about check out forum writing to a table. A fellow by the name luciano wrote something in regard to that.

Rhatidbwoy
- 10th January 2006, 02:00
quick question. If the eeprom is code protected, would this be a problem for the arrangement that I have setup.

Looking at a few of the post and reading the data sheet, the cpu (which to me is the controller) can still write to the eeprom. So if I set it up in memory to do just that then the problem is not with code protection. Could it be though?

Very frustrating/frustrated.

Jerson
- 10th January 2006, 04:45
Rhatidbwoy

I am finding it quite difficult to comprehend your code without comments. Anyway,

See the following fragment of your code in the ENTER routine

tra = 0
tra1 = 38
for e = 0 to 48
lookup2 e,[ee7,ee8,ee9,ee10,ee11,ee12,ee13,ee14,ee15,ee16,ee1 7,ee18,_
ee19,ee20,ee21,ee22,ee23,ee24,ee25,ee26,ee27,ee28, ee29,ee30,_
ee31,ee32,ee33,ee34,ee35,ee36,ee37,ee38,ee39,ee40, ee41,ee42,_
ee43,ee44,ee45,ee46,ee47,ee48,ee49,ee50,ee51,ee52, ee53,ee54,_
ee55],ee
serout 0,4,[TRA1,ee]
write tra, ee
tra = tra + 1 ' next tra
tra1 = tra1 + 1
next e

From this, I infer the TRA variable is used as an address for eeprom write. If you see, this variable is initialized to zero and writes the 48 bytes from address 0 onwards. You read from address 7. Confirmation if this is the problem will be garbled data from channel 0 up when you happen to change channel 2 and higher.

Jerson

Rhatidbwoy
- 10th January 2006, 19:54
ok that make sense. Pointing at it really help. going blind at such a young age. Me that is. Ok, I will have to try that and see what happens.

Then the other thing that I will have to do is make more notes to what is doing what. Thanks!

Rhatidbwoy
- 12th January 2006, 15:20
I have made the corrections as far as the TRA in label ENTER and still gt no good response. Thinking that there was a problem with how I am going at the read write i used the sample program with some modification and got it to work.

The READ/WRITE sample program was for SEROUT so I changed it to LCDOUT and I got for the information to work. I was also available to see that the information that I was working with was stored in the eeprom. That is a good thing.

With my program knowing that I have to set everything I tried a few lines and see if anything would change. Nothing. A few lines as far as a channel in one menu then a channel in another menu. Nothing. I am still plucking the minds to figure what can be done.

Rhatidbwoy
- 12th January 2006, 22:05
ok. got the problem figure out. I would have like the information to go from line to linet. I was writing it as line = linet. Not the way to go. I needed for it to be linet = line.