EEPROM and Banks

Marcwolf

Senior Member
Hi Folks.
Sorry - late for me here and I have been trolling through posts trying to find a simple explanation re working with a 24lc256 eeprom.

The scenario is this.

I have a little OSD board that I want to lad text into. As some of the text is extensive (control characters etc) I want to store the informaion on a eeprom.

I have written a test VB6 program that will take a file that I can load to the OSD via a serial port and turn it into this

Code:
Hi2cout 1, (40) : pause 5
Hi2cout 2, (0, 7, 20, 17, 1) : pause 5
Hi2cout 7, (0, 73, 110, 105, 116) : pause 5
Hi2cout 12, (105, 97, 108, 105, 115) : pause 5
Hi2cout 17, (105, 110, 103, 32, 83) : pause 5
Hi2cout 22, (121, 115, 116, 101, 109) : pause 5
Hi2cout 27, (26, 1, 1, 26, 2) : pause 5
Hi2cout 32, (1, 26, 3, 1, 26) : pause 5
Hi2cout 37, (4, 1, 26, 6, 0) : pause 5
The first byte contains the number of bytes in the sequence and this mean I can have multiplke sequences so liong as I know the starting eeprom address and they do not overlap.

HOWEVER... When I read back the data I find that some of the bytes are missingincorrect. I believe it is a paging issue but I cannot fibnd any code/explaination to fix this.

Can someone point me in the right direction. I did find this site http://www.eglin.plus.com/PC2EEPROM/PC2EEPROM.htm
But the program does not work.

Many thanks for any help
Dave
 

hippy

Technical Support
Staff member
In short, every Eeprom has a page size and the rule is you cannot write beyond that page size, cannot write across a page boundary into another page.

For example, if page size is 64, the first page is location 0-63, the second is 64-127. You therefore cannot write to location 63 and 64 in one command as that crosses the page boundary -

HI2cOut 63, ( "A", "B" )

That will put "A" in location 63, but puts "B" in location 0, not location 64.

Added : The 24LC256 has a page size of 64 bytes but nothing in your code seems to cross a boundary so perhaps it is some other issue. Maybe the PAUSE time is too short or there is something else in the code which is wrong.
 

Armp

Senior Member
The first byte contains the number of bytes in the sequence and this mean I can have multiplke sequences so long as I know the starting eeprom address and they do not overlap.
As Hippy has indicated theres nothing wrong with your snippet. But if you wrote the next block starting at 42 one of your statements would cross the boundary.
 

MFB

Senior Member
If you would rather not have to deal with input page buffers and write delay limitations, then drop-in a pin compatible I2C FRAM chip. A bit more expensive per storage byte but faster and simpler to use.
 

Marcwolf

Senior Member
Many thanks for your idea's. I will try and modify my code. I only included snippet of my code as the full code goes over 3 pages and breaks the data into seperate sections in the memory.

Alternatively I can just do write one number per operation as the code is only used once to preload the EEPROM and then cleared for other purposes. i.e.

Hi2cout 1, (40) : pause 10
Hi2cout 2, (0) : pause 10
Hi2cout 3, (7) : pause 10

Which will get around the page issue

Many thanks
Dave
 

Armp

Senior Member
Is it worth modifying your VB program to detect page crossings, and fix the offending lines?

Example
Before:
Hi2cout 52, (121, 115, 116, 101, 109) : pause 5
Hi2cout 57, (26, 1, 1, 26, 2) : pause 5
Hi2cout 62, (1, 26, 3, 1, 26) : pause 5
Hi2cout 67, (4, 1, 26, 6, 0) : pause 5

After:
Hi2cout 52, (121, 115, 116, 101, 109) : pause 5
Hi2cout 57, (26, 1, 1, 26, 2) : pause 5
Hi2cout 62, (1, 26) : pause 5
Hi2cout 64, (3, 1, 26) : pause 5

Hi2cout 67, (4, 1, 26, 6, 0) : pause 5
 

Marcwolf

Senior Member
Hi and thanks for replying

I could modify the code and set it up using a MOD command so that on the 64th memory location I start a new line.

Many thanks
Dave
 
Top