Chapter 13 Timer/Pulse-Width Modulator (S08TPMV3)
MC9S08LG32 MCU Series, Rev. 5
Freescale Semiconductor
319
When BDM is active, the coherency mechanism is frozen (unless reset by writing to TPMxCnSC register)
so the buffer latches remain in the state they were in when the BDM became active, even if one or both
halves of the channel register are read while BDM is active. This assures that if you were in the middle of
reading a 16-bit register when BDM became active, it reads the appropriate value from the other half of
the 16-bit value after returning to normal execution. The value read from the TPMxCnVH and
TPMxCnVL registers in BDM mode is the value of these registers and not the value of their read buffer.
In output compare or PWM modes, writing to either byte (TPMxCnVH or TPMxCnVL) latches the value
into a buffer. After both bytes were written, they are transferred as a coherent 16-bit value into the
timer-channel registers according to the value of CLKSB:CLKSA bits and the selected mode:
•
If CLKSB and CLKSA are cleared, the registers are updated when the second byte is written.
•
If CLKSB and CLKSA are not cleared and in output compare mode, the registers are updated after
the second byte is written and on the next change of the TPM counter (end of the prescaler
counting).
•
If CLKSB and CLKSA are not cleared and in EPWM or CPWM modes, the registers are updated
after both bytes were written, and the TPM counter changes from
(TPMxMODH:TPMxMODL – 1) to (TPMxMODH:TPMxMODL). If the TPM counter is a
free-running counter, the update is made when the TPM counter changes from 0xFFFE to 0xFFFF.
The latching mechanism is manually reset by writing to the TPMxCnSC register (whether BDM mode is
active or not). This latching mechanism allows coherent 16-bit writes in either big-endian or little-endian
order that is friendly to various compiler implementations.
When BDM is active, the coherency mechanism is frozen so the buffer latches remain in the state they
were in when the BDM became active even if one or both halves of the channel register are written while
BDM is active. Any write to the channel registers bypasses the buffer latches and directly write to the
channel register while BDM is active. The values written to the channel register while BDM is active are
used for PWM and output compare operation after normal execution resumes. Writes to the channel
registers while BDM is active do not interfere with partial completion of a coherency sequence. After the
coherency mechanism is fully exercised, the channel registers are updated using the buffered values (while
BDM was not active).
16.4
Functional Description
All TPM functions are associated with a central 16-bit counter that allows flexible selection of the clock
and prescale factor. There is also a 16-bit modulo register associated with this counter.
The CPWMS control bit chooses between center-aligned PWM operation for all channels in the TPM
(CPWMS=1) or general purpose timing functions (CPWMS=0) where each channel can independently be
configured to operate in input capture, output compare, or edge-aligned PWM mode. The CPWMS control
bit is located in the TPM status and control register because it affects all channels within the TPM and
influences the way the main counter operates. (In CPWM mode, the counter changes to an up/down mode
rather than the up-counting mode used for general purpose timer functions.)
The following sections describe TPM counter and each of the timer operating modes (input capture, output
compare, edge-aligned PWM, and center-aligned PWM). Because details of pin operation and interrupt
Содержание MC9S08LG16
Страница 2: ......
Страница 4: ......
Страница 8: ......
Страница 20: ......
Страница 26: ...Chapter 1 Device Overview MC9S08LG32 MCU Series Rev 5 26 Freescale Semiconductor...
Страница 40: ...Chapter 2 Pins and Connections MC9S08LG32 MCU Series Rev 5 40 Freescale Semiconductor...
Страница 96: ...Chapter 5 Resets Interrupts and General System Control MC9S08LG32 MCU Series Rev 5 96 Freescale Semiconductor...
Страница 296: ...Chapter 12 Serial Peripheral Interface S08SPIV4 MC9S08LG32 MCU Series Rev 5 296 Freescale Semiconductor...
Страница 372: ......