ht82j30r Holtek Semiconductor Inc., ht82j30r Datasheet - Page 30

no-image

ht82j30r

Manufacturer Part Number
ht82j30r
Description
Ht82j30r/ht82j30a -- 16 Channel A/d Mcu With Spi Interface
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
HT82J30R
Manufacturer:
HOLTEK
Quantity:
155
tant to note how the single PWM cycle is subdivided into
4 individual modulation cycles, numbered from 0~3 and
how the AC value is related to the PWM value.
PWM Output Control
The PWM0 output is shared with pin PD0. To operate as
a PWM0 output and not as I/O pins, the correct PWM
configuration option must be selected. A 0 must also
be written to the corresponding bit in the I/O port control
register, PDC.0, to ensure that the PWM output pin is
setup 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
register will enable the PWM data to appear on the pin.
Writing a 0 to the bit will disable the PWM output func-
tion and force the output low. In this way, the Port D data
output register bit, PD.0, can be used as an on/off control
for the PWM function. Note that if the configuration op-
tions have selected the PWM function, but a 1 has been
written to its corresponding bit in the PDC control register
to configure the pin as an input, then the pin can still func-
tion as a normal input line, with pull-high resistor options.
PWM Programming Example
The following sample program shows how the PWM
output is setup and controlled. Before use the corre-
sponding PWM output configuration options must first
be selected.
mov a,64h
mov pwm,a
clr pdc.0
set pd.0
clr pd.0
Analog to Digital Converter
The need to interface to real world analog signals is a
common requirement for many electronic systems.
However, to properly process these signals by a
microcontroller, they must first be converted into digital
signals by A/D converters. By integrating the A/D con-
version electronic circuitry into the microcontroller, the
need for external components is reduced significantly
with the corresponding follow-on benefits of lower costs
and reduced component space requirements.
Rev. 1.10
1 to the corresponding PD.0 bit in the PD output data
:
:
PWM Modulation
Frequency
:
:
f
SYS
/64
; setup PWM value of 100
; decimal which is 64H
; setup pin PD0 as an output
; PD.0=1; enable the PWM
; output
; disable the PWM output
; PD0 will remain low
PWM Cycle
Frequency
f
SYS
/256
(PWM register
PWM Cycle
value)/256
Duty
30
A/D Overview
Depending upon which package type is chosen, the de-
vices contain either a 6 or 16-channel analog to digital
converter which can directly interface to external analog
signals, such as that from sensors or other control sig-
nals and convert these signals directly into an 8-bit digi-
tal value.
The A/D block diagram shows the overall internal struc-
ture of the A/D converter, together with its associated
registers.
A/D Converter Data Registers - ADR
The devices, which contain a single 8-bit A/D converter,
require one data register, known as ADR. After the con-
version process takes place, this register can be directly
read by the microcontroller to obtain the digitised con-
version value.
In the following tables, D0~D7 are the A/D conversion
data result bits.
A/D Converter Control Register - ADCR
To control the function and operation of the A/D con-
verter, control registers known as ADCR and ADSR are
provided. These 8-bit registers define functions such as
the selection of which analog channel is connected to
the internal A/D converter, which pins are used as ana-
log inputs and which are used as normal I/Os as well as
controlling the start function and monitoring the A/D con-
verter end of conversion status.
One section of this register contains the bits
ACS3~ACS0 which define the channel number. As each
of the devices contains only one actual analog to digital
converter circuit, each of the individual 4 analog inputs
must be routed to the converter. It is the function of the
ACS3~ACS0 bits in the ADCR register to determine
which analog channel is actually connected to the inter-
nal A/D converter. Note that the ACS3 bit must always
be assigned a zero value.
The START bit in the ADCR register is used to start and
reset the A/D converter. When the microcontroller sets
this bit from low to high and then low again, an analog to
digital conversion cycle will be initiated. When the
START bit is brought from low to high but not low again,
Register
Package Channels Resolution
28-pin
44-pin
ADR
Bit
D7
7
16
6
A/D Data Register
Bit
D6
6
HT82J30R/HT82J30A
Bit
D5
5
8-bit
8-bit
Bit
D4
4
Bit
D3
3
March 13, 2008
Bit
D2
2
Input Pins
PC0~PC7
PC1, PC2
PB0~PB3
PB0~PB7
Bit
D1
1
Bit
D0
0

Related parts for ht82j30r