[SOLVED]CCP module in PIC

Thread Starter

Pushkar1

Joined Apr 5, 2021
205
I did search before asking the question but I really don't understand when CCP module can be useful

I see in many examples on websites That CCP is used for frequency measurement

I am expecting here please explain when do you think you need CCP module ?
 

Ian Rogers

Joined Dec 12, 2012
915
CCP module Capture, Compare, PWM.. Has many uses... I primarily use PWM but I have used capture..

So anything that needs a controlled pulse output
Measuring time between incomming pulses
Comparing against the timer..

The Enhanced CCP can synchronize outputs t run HBridges safely. And can control digital motors ( Some devices can link CCP and QEI modules ).

I think the limitation is an imagination... We once made a PWM unit using compare to get 16 bit output resolution, far extending the PWM unit..
 

Papabravo

Joined Feb 24, 2006
16,772
My main use of input capture was reading and decoding signals from an IR remote using the NEC protocol. Easy to use and ultra reliable. A major complaint on the product was missed IR commands. After switching to using 'input capture' those complaints became a thing of the past.
 

AlbertHall

Joined Jun 4, 2014
11,498
I have just built a something which decodes the MSF time signal. I used both capture and compare to time and confirm the received time code pulses. As it uses interrupts the processor is free to do other stuff while waiting for a pulse.
 

atferrari

Joined Jan 6, 2004
4,424
Have you tried to understand the definitons in the datasheet? No surprise that one is "compare" and the other "capture".
 

Thread Starter

Pushkar1

Joined Apr 5, 2021
205
Input capture, It allows you to start and stop a timer based on external signals.

Bob
Okay!! My understanding in capture mode, Timer start and stop when specific event occur such as zero crossing detector for 5 V AC signals. Capture module will help to measure time interval between every crossing.

I think I'm going to right direction
 

Papabravo

Joined Feb 24, 2006
16,772
Okay!! My understanding in capture mode, Timer start and stop when specific event occur such as zero crossing detector for 5 V AC signals. Capture module will help to measure time interval between every crossing.

I think I'm going to right direction
Almost. The timer does not stop when the event happens. It records the time of the event and keeps going to catch the next event. So you can use the series of time captures to look for the delta-t between each pair of events. Very useful for PCM (Pulse Code Modulation) signals.
 

geekoftheweek

Joined Oct 6, 2013
683
I have never used the capture mode myself, but have used the compare mode to easily create a 50% duty cycle square wave that is much easier to adjust than recalculating the PWM values for each change. Worked great for triggering HEI modules for my musical spark plug project.

The special event trigger function of the compare mode will also allow you to start an ADC conversion at specified intervals.

If only the capture mode had a special event function also to reset the timer...
 
Top