ht82j30r Holtek Semiconductor Inc., ht82j30r Datasheet - Page 34

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
duce power by turning off the internal A/D function by
clearing the A/D channel selection bits may be an impor-
tant consideration in battery powered applications.
Another important programming consideration is that
when the A/D channel selection bits change value, the
A/D converter must be re-initialised. This is achieved by
pulsing the START bit in the ADCR register immediately
after the channel selection bits have changed state. The
exception to this is where the channel selection bits are
all cleared, in which case the A/D converter is not re-
quired to be re-initialised.
Start_conversion:
Polling_EOC:
Example: using the interrupt method to detect the end of conversion
Start_conversion:
Rev. 1.10
clr EADI
mov a,00011001
mov acsr,a
mov a,00000000
mov adcr,a
clr START
set START
clr START
sz
jmp polling_EOC
mov a,ADR
mov adrl_buffer,a
jmp start_conversion
clr EADI
mov a,00000001B
mov ACSR,a
mov a,00000010B
mov ADCR,a
clr START
set START
clr START
clr ADF
set EADI
set EMI
:
EOCB
:
:
:
:
:
:
; disable ADC interrupt
; setup the ACSR register to select fsys/8 as the A/D clock
; setup the ACSR register to configure Port PB0~PB2 as A/D
; Inputs
; setup the ADCR register and select AN0 to be connected to
; the A/D converter
; As the Port B and Port C channel bits have changed the
; following START signal (0 1 0) must be issued within
; 10 instruction cycles
; reset A/D
; start A/D
; poll the ADCR register EOCB bit to detect end
; of A/D conversion
; continue polling
; read conversion result value
; save result to user defined register
; start next A/D conversion
; disable ADC interrupt
; setup the ACSR register to select fSYS/8 as
; the A/D clock
; setup ADCR register to configure Port PB0~PB3
; as A/D inputs
; and select AN0 to be connected to the A/D
; As the Port B channel bits have changed the
; following START signal(0 1 0) must be issued
; within 10 instruction cycles
; reset A/D
; start A/D
; clear ADC interrupt request flag
; enable ADC interrupt
; enable global interrupt
34
A/D Programming Example
The following two programming examples illustrate how
to setup and implement an A/D conversion. In the first
example, the method of polling the EOCB bit in the
ADCR register is used to detect when the conversion
cycle is complete, whereas in the second example, the
A/D interrupt is used to determine when the conversion
is complete.
Example: using an EOCB polling method to detect the
end of conversion
HT82J30R/HT82J30A
March 13, 2008

Related parts for ht82j30r