PDA

View Full Version : Long varible strings



flashg
- 14th October 2006, 05:40
Hi Folks,
edit: VariAble (sp)

I have a situation that I need to SerOut a 300+ long string whenever the the command "UPD" is recieved. Not only is it very long string but it will vary depending on the A2D voltage and GPIO inputs. It will be using a 12F683, so ram, eeprom, and code space is at a premium. Using MASM is not a option.

I have wriiten a sample code that is conceptually what I am thinking, but may not be perfect syntax wise. I am hoping to get positive input on whether this method will 1) do the job 2) at 9600 baud be fast enough as not to miss and "UPD" polls, and 3) is there a better way?

Off hand, it looks like short eeprom stings combined with the long Lookup statement are going to be an issue. In the real program the eeprom string will be about this long but the Lookup command would be about 4 times longer. Also in the actual program, a method of suppliing a varible A2D reading will be needed when ever a 255 or 254 is seen. I would have liked to have used a variable to store eeprom 'lookup' data but the 12F683 just does not have the ram to spare.

Thank you



--------------------------------------------------------------------
DATA @1, "Jack"
DATA @5, "Tom"
DATA @10, "Jill"

DATA @25, "jump"
DATA @30, "ran"
DATA @35, "walk"

DATA @100, "hill"
Data @104, "store"
DATA @109, "well"

DATA @150, "a"
DATA @153, "the"
DATA @156, "miles"
DATA @161 "per hour"

DATA @170, "to"
DATA @172, "up"
DATA @174, "under"
DATA @179, "hyper-motovated"

DATA @190, "ed"
DATA @192, "ly"
DATA @196, "ing"
DATA @199, 13,10

DATA @210, "."
DATA @211, "?"
DATA @212, "!"
DATA @213, " "

DATA @254, 254
DATA @255, 255


'12F683 has 128 Bytes of RAM, PBP uses 20 Bytes, Leaving 108 Bytes for varibles
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''
main: SerIn2 RxPin,Mode,ParityFail, TO, TOFail,[WAIT("UP"), STR Request\1]

if Request[0] = "D" then
for UPDCounter = 0 to NumberOfStrings
Lookup UPDCounter,[1,213,35,190,213,255,213,156,213,172,213,150,213,1 00,213,179,212,199], Start
Lookup UPDCounter,[4, 1, 4, 2, 1, 1, 1, 5, 1, 2, 1, 1, 1, 4, 1, 15, 1, 2], Length
'Jack walked 12.3 miles up a hill hyper-motovated!<cr> <lf>
for Counter = Start to Length
read Counter,StringByte
if StringByte = 255
Serout2,TxPin,Mode[dec MilesA2D]
else
SerOut2 TxPin,Mode,[StringByte]
endif
next Counter
next UPDCounter
endif

goto main
endif
--------------------------------------------------------------