Chapter 916-bit TimerInput Capture IX - 65When the compare/capture register is read in the interrupt processing after the second timer operation activation,the pulse width can be measured. As the TMCLE flag of the TM8MD register is set to “1”, the binary counter isinitialized to 0x0000 at the next count clock after transferring the value of the binary counter to the compare/cap-ture register at the rising edge of the input signal.The pulse width can be measured by the value of the compare/capture register and the clock source type.(5) Set the timer counter clear enabledTM8MD(0x0000A200)bp11: TMCLE=1(5) Set the TMCLE flag of the TM8MD register to “1” toenable the clear operation of the TM8BC counter.When the value of the TM8BC is captured to theTM8CA register, the TM8BC counter is cleared.(6) Set the timer capture A operation enabledTM8MDA(0x0000A204)bp4: TMACE=1(6) Set the TMACE flag of the timer 8 compare/capture Amode register (TM8MDA) to “1” to enable the captureoperation.(7) Select the timer compare/capture Aoperation modeTM8MDA(0x0000A204)bp7-6: TMAM1-0=10(7) Select the capture register (one edge) by the TMAM1-0flag of the TM8MDA register.(8) Select the timer A pin polarityTM8MDA(0x0000A204)bp5: TMAEG=0(8) Set the TMAEG flag of the TM8MDA register to “0” toselect the rising edge.(9) Set the I/O pin (pin function)P3MD(0x0000A033)bp6: P36M=1(9) Set the P36M flag of the port 3 output mode register(P3MD) to set the port to pin function.(10) Set the Input pin (I/O function)P3DIR(0x0000A023)bp6: P36D=0(10) Set the P36D flag of the port 3 I/O control register(P3DIR) to “0” to set I/O control to the input pin.(11) Initialize the timer 8TM8MD(0x0000A200)bp6: TMLDE=1(11) Set the TMLDE flag of the TM8MD register to “1” toinitialize the timer 8. The binary counter (TM8BC) isinitialized to 0x0000. Reset the TMLDE flag to “0” aftersetting.(12) Set the interrupt levelG7ICR(0x0000891C)bp14-12: G7LV2-0=100(12) Set the interrupt level by the G7LV2-0 flag of the G7ICRregister. When the interrupt request flag has been setalready, clear the request flag.(13) Enable the interruptG7ICR(0x0000891C)bp8: G7IE1=1(13) Set the G7IE1 flag of the G7ICR register to “1” toenable the interrupt.(14) Start the timer operationTM8MD(0x0000A200)bp7: TMCNE=1(14) Set the TMCNE flag of the TM8MD register to “1” tooperate the timer 8.Setup Procedure Description