Enhanced Modular Input/Output Subsystem (eMIOS200)
Freescale Semiconductor
23-39
PXR40 Microcontroller Reference Manual, Rev. 1
Figure 23-33. MC Up/Down Mode Example
23.4.1.1.12
Modulus Counter Buffered (MCB) Mode
The MCB mode provides a time base that can be shared with other channels through the internal counter
buses. Register A1 is double-buffered, thus allowing smooth transitions between cycles when changing
the A2 register value on the fly. Register A1 is updated at the cycle boundary, which is defined as when
the internal counter reaches the value 0x00_0001.
The internal counter values operate within a range from 0x00_0001 up to the value of register A1 in MCB
mode. When entering MCB mode (coming out of GPIO mode), the internal counter value must be within
that range. Otherwise, the first A match will not occur, causing the channel internal counter to wrap at the
maximum counter value of 0xFF_FFFF. After the counter wrap occurs, it returns to 0x00_0001 and
resumes normal MCB mode operation. To avoid this counter wrap condition, make sure the internal
counter value is within the 0x00_0001 to A1 register value range when entering the MCB mode.
MODE[6] bit selects the internal clock source if set to 0, or external if set to 1. When the external clock is
selected, the input channel pin is used as the channel clock source. The active edge of this clock is defined
by the EDPOL and EDSEL bits in the EMIOS_CCR[
n
] channel register.
When entering MCB mode, if the up counter is selected by MODE[4] = 0, the internal counter starts
counting up from its current value until the A1 match occurs. On the next system clock cycle after the A1
match, the internal counter is set to 0x00_0001 and the FLAG bit is set to '1'.
If the up/down counter is selected by setting MODE[4] = 1, the counter changes direction at the A1 match
and counts down until it reaches 0x00_0001. After it reaches 0x00_0001, it counts up again. Register B1
is set to 0x00_0001 on entering MCB mode cannot be changed while this mode is selected. B1 is used to
generate a match to set the internal counter in up-count direction if up/down mode is selected.
The MCB mode counts between 0x00_0001 and the value in the A1 register. Only values greater than
0x00_0001 are allowed to be written to the A1 register. Loading values other than those leads to
unpredictable results. The counter cycle period is equal to A1 value in up counter mode. If in up/down
counter mode the period is defined by the expression: (2 × A1) – 2.
shows the counter cycle for several A1 values. Register A1 is loaded with the value in A2 at
the cycle boundary. Any value written to the A2 register within cycle (
n
) is updated to A1 at the next cycle
0xFFFFFF
0x000303
0x000000
EMIOS_CCNTR[n]
Time
A1 Value
1
0x000303
0x000303
0x000200
0x000200
0xxxxxxx
Notes: 1. EMIOS_CADR[n] = A1
0x000200
0x000200
FLAG Pin/Register
A2 = A1 according to OU[n] bit
MODE[4] = 1
Write
to A2
A1 Match
Write
to A2
B1 Match
(= 0)
B1 Match
(= 0)
A1 Match
Summary of Contents for PXR4030
Page 1: ...PXR40 Microcontroller Reference Manual Devices Supported PXR4030 PXR4040 PXR40RM Rev 1 06 2011...
Page 30: ...PXR40 Microcontroller Reference Manual Rev 1 Freescale Semiconductor xxx...
Page 40: ...PXR40 Microcontroller Reference Manual Rev 1 xl Freescale Semiconductor...
Page 66: ...Memory Map PXR40 Microcontroller Reference Manual Rev 1 2 4 Freescale Semiconductor...
Page 120: ...Signal Descriptions 3 54 Freescale Semiconductor PXR40 Microcontroller Reference Manual Rev 1...
Page 860: ...FlexCAN Module 24 50 Freescale Semiconductor PXR40 Microcontroller Reference Manual Rev 1...
Page 1167: ...Decimation Filter Freescale Semiconductor 28 53 PXR40 Microcontroller Reference Manual Rev 1...
Page 1168: ...Decimation Filter 28 54 Freescale Semiconductor PXR40 Microcontroller Reference Manual Rev 1...