The capture/compare (CC) block is used for capture events or compare events. TIMG0 through TIMG13 have up to 2 identical capture/compare blocks and TIMG24 has up to 4 identical capture/compare blocks present to support external or internal signals. Any of the TIMx capture/compare blocks may be used to capture timings of an input signal or to generate time intervals.
Key registers for configuring capture/compare mode:
- TIMx.LOAD: the contents of this register are copied to counter (TIMx.CTR) on any operation designated to do a "load". This value is also used to compare with the counter value for generating a "Load Event" which can be used for interrupt, trigger, or signal generation actions.
- TIMx.CC_xy[0/1]: this is a register that can be used as either a capture register to acquire or record the next counter value on an event, or a compare register to the current counter to create an event.
- TIMx.CCCTL_xy[0/1]: this register controls the operations of the respective CC (capture/compare) blocks. In capture mode, it can configure whether a rising edge or falling edge generates a load, zero, advance, or capture condition. In compare mode, it controls which sources generate different types of compare events.
- TIMx.CTRCTL: this register provides control over the counter operation in different conditions.
- TIMx.IFCTL_xy[0/1]: this register controls the input filtering, input selection, and input inversion for the associated CC block.
Note: Capture and compare modes on a TIMx instance use the same registers. Therefore application cannot perform a capture and compare on the same channel at the same time.