
Rev. 1.40
74
March 29, 2019
Rev. 1.40
75
March 29, 2019
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
Pulse Width Modulator
The devices contain two channels of 8-bit PWM function respectively. Useful for such applications
such as motor speed control, the PWM function provides outputs with a fixed frequency but with a
duty cycle that can be varied by setting particular values into the corresponding PWM register.
PWM Operation
A single register, known as PWMn and located in the Data Memory is assigned to each Pulse Width
Modulator channel. It is here that the 8-bit value, which represents the overall duty cycle of one
modulation cycle of the output waveform, should be placed. To increase the PWM modulation
frequency, each modulation cycle is subdivided into two or four individual modulation subsections,
known as the 7+1 mode or 6+2 mode respectively. The required mode and the on/off control for
each PWM channel is selected using the BPCTL register. Note that when using the PWM, it is only
necessary to write the required value into the PWMn register and select the required mode setup and
on/off control using the BPCTL registers, the subdivision of the waveform into its sub-modulation
cycles is implemented automatically within the microcontroller hardware. The PWM clock source
is the system clock f
SYS
. This method of dividing the original modulation cycle into a further 2
or 4 sub-cycles enable the generation of higher PWM frequencies which allow a wider range of
applications to be served. The difference between what is known as the PWM cycle frequency and
the PWM modulation frequency should be understood. As the PWM clock is the system clock, f
SYS
,
and as the PWM value is 8-bits wide, the overall PWM cycle frequency is f
SYS
/256. However, when
in the 7+1 mode of operation the PWM modulation frequency will be f
SYS
/128, while the PWM
modulation frequency for the 6+2 mode of operation will be f
SYS
/64.
PWM Modulation
PWM Cycle Frequency
PWM Cycle Duty
f
SYS
/64 for (6+2) bits mode
f
SYS
/128for (7+1) bits mode
f
SYS
/256
[PWM]/256
BPCTL Register
Bit
7
6
5
4
3
2
1
0
Name
PMODE PWM1EN PWM0EN
BC1
BC0
BZ2
BZ1
BZ0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
POR
0
0
0
0
0
0
0
0
Bit 7
PMODE
: PWM type selection
0: 7+1
1: 6+2
Bit 6
PWM1EN
: PWM1 or the other pin-shared functions
0: the other pin-shared functions
1: PWM1
Bit 5
PWM0EN
: PWM0 or the other pin-shared functions
0: the other pin-shared functions
1: PWM0
Bit 4~0
Buzzer output and I/O configuration selection, described elsewhere