Wednesday, December 7, 2011

Microchip PIC – Capture, Compare modules

Capture Mode Operation
 
Let the value of a timer register to be captured by hardware based on an external event. Ex: Think you need to record value of the counter value between two events, then we can use capture module for that. We will have some sensor units to capture event and will connect them to capture units. When event occurs this will record counter (or any register) value.


clip_image002

· In Capture mode, CCPR1H:CCPR1L captures the 16-bit value of the TMR1 register when an event occurs on pin RC2/CCP1.
· An event is defined as one of the following:
o Every falling edge
o Every rising edge
o Every 4th rising edge
o Every 16th rising edge




Compare mode operation

In Compare mode, the 16- bit CCPR1 register value is constantly compared against the TMR1 register pair value. When a match occurs, the RC2/CCP1 pin is:
· Driven high
· Driven low
· 30
· Remains unchanged

clip_image004

No comments:

Post a Comment