Pwm O�Tp�T Control - Holtek HT46R003B Manual

Cost-effective a/d 8-bit otp mcu
Table of Contents

Advertisement

f
/ 2
S Y S
[ P W M ] = 1 0 0
P W M
5 0 / 1 2 8
[ P W M ] = 1 0 1
P W M
5 1 / 1 2 8
[ P W M ] = 1 0 2
P W M
5 1 / 1 2 8
[ P W M ] = 1 0 3
P W M
5 2 / 1 2 8
P W M
m o d u l a t i o n p e r i o d : 1 2 8 / f
M o d u l a t i o n c y c l e 0
b 7
PWM Output Control
The PWM outputs are pin-shared with the I/O pin PA4. To operate as a PWM output and not as
an I/O pin, the correct bits must be set in the CTRL0 register. A zero value must also be written to
the corresponding bit in the I/O port control register PAC.4 to ensure that the corresponding PWM
output pin is set as an output. After these two initial steps have been carried out, and of course
after the required PWM value has been written into the PWM register, writing a high value to
the corresponding bit in the output data register PA.4 will enable the PWM data to appear on the
pin. Writing a zero value will disable the PWM output function and force the output low. In this
way, the Port data output registers can be used as an on/off control for the PWM function. Note
that if the CTRL0 register has selected the PWM function, but a high value has been written to its
corresponding bit in the PAC control register to configure the pin as an input, then the pin can still
function as a normal input line, with pull-high resistor options.
PWM Programming Example
mov a,64h
mov pwm0,a
set ctrl0.5
set ctrl0.3
clr pac.4
set pa.4
:
:
clr pa.4
Rev. 1.00
Cost-Effective A/D 8-bit OTP MCU
S Y S
P W M
c y c l e : 2 5 6 / f
S Y S
7+1 Mode
b 0
PWM Register for 7+1 Mode
; set PWM value of decimal 100
; select the 7+1 PWM mode
; select pin PA4 to have a PWM function
; set pin PA4 as an output
; enable the PWM output
; disable the PWM output_ pin PA4 forced low
��
5 0 / 1 2 8
5 0 / 1 2 8
5 1 / 1 2 8
5 1 / 1 2 8
M o d u l a t i o n c y c l e 1
P W M
R e g i s t e r
( 7 + 1 ) M o d e
A C
v a l u e
D C v a l u e
HT46R003B
5 0 / 1 2 8
5 1 / 1 2 8
5 1 / 1 2 8
5 2 / 1 2 8
M o d u l a t i o n c y c l e 0
��ne 1�� �01�

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

Table of Contents