Hi Franck, Your question has truly purplexed me. What are these "Bleeps"? I used to think that a shaft encoder gives 2 signals in quadrature (90 deg. out of phase). Both signals need to be used to know where the motor has moved to? Or are you doing speed control? If you are doing position control, I would suggest you use the HCTL2020 from HP. Its a rugged and proven design, might cost a bit though. At 16:56 5/4/98 -0400, Franck D Rougier wrote: >Hi, > >I am implementing a robot control circuit using the PIC16C73. The motor is >driven by a National LMD18201 H-Bridge that is being fed from the >microcontroller with a PWM pulse train. >I successfully used the Timer2 (TMR2) in conjunction with the CCP1 pin to >generate the pulse. >Now, I need to read "bleeps" or pulses from a digital encoder mounted on the >motor shaft. >I want to be able to count the number of bleeps from the encoder while the >pulse train is being generated by the pic, then shut the motor down. >I tried implementing on pin change interrupt from PORTB pin, so that each >time an interrupt occur, a counter is incremented. But when I debugged the >code, everything was working fine. That is the TMR2 will increment and set >CCP1 at the appropriate timing even if it is in the interrupt service >routine. I built the circuit and nothing happened. Actually, the pic would >read a series of pulse from the encoder then turn off the pulse train. I >can't find the culprit! > >So my questions are: > >* how do I read the bleeps from the encoder (digital)? >* Does the TMR2 overflow interrupt is turned off when the code goes in the >ISR causing a o% duty cycle? > >Help me please. > > >Franck > > >PS: Please use the same subject for mail sorting purposes. Thank you. > > with best wishes and regards Sujay Sirur Email: sirur@giasbg01.vsnl.net.in Home: 604, Chitrapur Housing Society, Plot no 68, 15th Cross, 8th Main, Malleshwaram Bangalore 560 055. INDIA Tel. no: 91-80-344