CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00User’s Manual U18172EJ2V0UD 976.4.3 Pulse width measurement operationsIt is possible to measure the pulse width of the signals input to the TI000 pin and TI010 pin using 16-bit timercounter 00 (TM00).There are two measurement methods: measuring with TM00 used in free-running mode, and measuring byrestarting the timer in synchronization with the edge of the signal input to the TI000 pin.When an interrupt occurs, necessary pulse width is calculable by reading the valied value of the capture register.The capture operation is not performed until the signal pulse width is sampled in the count clock cycle selected byprescaler mode register 00 (PRM00) and the valid level of the TI000 or TI010 pin is detected twice, thus eliminatingnoise with a short pulse width ( see Figures 6-18 ).Figure 6-18. CR010 Capture Operation with Rising Edge SpecifiedCount clockTM00TI000Rising edge detectionCR010INTTM010N − 3 N − 2 N − 1 N N + 1NSettingThe basic operation setting procedure is as follows.<1> Set the CRC00 register (see Figures 6-19, 6-22, 6-24, and 6-26 for the set value).<2> Set the count clock by using the PRM00 register.<3> Set the TMC00 register to start the operation (see Figures 6-19, 6-22, 6-24, and 6-26 for the set value).Caution To use two capture registers, set the TI000 and TI010 pins.Remarks 1. For the setting of the TI000 (or TI010) pin, see 6.3 (5) Port mode register 2 (PM2) and port modecontrol register 2 (PMC2).2. For how to enable the INTTM000 (or INTTM010) interrupt, see CHAPTER 10 INTERRUPTFUNCTIONS.(1) Pulse width measurement with free-running counter and one capture registerSpecify both the rising and falling edges as the valid edges of the TI000 pin, by using bits 4 and 5 (ES000 andES010) of PRM00.When 16-bit timer counter 00 (TM00) is operated in free-running mode, and the valid edge specified byPRM00 is input, the value of TM00 is taken into 16-bit timer capture/compare register 010 (CR010) and anexternal interrupt request signal (INTTM010) is set.Sampling is performed using the count clock selected by PRM00, and a capture operation is only performedwhen a valid level of the TI000 pin is detected twice, thus eliminating noise with a short pulse width.Caution The measurable pulse width in this operation example is up to 1 cycle of the timer counter.