Mosaic
Well-Known Member
This one cost me 12hrs:
The first bit of code executes a test of the Z flag. Works on the simulator just fine.
In the real 16f886 hardware, it fails....unless i include the movf PIDcycle,f.
As far as I can tell the Z flag test is supposed to work as there is just the 'return' before the test, yet it fails. I used the beeptask to trace it as ICD can't be used...the pins are occupied.
Can anyone shed any light on this?
Code:
call Gainctrl; check if sample due, PIDcycleRef period, Tmp1 is unaffected.
;bsf Beeptime,6 ; task a 50+ms beep
[B][U]movf PIDcycle,f[/U][/B]
btfss STATUS,Z ; test results of Gainctrl, skip if zero,else
return ; if non zero.(sample period timer not done)
Code:
Gainctrl ;
movf PIDcycleRef,w ; set by PID process control
subwf PIDcycle,w; this count is updated by ISR.
btfss STATUS,C ; can compensate for code over 1 ms cycle
return
clrf PIDcycle; reset counter if count is met.
return ;
The first bit of code executes a test of the Z flag. Works on the simulator just fine.
In the real 16f886 hardware, it fails....unless i include the movf PIDcycle,f.
As far as I can tell the Z flag test is supposed to work as there is just the 'return' before the test, yet it fails. I used the beeptask to trace it as ICD can't be used...the pins are occupied.
Can anyone shed any light on this?
Last edited: