PDA

View Full Version : Arraywrite Maxlength modification



pedja089
- 4th March 2013, 15:29
From manual:
Maxlength must be less than 256:confused:
But I need limit array to 1000 bytes, so I decide to play with pbppi18l.lib

Find

ARRAYWRITETO movf R6, F ; Check for no space left in array
bcf STATUS, C ; Preset for timed out (C clear)
bz arraywritedone ; No space left
decf R6, F ; Count down the characters left
bra ARRAYWRITE
And replace with

ARRAYWRITETO movf R6, F ; Check for no space left in array
bcf STATUS, C ; Preset for timed out (C clear)
BTFSC STATUS, Z
DECF R6+1, F
BTFSC R6+1,7
bra arraywritedone ; No space left
decf R6, F ; Count down the characters left
bra ARRAYWRITE

Now Maxlength can be up to 32767:D
Probably need little more testing.

pedja089
- 4th March 2013, 15:47
Also now you can use R6 system variable to determine array length:

ArrayMaxLen con 1000
TxBuffer var byte[ArrayMaxLen]
ArrayLen var word
Arraywrite TxBuffer, ArrayMaxLen, ArrayOverMax,[".........","etc"]
ArrayLen = ArrayMaxLen - R6