HT46R23
Rev. 1.30
16
August 17, 2001
The PA5 and PA4 are pin-shared with INT and TMR pins
respectively.
The PB can also be used as A/D converter inputs. The
A/D function will be described later. There is a PWM
function shared with PD0/PD1. If the PWM function is
enabled, the PWM0/PWM1 signal will appear on
PD0/PD1 (if PD0/PD1 is operating in output mode). The
I/O functions of PD0/PD1 are as shown.
I/O
Mode
I/P
(Normal)
O/P
(Normal)
I/P
(PWM)
O/P
(PWM)
PD0
PD1
Logical
Input
Logical
Output
Logical
Input
PWM0
PWM1
It is recommended that unused or not bonded out I/O
linesshouldbesetasoutputpinsbysoftwareinstruction
to avoid consuming power under input floating state.
PWM
The microcontroller provides 2 channels (6+2)/(7+1)
(dependent on options) bits PWM output shared with
PD0/PD1. The PWM channels have their data registers
denoted as PWM0 (1AH) and PWM1 (1BH). The fre-
quency source of the PWM counter comes from f
SYS
.
The PWM registers are two 8-bit registers. The wave-
forms of PWM outputs are as shown. Once the
PD0/PD1 are selected as the PWM outputs and the out-
put function of PD0/PD1 are enabled (PDC.0/PDC.1
= 0 ), writing 1 to PD0/PD1 data register will enable the
PWM output function and writing
0
will force the
PD0/PD1 to stay at 0 .
A (6+2) bits mode PWM cycle is divided into four modu-
lation cycles (modulation cycle 0~modulation cycle 3).
Each modulation cycle has 64 PWM input clock period.
In a (6+2) bit PWM function, the contents of the PWM
register is divided into two groups. Group 1 of the PWM
register is denoted by DC which is the value of
PWM.7~PWM.2.
The group 2 is denoted by AC which is the value of
PWM.1~PWM.0.
In a (6+2) bits mode PWM cycle, the duty cycle of each
modulation cycle is shown in the table.
Parameter
AC (0~3)
Duty Cycle
Modulation cycle i
(i=0~3)
i<AC
DC
1
64
i AC
DC
64
A (7+1) bits mode PWM cycle is divided into two modu-
lation cycles (modulation cycle0~modulation cycle 1).
Eachmodulationcyclehas128PWMinputclockperiod.
In a (7+1) bits PWM function, the contents of the PWM
register is divided into two groups. Group 1 of the PWM
register is denoted by DC which is the value of
PWM.7~PWM.1.
The group 2 is denoted by AC which is the value of
PWM.0.
2
9
1 :
0
# $ " ,
# $
( " ,
, ) &
! = 5 ' *
9 $ ( " , :
! - ! ) ! % +)
1
2
9
$
:
D
D
D
$ ( )$ "+ )
! ) !'
+ )$ ( )$ "% +)
. + * )
! - $ ( )$ "% +)
+ )! ) ! % +)
! ) !+ )
12
3 7
0 0
9
$
:
D
Input/output ports