If TE, T0E or T1E is high, the counter will increment each time the external timer pin receives a
high to low transition. As in the case of the other two modes, when the counter is full, the timer will
overflow and generate an internal interrupt signal. The counter will then preload the value already
loaded into the preload register. As the external timer pins are pin-shared with other I/O pins, to en-
sure that the pin is configured to operate as an event counter input pin, two things have to happen.
The first is to ensure that the TM1/TM0, T0M1/T0M0 or T1M1/T1M0 bits place the Timer/Event
Counter in the event counting mode, the second is to ensure that the port control register
configures the pin as an input. Note that the 28-pin package HT46R24/HT46C24 devices, al-
though having two internal timers, only one TMR1 external control pin is available. As a result
TMR0 cannot be used in the Event Counter Mode.
Configuring the Pulse Width Measurement Mode
In this mode, the width of external pulses applied to the external timer pin can be measured. In the
Pulse Width Measurement Mode the timer clock source is supplied by the internal clock. For the
timer to operate in this mode, the bit pair, TM1/TM0, T0M1/T0M0 or T1M1/T1M0, depending upon
which timer is used, must both be set high. Depending upon which counter is used, if TE, T0E or
T1E is low, once a high to low transition has been received on the external timer pin, the timer will
start counting until the external timer pin returns to its original high level. At this point the TON,
T0ON or T1ON bit, depending upon which counter is used, will be automatically reset to zero and
the timer will stop counting. If the TE, T0E or T1E bit is high, the timer will begin counting once a
low to high transition has been received on the external timer pin and stop counting when the exter-
nal timer pin returns to its original low level. As before, the TON, T0ON or T1ON bit will be automati-
cally reset to zero and the timer will stop counting. It is important to note that in the Pulse Width
Measurement Mode, the TON, T0ON or T1ON bit is automatically reset to zero when the external
control signal on the external timer pin returns to its original level, whereas in the other two modes
the TON, T0ON or T1ON bit can only be reset to zero under program control. The residual value in
the timer, which can now be read by the program, therefore represents the length of the pulse re-
ceived on the external timer pin. As the TON, T0ON or T1ON bit has now been reset, any further
transitions on the external timer pin, will be ignored. Not until the TON, T0ON or T1ON bit is again
set high by the program can the timer begin further pulse width measurements. In this way, single
shot pulse measurements can be easily made. It should be noted that in this mode the counter is
controlled by logical transitions on the external timer pin and not by the logic level.
As in the case of the other two modes, when the counter is full, the timer will overflow and generate
an internal interrupt signal. The counter will also be reset to the value already loaded into the
preload register. If the external timer pin is pin-shared with other I/O pins, to ensure that the pin is
configured to operate as a pulse width measuring input pin, two things have to happen. The first is
to ensure that the TM1/TM0, T0M1/T0M0 or T1M1/T1M0 bits place the Timer/Event Counter in
the pulse width measuring mode, the second is to ensure that the port control register configures
the pin as an input. Note that the 28-pin package HT46R24/HT46C24 devices, although having
two internal timers, only one TMR1 external control pin is available. As a result TMR0 cannot be
used in the Pulse Width Measurement Mode.
40
A/D Type MCU
T i m e r + 2
T i m e r + 3
E x t e r n a l E v e n t
I n c r e m e n t
T i m e r C o u n t e r
T i m e r + 1
Event Counter Mode Timing Chart
Summary of Contents for HT46R22
Page 7: ...vi A D Type MCU...
Page 9: ...viii A D Type MCU...
Page 10: ...P a r t I Microcontroller Profile Part I Microcontroller Profile 1...
Page 11: ...2 A D Type MCU...
Page 90: ...P a r t I I Programming Language Part II Programming Language 81...
Page 91: ...82 A D Type MCU...
Page 97: ...88 A D Type MCU...
Page 128: ...P a r t I I I Development Tools Part III Development Tools 119...
Page 129: ...120 A D Type MCU...
Page 140: ...Appendix Appendix 131...
Page 141: ...132 A D Type MCU...
Page 151: ...142 A D Type MCU...
Page 152: ...A p p e n d i x B Package Information Appendix B Package Information 143 B...
Page 161: ...A D Type MCU...
Page 162: ...Amendments...