if CTPeriod = 1 then PulseCount1 = PulseCount1 + 1 ;increment pulse counter
Code:
decfsz _CTPeriod ; if CTPeriod == 1, this decrement will make it zero
goto Check2
incf _PulseCount1 ; increase the LSB
btfsc STATUS,Z ; if LSB == 0
incf _PulseCount1+1 ; increase the MSB
return
Check2:
decfsz _CTPeriod ; if CTPeriod == 2, this decrement will make it zero
goto Check3
incf _PulseCount2 ; increase the LSB
btfsc STATUS,Z ; if LSB == 0
incf _PulseCount2+1 ; increase the MSB
return
Check3:
decfsz _CTPeriod ; if CTPeriod == 3, this decrement will make it zero
goto Check4
incf _PulseCount3 ; increase the LSB
btfsc STATUS,Z ; if LSB == 0
incf _PulseCount3+1 ; increase the MSB
return
Check4:;CT_Period is greater than 3
; do something here
return
Disclaimer : Unverified code.
Bookmarks