setup
banksel OSCCON
movlw b'01101000' ;select 4MHz clock = 1MHz instruction cycle
movwf OSCCON ; Set PIC oscillator frequency
banksel T1CON
movlw b'00000001' ;timer 1 on
movwf T1CON
banksel CCP1CON
movlw b'00001011' ;Special Events Trigger
movwf CCP1CON
banksel CCPR1L ;set timer 1 to repeat
movlw low(5000) ;every 500 clock cycles
movwf CCPR1L ;equals 5mS
banksel CCPR1H
movlw high(5000)
movwf CCPR1H
loop
banksel PIR1
btfss PIR1,CCP1IF ;wait for interrupt flag
goto loop ;to be set
;5mS has passed
bcf PIR1,CCP1IF ;clear it
goto loop