ADuCM310 Hardware Reference Manual
UG-549
Rev. C | Page 173 of 192
Compare Field Registers
Hardware Updated Field
T4INC is a 12-bit interval register that updates the compare value in T4WUFAx by hardware. When a new value is written in T4INC,
Bits[16:5] of the internal 32-bit compare register (T4WUFAx) are loaded with the new T4INC value. If the new compare value is less than
the T4WUFD value in periodic mode or less than 0xFFFFFFFF in free running mode, this 32-bit compare register is automatically incremented
with the contents of T4INC (shifted by five) each time the wake-up counter reaches the value in this compare register. If the new compare
value is greater than these limits, it is recalculated as follows.
In free running mode, the new T4WUFA = old (32 × T4INC) − 0xFFFFFFFF.
In periodic mode, the new T4WUFA = old (32 × T4INC) − T4WUFD.
The maximum programmable interval is just above 4 seconds.
T4INC is compared with Bits[16:5] of the timer value. Because it is shifted left by 5 bits, the value must be multiplied by 32 to obtain the
compare value.
With the default value of 0xC8 (where for calculation purposes 0xC8 = 200 in decimal), prescaler = 1, and 32 kHz clock selected,
Interval
= ((200 × 32) + 1) × 1/32,768 = 195.3155 ms
To modify the interval value, the timer must be stopped so that the interval register can be loaded in the compare register if T4CON[11] = 0.
To modify the interval value, set STOPINC (T4CON[11] = 1) while the timer is running.
The new T4INC value takes effect after the next Wake-Up Field A interrupt. If the user is writing to this register while the timer is
enabled, set the STOPINC bit before writing to it, and then clear the STOPINC bit after the update.
Software Updated Field
T4WUFB, T4WUFC, and T4WUFD are 32-bit values programmed by the user in the T4WUFx0 and T4WUFx1 registers (x = B, C, or D).
T4WUFD contains the load value when the wake-up timer is configured in periodic mode.
The T4WUFBx and T4WUFCx registers can be written to at any time, but the corresponding interrupt enable (T4IEN[1] or T4IEN[2])
must be disabled. After the register is updated, the interrupt can be reenabled.
In periodic mode, the T4WUFDx registers can be written to only when the timer is disabled. In free running mode, the T4WUFDx
registers can be written to while the timer is running. Before doing so, the corresponding interrupt enable (T4IEN[3]) must be disabled.
After the register is updated, the interrupt can be reenabled.
In free running mode, T4WUFB, T4WUFC, and T4WUFD can be written to at any time; however, the corresponding interrupt enable in
the T4IEN register must be disabled. After the register is updated, the interrupt can be reenabled. In periodic mode, this is only applicable
to T4WUFB and T4WUFC.
T
IMER
V
AL
UE
FREE RUNNING: 0xFFFFFFFF
PERIODIC:T4WUFD = T4VAL
0x00000000
T4WUFB
T4INC
T4WUFA
T4WUFA
T4WUFA
T4WUFA
T4INC
T4WUFA
INTERUPTS
T4INC
T4WUFA
T4INC
T4INC
T4WUFC
(T4INC, T4WUFB,
T4WUFC AND T4WUFD
VALUES ARE SET BY USER)
T4WUFD
1
1461-
028
Figure 30. Wake-Up Timer Fields Action