Datasheet
Section 12 16-Bit Duty Period Measurement Timer (TDP)
Rev. 3.00 Sep. 28, 2009 Page 350 of 910
REJ09B0350-0300
(4) Setting Example of Setting Cycle Measurement Mode
Figure 12.12 shows an example of a flowchart for using cycle measurement mode.
Start
Initial setting
Set TDPMDS = 0
Set CST = 0
Set TDPWDMX
Set OVIE = 1
and TWDMXIE = 1
Set TDPMDS = 1
Yes
No
Yes
No
Interrupt occurs
Processing for external
event stopped state
Processing for exceeded
upper limit of pulse width
End of exception handling
Set TDPMDS = 0
End of measurement
OVF = 1
or
TWDMXOVF = 1?
TWDMXOVF = 1?
[1]
[2]
[3]
Set TDPIPE = 1
[4]
[5]
[6]
[1]
[2]
[3]
[4]
[9]
[7] [8]
Set timer mode.
Stop TDPCNT and initialize it to H'0000.
Set pulse width upper limit value.
Pin input enabled.
[5]
[6]
[9]
[7]
[8]
Enable interrupt requests.
Set to cycle measurement mode.
Start cycle measurement.
End of cycle measurement
Processing for external event-stopped state
Processing for exceeded pulse width upper limit
Figure 12.12 Example of Cycle Measurement Mode Settings
(for Pulse Width Upper-Limit Value)