CHAPTER 7 TIMER/COUNTER FUNCTION1617.2.3 Pulse width measurementThe 16-bit timer register n (TMn) can be used to measure the pulse widths of the signals input to the TIn0 andTIn1 pins.Measurement can be carried out with TMn used as a free running counter or by restarting the timer insynchronization with the edge of the signal input to the TIn0 pin.(1) Pulse width measurement with free running counter and one capture registerIf the edge specified by the prescaler mode register n (PRMn) is input to the TIn0 pin when the 16-bit timerregister n (TMn) is used as a free running counter (refer to Figure 7-11), the value of TMn is loaded to the 16-bitcapture/compare register n1 (CRn1), and an external interrupt request signal (INTTMn1) is set.The edge is specified by using bits 6 and 7 (ESn10 and ESn11) of the prescaler mode register n (PRMn). Therising edge, falling edge, or both the rising and falling edges can be selected.The valid edge is detected through sampling at a count clock cycle selected by the prescaler mode register n(PRMn), and the capture operation is not performed until the valid level is detected two times. Therefore, noisewith a short pulse width can be rejected.Figure 7-11. Control Register Settings for Pulse Width Measurement withFree Running Counter and One Capture Register(a) 16-bit timer mode control register 0, 1 (TMC0, TMC1)TMCn3 TMCn2 TMCn1 OVFnTMCn 0 0 0 0 0 1 0/1 0Free running mode(b) Capture/compare control register 0, 1 (CRC0, CRC1)CRCn2 CRCn1 CRCn0CRCn 0 0 0 0 0 1 0/1 0CRn0 as compareregisterCRn1 as captureregisterRemark 0/1: When these bits are reset to 0 or set to 1, the other functions can be used along with the pulsewidth measurement function. For details, refer to Figures 7-2 and 7-3.