PDA

View Full Version : inturrepts to control the servo motor position!



parinshah
- 2nd May 2006, 07:55
hi, im using 16f876 to control a servo motor,i m driving motor using ccp1 pwm mode, now i wish to use ccp2 for compare for postion i will feed pulse from encoder to ccp2-its 500 pulse for ful rotation,compare mode will generate inturrept on perticuler counts and on inturrept flag set i wish to stop sending pulse on ccp1 to stop motor.
CCP1CON = %00001100 ' Set CCP1 to PWM
CCP2CON=%00001010
T2CON = %00000101 '
T1CON=%00000011
this the configurationfor modes.
now how can i use inturrept, should use basic interupt or assembly.i m nt abale make myself clear abt inturrept from manual.is it possible do it.