12
TIMER/COUNTERS
TIMER 0 AND TIMER 1
These timers are each 16 bits and can be programmed individually to be in counter or timer
mode, in addition to 4 different modes of operation. Note when using mode 0 that INT1 is used
by the keypad circuit and will have a high normally applied to it, and a low when a key is
pressed.
When using counter mode for TIMER 0 the signal is input through P3.4/T0, or for TIMER 1,
through P3.5/T1. These pins as well as P1.5/T2EX, P1.7/T2, CCO, CC1, CC2 and CC3 must
be configured as inputs by writing 1 to them if their default settings have been changed.
TIMER 2
This 16 bit timer is also referred to as PTRA Unit (Programmable Timer/Counter Register Array)
which can be used as a timer, event counter, or gated timer. In each configuration an interrupt
may be generated on counter overflow. The counter input signal (or, in gated timer mode, the
timer gate) comes from P1.7/T2.
Once the timer or counter function has been enabled, 3 other modes of operation may be
selected: reload, compare, and capture.
By default, when TH2 and TL2 are incremented above FFFFh, they roll over to 0000. In reload
mode 1, TH2 and TL2 are loaded with the values stored in CRCH and CRCL respectively, on a
falling edge of P1.5/T2EX. In reload mode 0, these values are loaded when the timer rolls over.
Compare mode is used to provide 4 PWM (pulse width modulated) output signals with 16 bits of
resolution from the CC0, CC1, CC2 and CC3 lines.
DIGITAL I/O
HDR3
50 49
GND
o o
VCC
GND
o o
PX0 P4.0
GND
o o
PX1 P4.1
GND
o o
PX2 P4.2
GND
o o
PX3 P4.3
GND
o o
PX4 P4.4
GND
o o
PX5 P4.5
GND
o o
PX6 P4.6
GND
o o
PX7 P4.7
GND
o o
PX8 P1.O/INT3*/CC0
GND
o o
PX9 P1.1/INT4/CC1
GND
o o
PX10 P1.2/INT5/CC2
GND
o o
PX11 P1.3/INT6/CC3
GND
o o
PX12 P1.4/INT2*
GND
o o
PX13 P1.5/T2EX
GND
o o
PX14 P1.6/CLKOUT
GND
o o
PX15 P1.7/T2
GND
o o
PX16 P3.4/TO
GND
o o
PX17 P3.5/T1
GND
o o
PX18 OP2
GND
o o
PX19 IP2
GND
o o
PX20 OP3
GND
o o
PX21 IP3
GND
o o
PX22 OP4
GND
o o
PX23 IP6
2 1
Capture mode 0 can be used to decode 4 PWM signals with 16 bits of resolution again, using the CC0, CC1, CC2 and CC3 lines as
capture input signals (remember, P1.0-1.3 must be configured as inputs). Capture mode 1 can be used to read timer 2 while it is running
to eliminate the problem of a wrong reading caused by a rollover occurring between the time of reading the lower and upper byte of the
timer.
For details on programming, see section 3.2 and 3.3 of the SAB 80515/80535 Single-Chip Microcontroller User's Manual included in the
appendices.
C/T
The designation C/T is used in the SC26C92 data sheets, to refer to the Counter/Timer. This C/T counts down instead of up as with the
other timer/counters. The minimum count that can be loaded into the C/T is 0002h. The terms counter (which commonly refers to a device
that produces an output based on the number of external signals received) and timer (which refers to a device with a programmable output
based on a constant clock source) are used differently in the data sheets. What they refer to as timer mode shares features of a counter,
and vice-versa. For example, there are 2 timer modes which use an external input (IP2) to clock the timer. Though this may be confusing,
we will follow their definitions.
In timer mode, a square wave output will be produced which has a period of 2 * (value loaded into C/T registers) * (period of clock source).
This output will set the Counter Ready interrupt flag (ISR[3]) each period (this flag is reset by the STOPCNT command, without stopping
the timer), and if OPCR[3]=0 and OPCR[2]=1 the square wave will be output on OP3.
In counter mode the C/T is enabled to decrement the value loaded into it after the STRTCNT command, and upon reaching 0000 the
Counter Ready interrupt flag (ISR[3]) is set and the counter will continue to decrement until a STOPCNT command, which also clears the
interrupt flag. If OP3 is programmed to be a C/T output, it will remain high until it reaches the terminal count and goes low. The output
goes high again after a STOPCNT command (see the SC26C92 data sheets for more details).
Содержание MicroPac 535
Страница 22: ...APPENDIX D MicroPac 535 Schematics...
Страница 23: ......
Страница 24: ......
Страница 25: ......
Страница 26: ......