interrupt movwf int_work; Save Context
swapf STATUS,W
movwf int_status
bcf STATUS,RP0; make sure we are in bank 0
bcf STATUS,RP1
btfss INTCON,RBIF
goto NotRB0
incf IntCount,F
bcf INTCON,RBIF
NotRB0 btfss PIR1,CCP1IF
goto NotTimeUp
movfw IntCount
movwf Count
clrf IntCount
bsf Flags,NewTime
bcf PIR1,CCP1IF ;reset special event trigger interupt
NotTimeUp swapf int_status,W ;restore context
movwf STATUS
swapf int_work,F ;swap to file
swapf int_work,W ;swap to work
retfie