PDA

View Full Version : ArrayRead on longer arrays



amgen
- 20th September 2011, 20:05
Hello,
I havn't found much info on arrayread, but
I would like to use arrayread on an array of about 1000. The maxlength max val is 256, and when I tried leaving off the maxlength, if the "wait" is not found, the routine runs-off-the-end and infact crashes out the program.



ParseSUB: 'InDX must be < 256
b6=0:B7=0
arrayread rcvdata, INDX,NONE, [wait("RUN")]:b6=1
NONE:arrayread rcvdata, INDX,NONE1, [wait("STOP")]:b7=1
NONE1: RETURN


This works well if index < 256. Is there a way to do the same parse for longer arrays ?

Don
amgen

Charles Linquis
- 20th September 2011, 20:26
I haven't tried anything yet, but perhaps you could break your 'rcvdata' into smaller arrays, like

hserin [STR rcvdata1 \255]:hserin [STR rcvdata2 \255]:hserin [STR rcvdata3 \255]

Then you can test all 3 arrays for RUN and STOP.

amgen
- 21st September 2011, 16:07
Charles,
You got me thinking about breaking up array, so I tried a few things,
Arrayread Array[index point in array], limit,goto................................. starts read at a point into array.

After storing chars with RXint, framing with start and end char to start loading and triggering a finish to rcv and parse, I have an index of char count. So now I can figure indexing points and lengths as follows.


ParseSUB: 'InDX up to 500 dec
b6=0
if indx<250 then 'char count less than 250 for 1 sweep
arrayread rcvdata, INDX,NONE, [wait("RUN")]:b6=1:return
else
INDX1=indx-245 'char count >250 and < 500 about
arrayread rcvdata, 250,NONE1, [wait("RUN")]:b6=1:return 'test first 250 char in array
NONE1;
arrayread rcvdata[245], INDX1,NONE, [wait("RUN")]:b6=1:return 'test balance of chars at >245 indx
NONE: RETURN 'back-up a few chars incase "wait" straddles arrayread
endif


Same setup for other parses, I'm not sure if some code could be reduced.
Don