![Texas Instruments AM1808 Скачать руководство пользователя страница 1472](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581472.webp)
Introduction
1472
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
64-Bit Timer Plus
30.1.5.4.1.1 Enabling the 64-Bit Timer
The TIM12RS and TIM34RS bits in TGCR control whether the timer is in reset or capable of operating.
For the timer to operate in 64-bit timer mode, the TIM12RS and TIM34RS bits must be set to 1.
The ENAMODE12 bit in the timer control register (TCR) controls whether the timer is disabled, enabled to
run once, enabled to run continuously, or enabled to run continuously with period reload; the
ENAMODE34 bit has no effect in 64-bit timer mode. When the timer is disabled (ENAMODE12 = 0), the
timer does not run and maintains its current count value. When the timer is enabled for one time operation
(ENAMODE12 = 1), it counts up until the counter value equals the period value and then stops. When the
timer is enabled for continuous operation (ENAMODE12 = 2h), the counter counts up until it reaches the
period value, then resets itself to zero and begins counting again. When the timer is enabled for
continuous operation with period reload (ENAMODE12 = 3h), the counter counts up until it reaches the
period value, then resets itself to zero, reloads the period registers (PRD12 and PRD34) with the value in
the period reload registers (REL12 and REL34), and begins counting again.
shows the bit values in TGCR to configure the 64-bit timer.
Table 30-2. 64-Bit Timer Configurations
64-Bit Timer Configuration
TGCR Bit
TCR Bit
TIM12RS
TIM34RS
ENAMODE12
To place the 64-bit timer in reset
0
0
0
To disable the 64-bit timer (out of reset)
1h
1h
0
To enable the 64-bit timer for one-time operation
1h
1h
1h
To enable the 64-bit timer for continuous operation
1h
1h
2h
To enable the 64-bit timer for continuous operation with period reload
1h
1h
3h
Once the timer stops, if an external clock is used as the timer clock, the timer must remain disabled for at
least one external clock period or the timer will not start counting again. When using the external clock,
the count value is synchronized to the internal clock.
Note that when both the timer counter and timer period are cleared to 0, the timer can be enabled but the
timer counter does not increment because the timer period is 0.
30.1.5.4.1.2 Reading the Counter Registers
When reading the timer count in 64-bit timer mode, the CPU must first read TIM12 followed by TIM34.
When TIM12 is read, the timer copies TIM34 into a shadow register. When reading TIM34, the hardware
logic returns the shadow register value. This ensures that the values read from the registers are not
affected by the fact that the timer may continue to run as the registers are read. When reading the timers
in 32-bit mode, TIM12 and TIM34 may be read in any order.
30.1.5.4.1.3 64-Bit Timer Configuration Procedure
To configure the GP timer to operate as a 64-bit timer, follow the steps below:
1. Select 64-bit mode (TIMMODE in TGCR).
2. Remove the timer from reset (TIM12RS and TIM34RS in TGCR).
3. Select the desired timer period (PRD12 and PRD34). Program with the desired timer period value - 1.
4. Enable the timer (ENAMODE12 in TCR).
5. If ENAMODE12 = 3h, write the desired timer period for the next timer cycle in the period reload
registers (REL12 and REL34). Program with the desired timer period value - 1. This step can be done
at any time before the current timer cycle ends.