amgen
- 23rd September 2011, 14:48
Trying to have ARRAYREAD read more than 255 chars and in LIB, R6, the max char counter is word and only used as byte for max parse.
Would changing the DECREMENT to 16 bit work without messing up something ?
ArrayRead in LIB 18L
;************************************************* ***************
;* ARRAYREAD : Read char from array *
;* *
;* Input : R5 = pointer to next char in array *
;* : R6 = number of chars left in array (timeout) *
;* Output : W *
;* *
;* Notes : C clear if timed out. *
;************************************************* ***************
ifdef ARRAYREADTO_USED
LIST
ARRAYREADTO movf R6, F ; Check for no chars left in array
bcf STATUS, C ; Preset for timed out (C clear)
bz arrayreaddone ; No chars left
decf R6, F ; Count down the characters left and fall through to ARRAYREAD
NOLIST
ARRAYREAD_USED = 1
endif
Code to DECREMENT 16 bit val,
The Decrement of a 16 Bit value isn't quite so simple:
CODE
movf Reg, f ;Set "Z" if LOW "Reg" == 0
btfsc STATUS, Z
decf Reg + 1, f ; If Low byte is Zero, Decrement High
decf Reg, f
To make count up to 16bit
To make count up to 16bit
ifdef ARRAYREADTO_USED
LIST
ARRAYREADTO movf R6, F ; Check for no chars left in array
bcf STATUS, C ; Preset for timed out (C clear)
bz arrayreaddone ; No chars left
movf R6, f ; Set "Z" if LOW "Reg" == 0
btfsc STATUS, Z
decf R6 + 1, f ; If Low byte is Zero, Decrement High
decf R6, f
NOLIST
ARRAYREAD_USED = 1
endif
I want to check with experts before I screw things up.
Thanks
Don
amgen
Would changing the DECREMENT to 16 bit work without messing up something ?
ArrayRead in LIB 18L
;************************************************* ***************
;* ARRAYREAD : Read char from array *
;* *
;* Input : R5 = pointer to next char in array *
;* : R6 = number of chars left in array (timeout) *
;* Output : W *
;* *
;* Notes : C clear if timed out. *
;************************************************* ***************
ifdef ARRAYREADTO_USED
LIST
ARRAYREADTO movf R6, F ; Check for no chars left in array
bcf STATUS, C ; Preset for timed out (C clear)
bz arrayreaddone ; No chars left
decf R6, F ; Count down the characters left and fall through to ARRAYREAD
NOLIST
ARRAYREAD_USED = 1
endif
Code to DECREMENT 16 bit val,
The Decrement of a 16 Bit value isn't quite so simple:
CODE
movf Reg, f ;Set "Z" if LOW "Reg" == 0
btfsc STATUS, Z
decf Reg + 1, f ; If Low byte is Zero, Decrement High
decf Reg, f
To make count up to 16bit
To make count up to 16bit
ifdef ARRAYREADTO_USED
LIST
ARRAYREADTO movf R6, F ; Check for no chars left in array
bcf STATUS, C ; Preset for timed out (C clear)
bz arrayreaddone ; No chars left
movf R6, f ; Set "Z" if LOW "Reg" == 0
btfsc STATUS, Z
decf R6 + 1, f ; If Low byte is Zero, Decrement High
decf R6, f
NOLIST
ARRAYREAD_USED = 1
endif
I want to check with experts before I screw things up.
Thanks
Don
amgen