
XC161 Derivatives
Peripheral Units (Vol. 2 of 2)
The General Purpose Timer Units
User’s Manual
14-2
V2.2, 2004-01
GPT_X1, V2.0
14.1
Timer Block GPT1
From a programmer’s point of view, the GPT1 block is composed of a set of SFRs as
summarized below. Those portions of port and direction registers which are used for
alternate functions by the GPT1 block are shaded.
Figure 14-1
SFRs Associated with Timer Block GPT1
All three timers of block GPT1 (T2, T3, T4) can run in one of 4 basic modes: Timer Mode,
Gated Timer Mode, Counter Mode, or Incremental Interface Mode. All timers can count
up or down. Each timer of GPT1 is controlled by a separate control register TxCON.
Each timer has an input pin TxIN (alternate pin function) associated with it, which serves
as the gate control in gated timer mode, or as the count input in counter mode. The count
direction (up/down) may be programmed via software or may be dynamically altered by
a signal at the External Up/Down control input TxEUD (alternate pin function). An
overflow/underflow of core timer T3 is indicated by the Output Toggle Latch T3OTL,
whose state may be output on the associated pin T3OUT (alternate pin function). The
auxiliary timers T2 and T4 may additionally be concatenated with the core timer T3
(through T3OTL) or may be used as capture or reload registers for the core timer T3.
The current contents of each timer can be read or modified by the CPU by accessing the
corresponding timer count registers T2, T3, or T4, located in the non-bitaddressable SFR
space (see
). When any of the timer registers is written to by the CPU in
the state immediately preceding a timer increment, decrement, reload, or capture
operation, the CPU write operation has priority in order to guarantee correct results.
m c_ g p t0 1 0 0 _ re g iste rs.vsd
D a ta R e g is te rs
C o n tro l R eg isters
P o rt R e gisters
T2
T2C O N
T2IC
T3
T3C O N
T3IC
T4
T4C O N
T4IC
O D P3
D P3
P3
E
P5
P5D ID IS
A LTSEL0P3
E
In terru pt C o ntro l
SYSC O N 3
T x
G P T 1 T im er x R eg is ter
T xC O N
G P T 1 T im er x C on trol R e gister
T xIC
G P T 1 T im er x Inte rrup t C trl. R eg .
S Y S C O N 3
S yste m C trl. R eg . 3 (P e r. M gm t.)
O D P 3
P o rt 3 O p en D ra in C o ntro l R e g is te r
D P 3
P o rt 3 D irec tio n C on trol R e giste r
P 3
P o rt 3 D a ta R eg is te r
A L T S E L 0P 3 P o rt 3 A ltern ate O utpu t S ele ct R e g.
P 5
P o rt 5 D a ta R eg is te r
P 5 D ID IS
P o rt 5 D ig ital Inp ut D isa b le R e g.