Interval Timers (Timer A, Timer B)

Each interval timer consists of a 16-bit read-only Timer Counter and a 16-bit write-only Timer Latch. Data written to the timer are latched in the Timer Latch, while data read from the timer are the present contents of the Time Counter. The timers can be used independently or linked for extended operations. The various timer modes allow generation of long time delays, variable width pulses, pulse trains and variable frequency waveforms. Utilizing the CNT input, the timers can count external pulses or measure frequency, pulse width and delay times of external signals. Each timer has an associated control register, providing independent control of the following functions:

Start/Stop

A control bit allows the timer to be started or stopped by the microprocessor at any time.

PB On/Off:

A control bit allows the timer output to appear on a PORT B output line (PB6 for TIMER A and PB7 for TIMER B). This function overrides the DDRB control bit and forces the appropriate PB line to an output.

Toggle/Pulse

A control bit selects the output applied to PORT B. On every timer underflow the output can either toggle or generate a single positive pulse of one cycle duration. The Toggle output is set high whenever the timer is started and is set low by .

One-Shot/Continuous

A control bit selects either timer mode. In one-shot mode, the timer will count down from the latched value to zero, generate an interrupt, reload the latched value, then stop. In continuous mode, the timer will count from the latched value to zero, generate an interrupt, reload the latched value and repeat the procedure continuously.

Force Load

A strobe bit allows the timer latch to be loaded into the timer counter at any time, whether the timer is running or not.

Input Mode:

Control bits allow selection of the clock used to decrement the timer. TIMER A can count clock pulses or external pulses applied to the CNT pin. TIMER B can count pulses, external CNT pulses, TIMER A underflow pulses or TIMER A underflow pulses while the CNT pin is held high.

The timer latch is loaded into the timer on any timer underflow, on a force load or following a write to the high byte of the prescaler while the timer is stopped. If the timer is running, a write to the high byte will load the timer latch, but not reload the counter.


READ (TIMER)

REG
NAME
 
4
TA LO
TAL7
TAL6
TAL5
TAL4
TAL3
TAL2
TAL1
TAL0
5
TA HI
TAH7
TAH6
TAH5
TAH4
TAH3
TAH2
TAH1
TAH0
6
TB LO
TBL7
TBL6
TBL5
TBL4
TBL3
TBL2
TBL1
TBL0
7
TB HI
TBH7
TBH6
TBH5
TBH4
TBH3
TBH2
TBH1
TBH0

WRITE (PRESCALER)

REG
NAME
 
4
TA LO
PAL7
PAL6
PAL5
PAL4
PAL3
PAL2
PAL1
PAL0
5
TA HI
PAH7
PAH6
PAH5
PAH4
PAH3
PAH2
PAH1
PAH0
6
TB LO
PBL7
PBL6
PBL5
PBL4
PBL3
PBL2
PBL1
PBL0
7
TB HI
PBH7
PBH6
PBH5
PBH4
PBH3
PBH2
PBH1
PBH0