5 overflow/interrupt o, 5 overflow/interrupt on cumulative time -31, Maxq7667 user’s guide – Maxim Integrated MAXQ7667 User Manual
Page 125
6-31
__________________________________________________________________________________________________________
MAXQ7667 User’s Guide
6.7.9.5 Overflow/Interrupt on Cumulative Time
To cause an overflow only when the T2P0 pin has been low for some cumulative duration, the Type 2 timer can be configured to the
gated compare mode of operation with an initial starting value appropriate for the cumulative duration to be detected.
; ------------------ Reset State: T2R0 = T2V0 = T2C0 = 0000h ------------------------
MOVE T2V0, #1234h
; Overflow after T2P0 input low for (10000h-01234h) CLKs
MOVE T2CFG0, #01110000b
; T2CI
=0
(sysclk/N input)
; T2DIV2:0
=111
(/128)
; T2MD
=0 (16-bit)
; CCF1:0
=00 (no
edges)
; C/T2
=0 (timer/compare)
MOVE T2CNA0, #10101001b
; ET2
=1
(enable Type 2 Timer ints)
; T2OE0
=0
(input)
; T2POL0
=1
(gating level = ‘1’)
; TR2L:TR2
=01
(start timer)
; CPRL2
=0
(no capture possible)
; SS2
=0
(not single shot mode)
; G2EN
=1
(gating enabled)
; ------------------ TF2 Interrupt : Cumulative low duration reached
T2P0 PIN
CODE EXECUTION:
POINT A
CODE EXECUTION:
POINT B
1A
1B
2A
2B
EVENTS:
1A: GATING CONDITION IS REMOVED; TIMER BEGINS TO RUN.
2A: TIMER 2 OVERFLOWS.
1B–2B: SAME SEQUENCE AS 1A–2A, EXCEPT THAT TIMER 2 STARTS RUNNING IMMEDIATELY SINCE IT IS NOT GATED.
Figure 6-12. Type 2 Timer Application Example—Overflow/Interrupt on Cumulative Time