Holtek BS86DH12C Manual page 98

High voltage touch a/d flash mcu with hvio
Table of Contents

Advertisement

Timer/Counter Mode
To select this mode, bits PTM1 and PTM0 in the PTMC1 register should be set to "11" respectively.
The Timer/Counter Mode operates in an identical way to the Compare Match Output Mode
generating the same interrupt flags. The exception is that in the Timer/Counter Mode the PTM
output pin is not used. Therefore the above description and Timing Diagrams for the Compare
Match Output Mode can be used to understand its function. As the PTM output pin is not used in
this mode, the pin can be used as a normal I/O pin or other pin-shared functions.
PWM Output Mode
To select this mode, bits PTM1 and PTM0 in the PTMC1 register should be set to "10" respectively
and also the PTIO1 and PTIO0 bits should be set to "10" respectively. The PWM function within
the PTM is useful for applications which require functions such as motor control, heating control,
illumination control, etc. By providing a signal of fixed frequency but of varying duty cycle on the
PTM output pin, a square wave AC waveform can be generated with varying equivalent DC RMS
values.
As both the period and duty cycle of the PWM waveform can be controlled, the choice of generated
waveform is extremely flexible. In the PWM Output Mode, the PTCCLR bit has no effect as the
PWM period. Both of the CCRP and CCRA registers are used to generate the PWM waveform, one
register is used to clear the internal counter and thus control the PWM waveform frequency, while
the other one is used to control the duty cycle. The PWM waveform frequency and duty cycle can
therefore be controlled by the values in the CCRA and CCRP registers.
An interrupt flag, one for each of the CCRA and CCRP, will be generated when a compare match
occurs from either Comparator A or Comparator P. The PTOC bit in the PTMC1 register is used to
select the required polarity of the PWM waveform while the two PTIO1 and PTIO0 bits are used to
enable the PWM output or to force the PTM output pin to a fixed high or low level. The PTPOL bit
is used to reverse the polarity of the PWM output waveform.
• 10-bit PTM, PWM Output Mode, Edge-aligned Mode
If f
=16MHz, TM clock source select f
SYS
The PTM PWM output frequency=(f
If the Duty value defined by the CCRA register is equal to or greater than the Period value, then the
PWM output duty is 100%.
Rev. 1.00
High Voltage Touch A/D Flash MCU with HVIO
CCRP
1~1023
Period
1~1023
Duty
CCRA
/4, CCRP=512 and CCRA=128,
SYS
/4)/512=f
/2048=8kHz, duty=128/512=25%,
SYS
SYS
98
BS86DH12C
0
1024
October 26, 2018

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BS86DH12C and is the answer not in the manual?

Table of Contents