Home › Forums › Microcontrollers › PIC Microcontroller › Using Capture and Compare mode together – PIC 12F1840 › Reply To: Using Capture and Compare mode together – PIC 12F1840
As I told above, a single CCP will work only in one mode at a time. I think you should do like this.
- You can use a normal input interrupt or on-change interrupt to detect rise and fall.
- Start a timer when rise is detected and stop it when fall happens.
- So you will get the time period from the timer count.
- Use that CCP module only in PWM mode.
- Just change the duty cycle based on the timer value.