From Scott Dattalo
;inc incf high,f incfsz low,f decf high,f A downcounting version; ;dec movf low,f skpnz decf high,f decf low,f on the 18cxxx you can simplify these to: infsnz low,f incf high,f and tstfsz low,f decf high,f decf low,fThanks to Colin Smith for corrections to this page
Al Williams of AWC Says:
Slight typos in the 18F code above for decrement. TSTFSZ doesn't put a result anywhere, so no ,F is required. Also, should be testfsnz but that instruction doesn't exist!
So in fact, you should use the 16F version for decrementing. Also, be aware that the Z flag may be set after this operation but the counter is not zero (just part of it).
Comments:
Decrement Counters at 18F: decf CounterLow, f btfss STATUS, C decf CounterHigh, f btfss STATUS, C decf CounterUpper, f and so on... Check for Carry-flag in Loops Loops will execute Counter+1 times. After Loop's exit, Counter == -1.
Questions: