HPWM 1,127,1000 ' Start Motor1
Hpwm 2,127,1000 ' Start Motor2
For Msec=0 to 300
PauseUS 10 ' 10uSec * 300 = 3mSec = 3 Cycles
If SensorX=Something then Doplahplah
If sensorY=Somethingelse then DoAnotherPlahPlah
next
CCP1CON=0 'stop PWM 1
CCP2CON=0 'stop PWM 2
HPWM 1,127,1000 ' Start Motor1
Hpwm 2,127,1000 ' Start Motor2
For Msec=0 to 300
PauseUS 10 ' 10uSec * 300 = 3mSec = 3 Cycles
pwm portB.0, 127, 2000 ' run the motor connected on portB.0 with pwm
next
CCP1CON=0 'stop PWM 1
CCP2CON=0 'stop PWM 2
Bookmarks