Download C167 Derivatives

Transcript
The Pulse Width Modulation Module / C167
Period Registers PPx
The 16-bit period register PPx of a PWM channel determines the period of a PWM cycle, ie. the
frequency of the PWM signal. This register is buffered with a shadow register. The shadow register
is loaded from the respective PPx register at the beginning of every new PWM cycle, or upon a write
access to PPx, while the timer is stopped. The CPU accesses the PPx register while the hardware
compares the contents of the shadow register with the contents of the associated counter PTx.
When a match is found between counter and PPx shadow register, the counter is either reset to
0000H, or the count direction is switched from counting up to counting down, depending on the
selected operating mode of that PWM channel.
Note: For the register locations please refer to the table below.
Pulse Width Registers PWx
This 16-bit register holds the actual PWM pulse width value which corresponds to the duty cycle of
the PWM signal. This register is buffered with a shadow register. The CPU accesses the PWx
register while the hardware compares the contents of the shadow register with the contents of the
associated counter PTx. The shadow register is loaded from the respective PWx register at the
beginning of every new PWM cycle, or upon a write access to PWx, while the timer is stopped.
When the counter value is greater than or equal to the shadow register value, the PWM signal is set,
otherwise it is reset. The output of the comparators may be described by the boolean formula:
PWM output signal = [PTx] ≥ [PWx shadow latch].
This type of comparison allows a flexible control of the PWM signal.
Note: For the register locations please refer to the table below.
PWM Module Channel Specific Register Addresses
Register
Address
Reg. Space
Register
Address
Reg. Space
PW0
FE30H / 18H
SFR
PT0
F030H / 18H
ESFR
PW1
FE32H / 19H
SFR
PT1
F032H / 19H
ESFR
PW2
FE34H / 1AH
SFR
PT2
F034H / 1AH
ESFR
PW3
FE36H / 1BH
SFR
PT3
F036H / 1BH
ESFR
PP0
F038H / 1CH
ESFR
PP1
F03AH / 1DH ESFR
PP2
F03CH / 1EH ESFR
Note: These registers are not bit-addressable. PP3
Semiconductor Group
15-8
F03EH / 1FH
ESFR