There have been a number of solutions to this type of problem. If the messages you plan on displaying won't be changed once the pic is programmed, These may work:
STRINGS - How to store and retrieve strings in Code Space by Darrel Taylor.
Here is a thread which deals with the storage of strings as well.
One other possibility is use an external EEPROM. Limit all the messages to X number of characters (say 255). Then, depending on the message, go to the designated starting address for that message (0 for message A, 256 for message B, ...) Also store a "stop" character to know where the message ends. This would allow something like (This is an example, not a completed program):
Code:
MessageString VAR BYTE[256]
StartAddress VAR WORD
cnt VAR BYTE
StopChar CON 3
MessageNumber = 1
StartAddress = MessageNumber * 256
cnt = 0
ReadMessage:
I2CREAD DataPin,ClockPin,Control, (StartAddress+cnt) ,[MessageString(cnt)]
IF MessageString(cnt) <> StopChar THEN ReadMessage
HTH,
Steve
EDIT: Added varible declaration for StartAddress
Bookmarks