
Figure 21.12
Time Measurement Function Associated Register Settings
Start
End
In the GiBCR0 register:
-Set bits BCK1 and BCK0 to select the count source
-Set bits DIV4 to DIV0 to select the count source
divide ratio
Set the BTS bit in the GiBCR1 register
(Note 1)
In the GiBCR1 register:
-Set bits RST2 and RST1 to select the base timer
reset source
-Set bits UD1 and UD0 to select the counting method
-Set the BTS bit to 0
In the GiTMCRj register:
-Set bits CTS1 and CTS0 to select the time
measurement trigger
-Set bits DF1 and DF0 to select the digital filter
-Set bits GT, GOC, and GSC to configure the gate
function
-Set the PR bit to configure the prescaler function
Set the FSCj bit in the GiFS register to 1
Set the FSCq bit in the GiFS register to 0(3)
Select the time measurement function
Set the IFEj bit in the GiFE register to 1
Set the IFEq bit in the GiFE register to 1(3)
Enable the channel j's function
Set the IIOkIR register to 00h
Set the IRLT bit in the IIOkIE register to 1
In the IIOkIC register:
-Set bits ILVL2 to ILVL0 to select the interrupt priority
level
-Set the IR bit to 0
Set the TMijE bit in the IIOkIE register to 1
If the PR bit in the GiTMCRj register is set to 1 (Prescaler fucntion used)
Set the GiTPRj register
If the GOC bit in the GiTMCRj register is set to 1 (Gate function
is disabled by matching the base timer and the GiPOk register)
Set the GiPOCRq register to 00h
Set the GiPOq register
After the time measurement is taken initiated by the first trigger,
the following trigger inputs are disabled. Set the time period
between the first trigger input and the next enabled retrigger input.
When j = 6, q = 4
When j = 7, q = 5
A
Wait for 2 fBTi cycles or more
Set the prescaler value
(enabled only if j = 6, 7)
(Note 2)
Notes:
1. Gate function and prescaler function can be configured in registers GiTMCR6
and GiTMCR7. Set bit 4 to bit 7 in registers GiTMCR0 to GiTMCR5 to 0.
2. Set the indicated bits to use interrupts, and then set the I flag to 1 to enable
interrupts.
3. Set the FSCq bit to 0 and the IFEq bit to 1 when using the gate function.
i = 0, 1 j = 0 to 7
k = 0 to 11 q = 4, 5