HT46R47-H
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. If the PWM function is en-
abled, the PWM signal will appear on PD0 (if PD0 is op-
erating in output mode). Writing ²1² to PD0 data register
will enable the PWM output function and writing ²0² will
force the PD0 to remain at ²0². The I/O functions of PD0
are as shown.
In a PWM cycle, the duty cycle of each modulation cycle
is shown in the table.
Parameter
AC (0~3)
Duty Cycle
DC+1
64
i<AC
Modulation cycle i
(i=0~3)
DC
64
i³AC
The modulation frequency, cycle frequency and cycle
duty of the PWM output signal are summarized in the
following table.
I/O
I/P
O/P
I/P
O/P
Mode (Normal) (Normal) (PWM)
(PWM)
Logical
Input
Logical
Output
Logical
Input
PD0
PWM
PWM Modulation PWM Cycle
PWM Cycle
Duty
Frequency
Frequency
fSYS/64
fSYS/256
[PWM]/256
It is recommended that unused or not bonded out I/O
lines should be set as output pins by software instruction
to avoid consuming power under input floating state.
A/D Converter
The 4 channels and 9-bit resolution A/D converter is im-
plemented in this microcontroller. The reference voltage
is VDD. The A/D converter contains 4 special registers;
ADRL (20H), ADRH (21H), ADCR (22H) and ACSR
(23H). The ADRH and ADRL are A/D result register
higher-order byte and lower-order byte which are
read-only. After the A/D conversion is completed, the
ADRL, ADRH should be read to get the conversion re-
sult data. The ADCR is an A/D converter control regis-
ter, which defines the A/D channel number, analog
channel select, start A/D conversion control bit and the
end of A/D conversion flag. If the users want to start an
A/D conversion, define PB configuration, select the con-
verted analog channel, and give START bit a raising
edge and a falling edge (0®1®0). At the end of A/D
conversion, the EOCB bit is cleared and an A/D con-
verter interrupt occurs (if the A/D converter interrupt is
enabled). The ACSR is A/D clock setting register, which
is used to select the A/D clock source.
PWM
The microcontroller provides 1 channel (6+2) bits PWM
output shared with PD0. The PWM channel has its data
register denoted as PWM (1AH). The frequency source
of the PWM counter comes from fSYS. The PWM register
is an eight bits register. The waveforms of PWM output
are as shown. Once the PD0 is selected as the PWM
output and the output function of PD0 is enabled
(PDC.0=²0²), writing 1 to PD0 data register will enable
the PWM output function and writing ²0² will force the
PD0 to stay at ²0².
A PWM cycle is divided into four modulation cycles
(modulation cycle 0~modulation cycle 3). Each modula-
tion cycle has 64 PWM input clock period. In a (6+2) bit
PWM function, the contents of the PWM register is di-
vided 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.
S
Y
S
[
P
W
M
]
=
1
0
0
P
W
M
2
5
/
6
4
2
2
2
2
5
5
6
6
/
/
/
/
6
6
6
6
4
4
4
4
2
2
2
2
5
5
5
6
/
/
/
/
6
6
6
6
4
4
4
4
2
2
2
2
5
5
5
5
/
/
/
/
6
6
6
6
4
4
4
4
2
2
2
2
5
6
6
6
/
/
/
/
6
6
6
6
4
4
4
4
[
P
W
M
]
=
1
0
1
P
W
M
2
2
2
6
6
6
/
/
/
6
6
6
4
4
4
[
P
W
M
]
=
1
0
2
P
W
M
[
P
W
M
]
=
1
0
3
P
W
M
P
W
M
m
o
d
u
l
a
t
i
o
n
p
e
r
i
o
d
:
6
4
/
f
M
o
d
u
l
a
t
i
o
n
c
y
c
l
e
0
M
o
d
u
l
a
t
i
o
n
c
y
c
l
e
1
M
o
d
u
l
a
t
i
o
n
c
y
c
l
e
2
M
o
d
u
l
a
t
i
o
n
c
y
c
l
e
3
M
o
d
u
l
a
t
i
o
n
c
y
c
l
e
0
P
W
M
c
y
c
l
e
:
2
5
6
/
f
PWM
Rev. 1.30
17
March 1, 2006