MCU: Enhanced mid-range
Language: MPASM
Development: MPLAB 8.92
Cold wet day with time to waste, so was trying out an idea for table reads to avoid setting FSRxH/L. It doesn't work, but I do not understand exactly why. The "conventional" version setting FSRxH/L works like a charm.
If "A" returned nothing, I could see that. But, it returns the first element in the table and only that element, regardless of the value of FSR0. Why does the instruction "moviw FSRO++" appear to be ignored?
Regards, John
Language: MPASM
Development: MPLAB 8.92
Cold wet day with time to waste, so was trying out an idea for table reads to avoid setting FSRxH/L. It doesn't work, but I do not understand exactly why. The "conventional" version setting FSRxH/L works like a charm.
Code:
;A: DOES NOT WORK (i.e., only returns 173 despite FSR0 increment)
AltTbl
clrf FSR0L
clrf FSR0H
bsf FSR0H,7
_AltTbl
call AltLUT
movwf temp
; more code here
bra _AltTbl
AltLUT
moviw FSR0++
dt 173,0,37,3,1,34,131
dt 1,31,67,2,27,99,3
;*************************************************************
;B: WORKS (i.e.,rotates through the table)
AltTbl
movlw low AltLUT
movwf FSR0L ;first register in LUT
movlw high AltLUT
movwf FSR0H ;sets FSR0H,7
_AltTbl
moviw FSR0++
movwf temp
; more code here
bra _AltTbl
AltLUT
dt 173,0,37,3,1,34,131
dt 1,31,67,2,27,99,3
Regards, John