20D ec96 @09 :2 5h In ter med iate Version
21 Semiconductor Gr oup
C167CR-16RM
P WM Module
The Pulse Width Modulation Module can generate up to four PWM output signals using edge-
aligned or center-aligned PWM. In addition th e PWM mod ule can generate PWM b urst signals and
single shot outputs. The frequency range of the PWM signals covers 4.8 H z to 1 MH z (referred t o
a CPU cl ock of 20 MHz), depending on the resoluti on of the PWM output signal. The l evel of the
output signals is selectable and the PWM module can generate inter rupt req uests.
General Purpose T imer (GPT ) U nit
The GPT unit repr esents a very flexible mul tifunctional timer/counter str ucture whi ch may be us ed
for many different time related tasks such as event timing and counting, pulse width and duty cycle
measur ements, pulse generation, or pulse multiplicatio n.
The GPT unit incorporates five 1 6- bit timers w hich are or ganized in two s epar ate modules, GPT 1
and GPT2. Each timer in each module may operate independently in a number of d ifferent modes,
or may be concatenated with another timer of the same module.
Each of the three timers T2, T3, T4 of module GPT1 can be configured individually for one of four
basic modes of operation, which are Timer, Gated Timer, Counter, and Incremental Interface Mode.
In Timer Mode, the input clock for a timer is derived from the CPU clock, divided by a programmable
prescaler, whi le Counter Mode allows a timer to be clocked in reference to external events.
Pulse width or duty cyc le measurement is supported in Gated T imer Mode, where the operation of
a timer is controlled by the ‘gate’ level on an external input pin. For these pu rposes, each ti mer has
one associated port pin (TxIN) which serves as gate or clock input. The maximum resolution of the
timers in module GPT1 is 400 ns (@ 20-MHz CPU clock).
The count direction (u p/dow n) for each timer is program mable by software or may additionall y be
altered dynamically by an external signal on a port pin (TxEUD) to facilitate eg. position tracking.
In Incremental Interface Mode the GPT1 timers (T2, T3, T4) can be directly connected to the
incremental posi tion sensor signals A and B via their respective inputs TxIN and TxEUD. Directi on
and count signals are internally derived from these two input signals, so the contents of the
respective timer Tx corresponds to the sensor position. The thir d position sensor signal TOP0 can
be connected to an interrupt input.
Timers T3 and T4 have output togg le latches (TxOTL) which change their state on each ti mer ove r-
flow/underflow. The state of these latches may be output on port pins (TxOUT) eg. for time out
monitor ing of external hardw are components, or m ay be used internall y to clock timers T2 and T 4
for measuring l ong time periods w ith high resoluti on.
In addition to t heir basic operating modes, timers T2 and T4 may be configured as reload or capture
registers for timer T3. When used as capture or reload registers, timers T2 and T4 are stoppe d. The
contents of tim er T3 is captured into T2 or T 4 in r esponse to a signal at t heir associ ated input pins
(TxIN ) . Tim er T3 is rel o aded with the contents of T2 or T4 tr iggered either by an external signal or
by a selec tabl e state transitio n of its toggle latc h T 3OTL. When both T2 and T4 are configured to
alternately reload T3 on opposite state transitions of T3OTL with the low and high tim es of a PWM
signal, this s ignal can be constantly generated without softw are intervention.
With its maximum resolution of 200 ns (@ 20 MHz), the GPT2 module provides precise event
control and time measurement. It includes two timers (T5, T6) and a capture/reload register