PDA

View Full Version : Use external eeprom to hold info for serial LCD



V8TR4
09-26-2008, 10:42 PM
Hi Everyone,

I would like to combine a BS2 and a serial LCD along with external eeprom and store all the text for the LCD on the eeprom. Is this possible to achieve?

Thanks,
Mark

SRLM
09-27-2008, 01:52 AM
Yes.

$WMc%
09-28-2008, 05:30 AM
V8TR4
I'm working on a the same project w/ the BS2P40
I just started. I have a 24LC25b, 24LC256, and a 24LC32a. If you beat me to punch please POST IT!!!
Once I get it to work,I'l post what I came up w/ and a "Test Code" to go w/ It.

Sorry I'm not much help,But if We put are heads together;Take the Best of both of are Codes,It should be something Good

I'm gonna try to use a 1 wire serial protocal to free up an I/O pin.I'll put the EPROM loader up @ the begaining of the code,Load it before the "Main:' program starts, and use a sub routin to get DATA from the EPROM

I'll Post My findings later this week,And I'll look for your Post!!!

$WMc%____out

SolarBlitz
09-28-2008, 10:51 PM
I've also been trying to maximize memory on my BS2pe. The extra 8 banks of EEPROM are nice... I also have external I2C EEPROM. (My next trick will be 'bank switching' - using one slot to copy code from EEPROM to a 3rd slot).

This is code I've used successfully to pull text strings (which take a huge amount of memory) from otherwise unusable EEPROM.


var1 = 8 'slot for text data
eeprom_add = $01D0 ' this is a pointer to the first character in the string you want to print
var2 = 25 ' length 'number of characters to retrieve
GOSUB EEPROM_PRINT



EEPROM_PRINT:

STORE VAR1 ' this is passed from the calling argument (if you're using multiple 'onboard' slots)
FOR memory1 = 0 TO var2
READ eeprom_add+memory1, value
PAUSE 5
SEROUT txpin, baudrate, [value] ' I use this to print to a serial LCD screen
PAUSE 5 ' these are here just for the serial LCD.. can be removed if only using 'DEBUG' -
DEBUG value ' output to debug

NEXT

RETURN


The 'Store' command is useful is swapping between 'onboard' memory slots.


if you're using an I2C eeprom... you should consult the chip documentation...
the I2C snippets are below...
'--------------------------------------------------------
' EEPROM Snippet
'--------------------------------------------------------

EEPROM_READ_WRITE:
I2COUT SDA, $A0,eeprom_add.HIGHBYTE\eeprom_add.LOWBYTE, [value]

PAUSE 20

' Reading Section
I2CIN SDA, $A1,eeprom_add.HIGHBYTE\eeprom_add.LOWBYTE, [value]
RETURN

This works well. I've found that setting these variables and calling the function saves TONS of programming space.
calling it is almost equivalent to: DEBUG "SPOT", CR (5 chars output)... and you can use it for up to 255 chars... over and over.

Good Luck !!


SolarBlitz