CHAPTER 6 16-BIT TIMER/EVENT COUNTER 00User’s Manual U16227EJ2V0UD1486.4.4 External event counter operationSettingThe basic operation setting procedure is as follows.<1> Set the CRC00 register (see Figure 6-26 for the set value).<2> Set the count clock by using the PRM00 register.<3> Set any value to the CR000 register (0000H cannot be set).<4> Set the TMC00 register to start the operation (see Figure 6-26 for the set value).Remarks 1. For the setting of the TI000 pin, see 6.3 (5) Port mode register 0 (PM0).2. For how to enable the INTTM000 interrupt, see CHAPTER 15 INTERRUPT FUNCTIONS.The external event counter counts the number of external clock pulses input to the TI000 pin using 16-bit timercounter 00 (TM00).TM00 is incremented each time the valid edge specified by prescaler mode register 00 (PRM00) is input.When the TM00 count value matches the 16-bit timer capture/compare register 000 (CR000) value, TM00 iscleared to 0 and the interrupt request signal (INTTM000) is generated.Input a value other than 0000H to CR000 (a count operation with 1-bit pulse cannot be carried out).Any of three edgesrising, falling, or both edgescan be selected using bits 4 and 5 (ES000 and ES001) ofprescaler mode register 00 (PRM00).Sampling is performed using the internal clock (f X ) and an operation is only performed when a valid level of theTI000 pin is detected twice, thus eliminating noise with a short pulse width.Figure 6-26. Control Register Settings in External Event Counter Mode(with Rising Edge Specified) (1/2)(a) 16-bit timer mode control register 00 (TMC00)70605040TMC0031TMC0021TMC0010/1OVF000TMC00Clears and starts on match between TM00 and CR000.(b) Capture/compare control register 00 (CRC00)7060504030CRC0020/1CRC0010/1CRC0000CRC00CR000 used as compare register