1 a simple waveform output -27 – Maxim Integrated MAXQ7666 User Manual
Page 262

7.5 Type 2 Timer/Counter Compare Application Example
The following example is used to demonstrate the Type 2 timer compare function.
7.5.1 A Simple Waveform Output
To output a simple waveform on the T0 pin whose frequency and duty cycle can be configured with an appropriate initial starting value
for T2R0 and T2C0 registers.
; --------- Reset State: T2R0 = T2V0 = T2C0 = 0000h ------------------------
MOVE T2V0, #4000h
; Set to reload value to keep first pulse from being extra long
MOVE T2R0, #4000h
; Reload value
MOVE T2C0, #C000h
; T0 output high for (C000h – 4000h) T2CLKS
MOVE T2CFG0, #01110000b
;
; T2DIV[2:0] = 111 (/128)
; T2MD = 0 (16-bit)
; CCF[1:0] = 00 (compare mode)
; C/T2 = 0 (timer/compare)
MOVE T2CNA0, #11101000b
; ET2 = 1 (enable Timer ints)
; T2OE0 = 1 (pin enabled as output)
; T2POL0 = 0 (high start value on pin)
; TR2L:TR2 = 01 (start timer)
; CPRL2 = 0 (no capture possible)
; SS2 = 0 (not single shot mode)
; G2EN = 0 (gating disbled)
; -------- TCC2 Interrupt: Compare match; high duration reached
; --------- TF2 Interrupt: Overflow/Reload; low duration reached
MAXQ7665/MAXQ7666 User’s Guide
7-27
T0 PIN
1A
1B
2A
2B
EVENTS:
1A AND 2A: COMPARE MATCH T2V0 = T2C0 IS TRUE; T0 OUTPUT GOES LOW.
2A AND 2B: OVERFLOW AND RELOAD; T2V0 = FFFFH; T2V0 RELOADED WITH T2R0 VALUE; T0 OUTPUT GOES HIGH.
Figure 7-11. Type 2 Timer Compare Application Example—A Simple Waveform Output
Maxim Integrated