11 16-BIT TIMERS (T16)
11-8
EPSON
S1C17704 TECHNICAL MANUAL
11.6 16-bit Timer Run/Stop Control
Before starting the 16-bit timer, set up the conditions as shown below.
(1) Select an operating mode (internal clock, external clock, pulse width measurement). See Section 11.2.
(2) In internal clock mode or pulse width measurement mode, select the count clock (prescaler output clock). See
Section 11.2.1.
(3) Select a count mode (one-shot or repeat). See Section 11.3.
(4) Calculate the counter initial value and set it to the reload data register. See Section 11.4.
(5) Reset the timer to preset the initial value to the counter. See Section 11.5.
(6) Set up the interrupt level and enable the interrupt of the timer channel if the timer interrupt is used. See Section
11.8.
To start the 16-bit timer, write 1 to the PRUN bit (D0/T16_CTL
x
register).
∗
PRUN
: Timer Run/Stop Control Bit in the 16-bit Timer Ch.
x
Control (T16_CTL
x
) Register (D0/0x4226/0x4246/0x4266)
The timer starts counting down from the initial value or the current counter value if the initial value has not been
preset. When the counter underflows, the timer outputs an underflow pulse and presets the initial value again. At the
same time, an interrupt request is sent to the interrupt controller (ITC).
If the timer is set in one-shot mode, the timer stops counting.
If the timer is set in repeat mode, the timer continues counting from the reloaded initial value.
To stop the 16-bit timer from the application program, write 0 to the PRUN bit. The counter stops counting and
holds the current counter value until the timer is reset or restarted. To restart counting from the initial value, reset
the timer before writing 1 to the PRUN bit.
Count clock
PRESER write
PRUN
Counter
Interrupt request
0
1
n-1
n
n
Count clock
PRESER write
PRUN
Counter
Interrupt request
0
1
n-1
n
n
0
1
n-1
n
n-1
One-shot mode
Repeat mode
Reset by hardware
Set by software
Set by software
Reset by software
Figure 11.6.1 Count Operation
In pulse width measurement mode, the timer performs counting only when PRUN = 1 and the external input signal
is the specified active level. When the external input signal goes inactive, the 16-bit timer stops counting and
maintains the count value until the next active pulse is input. (See Figure 11.2.3.1.)
Содержание S1C17704
Страница 1: ...TECHNICAL MANUAL S1C17704 CMOS 16 BIT SINGLE CHIP MICROCOMPUTER ...
Страница 22: ...1 OVERVIEW 1 10 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 42: ...3 MEMORY MAP BUS CONTROL 3 12 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 82: ...6 INTERRUPT CONTROLLER ITC 6 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 108: ...8 CLOCK GENERATOR CLG 8 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 112: ...9 PRESCALER PSC 9 4 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 138: ...10 I O PORTS P 10 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 156: ...11 16 BIT TIMERS T16 11 18 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 208: ...14 8 BIT OSC1 TIMER T8OSC1 14 16 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 234: ...16 STOPWATCH TIMER SWT 16 14 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 242: ...17 WATCHDOG TIMER WDT 17 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 264: ...18 UART 18 22 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 300: ...20 I2C 20 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 320: ...21 REMOTE CONTROLLER REMC 21 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 360: ...24 ON CHIP DEBUGGER DBG 24 6 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Страница 362: ...25 BASIC EXTERNAL WIRING DIAGRAM 25 2 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...