list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO1, WDT = OFF, LVP = OFF, DEBUG = ON
Axis_Port Equ PORTB ; Set Axis_Port to Equal PortB
Axis_Tris Equ TRISB ; Set Axis_Tris to Equal TrisB
X_Axis Equ 3 ; Set X_Axis to Equal 3
org 0x0000
Init
movlw 0x72 ; 8MHz clock select
movwf OSCCON
clrf Axis_Tris
bsf Axis_Tris, X_Axis
[B] movlw 0x38
movwf T3CON[/B]
Main
bcf T3CON, TMR3ON
clrf TMR3L
clrf TMR3H
bcf PIR1, CCP1IF
movlw 0x45
movwf CCP1CON
bcf PIR1, CCP1IF
Loop1
btfss PIR1, CCP1IF
goto Loop1
bsf T3CON, TMR3ON
bcf PIR1, CCP1IF
movlw 0x44
movwf CCP1CON
Loop2
btfss PIR1, CCP1IF
goto Loop2
bcf T3CON, TMR3ON
bcf PIR1, CCP1IF
goto Main
End