03.01.2015 Views

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

80C186EC/80C188EC Microprocessor User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 9<br />

TIMER/COUNTER UNIT<br />

The Timer/Counter Unit can be used in many applications. Some of these applications include a<br />

real-time clock, a square-wave generator and a digital one-shot. All of these can be implemented<br />

in a system design. A real-time clock can be used to update time-dependent memory variables. A<br />

square-wave generator can be used to provide a system clock tick for peripheral devices. (See<br />

“Timer/Counter Unit Application Examples” on page 9-17 for code examples that configure the<br />

Timer/Counter Unit for these applications.)<br />

9.1 FUNCTIONAL OVERVIEW<br />

The Timer/Counter Unit is composed of three independent 16-bit timers (see Figure 9-1). The operation<br />

of these timers is independent of the CPU. The internal Timer/Counter Unit can be modeled<br />

as a single counter element, time-multiplexed to three register banks. The register banks are<br />

dual-ported between the counter element and the CPU. During a given bus cycle, the counter element<br />

and CPU can both access the register banks; these accesses are synchronized.<br />

The Timer/Counter Unit is serviced over four clock periods, one timer during each clock, with an<br />

idle clock at the end (see Figure 9-2). No connection exists between the counter element’s sequencing<br />

through timer register banks and the Bus Interface Unit’s sequencing through T-states.<br />

Timer operation and bus interface operation are asynchronous. This time-multiplexed scheme results<br />

in a delay of 2½ to 6½ CLKOUT periods from timer input to timer output.<br />

Each timer keeps its own running count and has a user-defined maximum count value. Timers 0<br />

and 1 can use one maximum count value (single maximum count mode) or two alternating maximum<br />

count values (dual maximum count mode). Timer 2 can use only one maximum count value.<br />

The control register for each timer determines the counting mode to be used. When a timer is<br />

serviced, its present count value is incremented and compared to the maximum count for that timer.<br />

If these two values match, the count value resets to zero. The timers can be configured either<br />

to stop after a single cycle or to run continuously.<br />

Timers 0 and 1 are functionally identical. Figure 9-3 illustrates their operation. Each has a<br />

latched, synchronized input pin and a single output pin. Each timer can be clocked internally or<br />

externally. Internally, the timer can either increment at ¼ CLKOUT frequency or be prescaled by<br />

Timer 2. A timer that is prescaled by Timer 2 increments when Timer 2 reaches its maximum<br />

count value.<br />

9-1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!