Operation; Duty Measurement For External Event Signal; Figure 14.2 Example Of Duty Measurement For External Event Signal - Renesas H8S/2437 Hardware Manual

Renesas 16-bit single-chip microcomputer h8s family / h8s / 2600 series
Table of Contents

Advertisement

14.4

Operation

14.4.1

Duty Measurement for External Event Signal

Figure 14.2 shows an example of duty measurement for the external event signal.
1. Select the external event signal whose duty needs to be measured by the IS2 to IS0 bits in
TWCR1.
2. Select the count clock source for TWCNT by the CK2 to CK0 bits in TWCR1.
3. Write 1 to the START bit in TWCR2. At this time, TWCNT is cleared to H'00.
4. When a rising edge of the external event signal is detected, TWCNT starts counting. Then, if a
falling edge of the external event signal is detected, the TWCNT value is transferred to
TWICR. If the second rising edge of the external event signal is detected, TWCNT stops
counting. At this time, the ENDF flag in TWCR2 is set to 1.
When TWICR and TWCNT values are read and then compared, duty measurement for the
external event signal is accomplished.
External event signal
START signal
TWCNT
Duty measurement

Figure 14.2 Example of Duty Measurement for External Event Signal

Rev. 1.00, 09/03, page 406 of 704
TWCNT
clear
M
N
H'00
TWICR
X
end flag
Count stop
t
N

Advertisement

Table of Contents
loading

Table of Contents