Rev. 1.00
58
August 29, 2018
Rev. 1.00
59
August 29, 2018
HT45F6530
AC Voltage Regulator Flash MCU
HT45F6530
AC Voltage Regulator Flash MCU
Programming Considerations
Within the user program, one of the first things to consider is port initialisation. After a reset, all
of the I/O data and port control registers will be set high. This means that all I/O pins will default
to an input state, the level of which depends on the other connected circuitry and whether pull-
high selections have been chosen. If the port control registers are then programmed to setup some
pins as outputs, these output pins will have an initial high output value unless the associated port
data registers are first programmed. Selecting which pins are inputs and which are outputs can be
achieved byte-wide by loading the correct values into the appropriate port control register or by
programming individual bits in the port control register using the “SET [m].i” and “CLR [m].i”
instructions. Note that when using these bit control instructions, a read-modify-write operation takes
place. The microcontroller must first read in the data on the entire port, modify it to the required new
bit values and then rewrite this data back to the output ports.
Port A has the additional capability of providing wake-up function. When the device is in the SLEEP
or IDLE Mode, various methods are available to wake the device up. One of these is a high to
low transition of any of the Port A pins. Single or multiple pins on Port A can be setup to have this
function.
Timer Module – TM
One of the most fundamental functions in any microcontroller device is the ability to control and
measure time. To implement time related functions the device includes several Timer Modules,
abbreviated to the name TM. The TMs are multi-purpose timing units and serve to provide
operations such as Timer/Counter, Compare Match Output as well as being the functional unit for
the generation of PWM signals. Each of the TMs has two individual interrupts. The addition of
input and output pins for each TM ensures that users are provided with timing units with a wide and
flexible range of features.
The general features of the Compact type TM are described here with more detailed information
provided in the individual Compact type TM section.
Introduction
The device contains two Compact type TM. The main features of the CTM are summarised in the
accompanying table.
Function
CTM
Timer/Counter
√
Compare Match Output
√
PWM Output
√
PWM Alignment
Edge
PWM Adjustment Period & Duty
Duty or Period
CTM Function Summary
TM Operation
The Compact type TM offers a diverse range of functions, from simple timing operations to
PWM signal generation. The key to understanding how the TM operates is to see it in terms of
a free running counter whose value is then compared with the value of pre-programmed internal
comparators. When the free running counter has the same value as the pre-programmed comparator,
known as a compare match situation, a TM interrupt signal will be generated which can clear the
counter and perhaps also change the condition of the TM output pin. The internal TM counter is
driven by a user selectable clock source, which can be an internal clock or an external pin.