Home › Forums › Microcontrollers › PIC Microcontroller › Using Capture and Compare mode together – PIC 12F1840 › Reply To: Using Capture and Compare mode together – PIC 12F1840
I’m using PIC 12F1840 (single CCP module) and internal oscillator 16MHz. I want to read Pulse width of input signal at RA2 (input PWM frequency 400Hz). Generate new PWM out (output PWM frequency 18KHz) at RA5 with same pulse width reading at input PWM at RA2.
steps i followed :
1) Capture Mode: detected rising edge (interrupt detection) -> detected falling using capture mode (interrupt detection) at RA2, got pulse width (falling edge – rising edge)
2) Compare Mode : write pulse width to RA5 using compare mode
Now, my problem is when controller is in compare mode at the same time my new rising or falling edge get detected system is not able to find new pulse width.