beautypg.com

5 overflow/interrupt on, 5 overflow/interrupt on cumulative time -14, Maxq family user’s guide – Maxim Integrated MAXQ Family User Manual

Page 92: 5 overflow/interrupt on cumulative time

background image

9-14

MAXQ Family User’s Guide

9.3.5 Overflow/Interrupt on Cumulative Time

To cause an overflow only when the T2P pin has been low for some cumulative duration, Timer 2 could be configured to the gated com-

pare mode of operation with an initial starting value appropriate for the cumulative duration to be detected.

; ------------------ Reset State: T2R = T2V = T2C = 0000h ------------------------

MOVE T2V, #1234h

; Overflow after T2P input low for (10000h-01234h) T2CLKs

MOVE T2CFG, #01110000b

; T2CI

=0

(sysclk/N input)

; T2DIV[2:0]

=111

(/128)

; T2MD

=0 (16-bit)

; CCF[1:0]

=00 (no

edges)

; C/T2

=0 (timer/compare)

MOVE T2CNA, #10101001b

; ET2

=1

(enable Timer 2 ints)

; T2OE[0]

=0

(input)

; T2POL[0]

=1

(gating level = ‘1’)

; TR2L:TR2

=01

(start timer 2)

; CPRL2

=0

(no capture possible)

; SS2

=0

(not single-shot mode)

; G2EN

=1

(gating enabled)

; ------------------ TF2 Interrupt : Cumulative low duration reached

T2P 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 9-8. Timer 2 Application Example—Overflow/Interrupt on Cumulative Time

Maxim Integrated