ht82j97e Holtek Semiconductor Inc., ht82j97e Datasheet - Page 21

no-image

ht82j97e

Manufacturer Part Number
ht82j97e
Description
Ht82j97e/ht82j97a -- Usb Joystick Encoder 8-bit Otp Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
To Configure PWM Block
The HT82J97E/HT82J97A has two PWM outputs
(PWM1 and PWM2), which are shared with PC2, PC3
and can be easily enabled or disabled by the PWM1_EN
or PWM2_EN bit of PORT_PC (16H) respectively.
Also there is a one 8-bit PWMBR (PWM Base Period
Register, 18H) which defines both PWM output wave-
form cycle period.
PWM cycle period = 256´1/f
256´4/f
where 1/f
PORT_PC (16H)
For example if PWMBR = 17, 4/f
f
So both output waveform cycle period is 256´4/6
´(17+1) = about 3072ms (0.325kHz)
Now user can easily define the corresponding PWM
duty by configuring the PWM1DR (for PWM1) or
PWM2DR (for PWM2) duty registers
PWM1 duty (high pulse) = (PWM1DR+1)/256´100%
PWM1 high pulse period = PWM1 duty´PWM cycle pe-
riod
I/O Port Special Registers Definition
·
·
Rev. 1.50
SYS
Register
Port-A (12H) - PA
Port-A Control (13H) - PAC
This port configure the input or output mode of Port-A
(12H)
PA
= 6MHz.
SYS
SYS
´(PWMBR+1)
Bits
or 4/f
0
1
2
3
4
5
6
7
SYS
Labels
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
is defined by PWM_S bit of the
Read/Write
SYS
SYS
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
(T1) is selected and
´(PWMBR+1), or
Option
¾
¾
¾
¾
¾
¾
¾
¾
21
I/O (R/W) has pull-low and pull-high ROM code option.
Has falling edge wake-up ROM code option.
I/O (R/W) has pull-low and pull-high option.
Has falling edge wake-up option.
I/O (R/W) has pull-low and pull-high option.
Has falling edge and rising edge wake-up option.
I/O (R/W) has pull-low and pull-high option.
Has falling edge and rising edge wake-up option.
I/O (R/W) has pull-high option.
Has falling edge wake-up option.
I/O (R/W) has pull-high option.
Has falling edge wake-up option.
I/O (R/W) has pull-high option.
Has falling edge wake-up option.
I/O (R/W) has pull-high option.
Has falling edge wake-up option, pin-shared with timer in-
put pin.
PWM1 Low pulse period = PWM cycle period-high pulse
period
PWM2 duty (high pulse) = (PWM2DR+1)/256´100%
PWM2 high pulse period = PWM2 duty´PWM cycle pe-
riod
PWM2 Low pulse period = PWM cycle period-high pulse
period
For example PWMBR=17, PWM1DR=63, 4/f
selected and f
PWM cycle period = 256´4/6´(17+1) = about 3072ms
(0.325kHz)
PWM1 duty = (63+1)/256 = 25%
PWM1 high pulse period = 25%´3072ms = 768ms
PWM1 low pulse period = 3072ms -768ms = 2304ms
SYS
=6MHz
Functions
HT82J97E/HT82J97A
October 19, 2005
SYS
(T1) is

Related parts for ht82j97e