Heads-up Toni, although it's I2C, it can also be adaped for SPI, the theory of loading WORDS remains the same...

Here is an easy way to read a string of WORD data from an external I2C EEPROM and load into an array... (I'm assuming 24LC32/24LC64 types here as they require a WORD Address, just a minor bit of code fiddling is needed for the smaller types to determine Page and Byte addresses).

Example: Load WORD array from external EEPROM starting say at address $0C00, fifteen array elements deep (ie 15 words to be loaded)...

Variables used....

DataW var WORD [30] ' Array big enough for your needs
I2Caddress var BYTE ' Device Address
MessageAddress var WORD
' Starting Address of Data in external EEPROM
MessageLen var BYTE
' Number of WORD Array Elements to load (Min=1, Max=128)
TempA var BYTE ' Temporary BYTE Counter
TempB var BYTE ' Temporary BYTE Counter
TempC var BYTE ' Temporary BYTE Counter
TempW var WORD ' Temporary WORD Variable

.. ..

This is all you need in your program each time you want to acquire a message....

MessageAddress=$0C00 ' Starting address for data
MessageLen=15 ' Remember this is the number of WORDS to load
Gosub GetwordData ' Load from EEPROM into WORD array

.. ..

And this is the subroutine where all the work gets done... data is always loaded into the array starting at DataW(0) for the first word, and ending with DataW(MessageLen-1) for the last word.

GetWordData:
TempB=MessageLen*2-1
I2CAddress=$A0
For TempA=0 to TempB
TEMPW=MessageAddress+TempA
I2CRead SDA,SCL,I2CAddress,TempW,[TempC]
DataW.Lowbyte(TempA)=TempC
Next TempA
Return

Dont specify MessageLen bigger than your defined aray size - you won't get any error messages, but it will just happily overwrite system RAM with corresponding upredictable results.

To save even more codespace, why not have the first byte of your message define the length of the data array to load, so therefore the first byte in EEPROM can be MessageLen, then followed by your data. I'll let you figure that...

If all your messages are a constant size (as per your example) then everything of course becomes correspondingly simpler, as your program needs only to provide the message number, and the GetData subroutine can figure out where it's located.

Likewise if you're loading BYTES instead of WORDS, then again everything is simplified.

I trust this is what you wanted.

Melanie