|
MC68HC05B4 Datasheet, PDF (64/298 Pages) Motorola, Inc – High-density Complementary Metal Oxide Semiconductor (HCMOS) Microcomputer Unit | |||
|
◁ |
5.2.2 Timer status register (TSR)
The timer status register ($13) is a read only register and contains the status bits corresponding
to the four timer interrupt conditions â ICF1,OCF1, TOF, ICF2 and OCF2.
Accessing the timer status register satisï¬es the ï¬rst condition required to clear the status bits. The
remaining step is to access the register corresponding to the status bit.
Timer status (TSR)
Address bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
State
on reset
$0013 ICF1 OCF1 TOF ICF2 OCF2
Undeï¬ned
5
ICF1 â Input capture ï¬ag 1
This bit is set when the selected polarity of edge is detected by the input capture edge detector 1
at TCAP1; an input capture interrupt will be generated, if ICIE is set. ICF1 is cleared by reading
the TSR and then the input capture low register 1 ($15).
1 (set) â A valid input capture has occurred.
0 (clear) â No input capture has occurred.
OCF1 â Output compare ï¬ag 1
This bit is set when the output compare 1 register contents match those of the free-running
counter; an output compare interrupt will be generated if OCIE is set. OCF1 is cleared by reading
the TSR and then reading or writing the output compare 1 low register ($17).
1 (set) â A valid output compare has occurred.
0 (clear) â No output compare has occurred.
TOF â Timer overï¬ow status ï¬ag
This bit is set when the free-running counter overï¬ows from $FFFF to $0000; a timer overï¬ow interrupt
will occur if TOIE is set. TOF is cleared by reading the TSR and the counter low register ($19).
1 (set) â Timer overï¬ow has occurred.
0 (clear) â No timer overï¬ow has occurred.
When using the timer overï¬ow function and reading the free-running counter at random times to
measure an elapsed time, a problem may occur whereby the timer overï¬ow ï¬ag is unintentionally
cleared if:
1 The timer status register is read or written when TOF is set, and
1) The LSB of the free-running counter is read, but not for the purpose of
servicing the ï¬ag.
Reading the alternate counter register instead of the counter register will avoid this potential
problem.
MOTOROLA
5-6
PROGRAMMABLE TIMER
TPG
MC68HC05B6
Rev. 4
|
▷ |