
Rev. 1.40
68
March 29, 2019
Rev. 1.40
69
March 29, 2019
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
Programmable Frequency Divider – PFD
The Programmable Frequency Divider provides a means of producing a variable frequency output
suitable for applications requiring a precise frequency generator.
The PFD output is pin-shared with the I/O pin PA5. The PFD function is enabled via PFDEN bit in
MISC register, however, if not enabled, the pin can operate as a normal I/O pin.
The clock source for the PFD circuit can originate from either the timer 0 or timer 1 overflow signal
selected via PFDSELbit in MISC register. The output frequency is controlled by loading the required
values into the timer registers and prescaler registers to give the required division ratio. The timer
will begin to count-up from this preload register value until full, at which point an overflow signal
is generated, causing the PFD output to change state. The timer will then be automatically reloaded
with the preload register value and continue counting-up.
For the PFD output to function, it is essential that the corresponding bit of the Port A control register
PAC bit 5 is setup as an output. If setup as an input the PFD output will not function, however, the
pin can still be used as a normal input pin. The PFD output will only be activated if bit PA5 is set
to “1”. This output data bit is used as the on/off control bit for the PFD output. Note that the PFD
output will be low if the PA5 output data bit is cleared to “0”.
Using this method of frequency generation, and if a crystal oscillator is used for the system clock,
very precise values of frequency can be generated.
PFD Output Control
Prescaler
Bits T0PSC0~T0PSC2 of the TMR0C register can be used to define the pre-scaling stages of the
internal clock sources of the Timer/Event Counter 0. The Timer/Event Counter overflow signal can
be used to generate signals for the PFD and Timer Interrupt.