欢迎访问ic37.com |
会员登录 免费注册
发布采购

HT45R38 参数 Datasheet PDF下载

HT45R38图片预览
型号: HT45R38
PDF下载: 下载PDF文件 查看货源
内容描述: C / R键F型8位OTP MCU [C/R to F Type 8-Bit OTP MCU]
分类和应用:
文件页数/大小: 49 页 / 347 K
品牌: HOLTEK [ HOLTEK SEMICONDUCTOR INC ]
 浏览型号HT45R38的Datasheet PDF文件第23页浏览型号HT45R38的Datasheet PDF文件第24页浏览型号HT45R38的Datasheet PDF文件第25页浏览型号HT45R38的Datasheet PDF文件第26页浏览型号HT45R38的Datasheet PDF文件第28页浏览型号HT45R38的Datasheet PDF文件第29页浏览型号HT45R38的Datasheet PDF文件第30页浏览型号HT45R38的Datasheet PDF文件第31页  
HT45R38  
The following two programming examples illustrate how to setup and implement an A/D conversion. In the first exam-  
ple, 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 EOCB Polling Method to detect end of conversion  
clr  
EADI  
a,00000001B  
; disable ADC interrupt  
mov  
mov  
mov  
mov  
ACSR,a  
a,00100000B  
ADCR,a  
; setup the ACSR register to select fSYS/8 as the A/D clock  
; setup ADCR register to configure Port PE0~PE3 as A/D inputs  
; and select AN0 to be connected to the A/D converter  
:
:
; As the Port E channel bits have changed the following START  
; signal (0-1-0) must be issued within 10 instruction cycles  
:
Start_conversion:  
clr  
set  
clr  
START  
START  
START  
; reset A/D  
; start A/D  
Polling_EOC:  
sz  
EOCB  
; poll the ADCR register EOCB bit to detect end of A/D conversion  
; continue polling  
jmp  
mov  
mov  
mov  
mov  
polling_EOC  
a,ADRH  
adrh_buffer,a  
a,ADRL  
; read conversion result high byte value from the ADRH register  
; save result to user defined memory  
; read conversion result low byte value from the ADRL register  
; save result to user defined memory  
adrl_buffer,a  
:
:
Start_conversion  
jmp  
; start next A/D conversion  
Example: using Interrupt Method to detect end of conversion  
; disable ADC interrupt  
clr  
EADI  
a,00000001B  
ACSR,a  
mov  
mov  
; setup the ACSR register to select fSYS/8 as the A/D clock  
mov  
mov  
a,00100000B  
ADCR,a  
:
; setup ADCR register to configure Port PE0~PE3 as A/D inputs  
; and select AN0 to be connected to the A/D converter  
; As the Port E channel bits have changed the following START  
; signal (0-1-0) must be issued within 10 instruction cycles  
:
Start_conversion:  
clr  
START  
START  
set  
clr  
; reset A/D  
; start A/D  
START  
ADF  
clr  
; clear ADC interrupt request flag  
; enable ADC interrupt  
; enable global interrupt  
set  
set  
EADI  
EMI  
:
:
:
; ADC interrupt service routine  
ADC_ISR:  
mov  
mov  
mov  
acc_stack,a  
a,STATUS  
; save ACC to user defined memory  
status_stack,a  
:
; save STATUS to user defined memory  
:
mov  
mov  
mov  
mov  
clr  
a,ADRH  
adrh_buffer,a  
a,ADRL  
adrl_buffer,a  
START  
START  
START  
:
; read conversion result high byte value from the ADRH register  
; save result to user defined register  
; read conversion result low byte value from the ADRL register  
; save result to user defined register  
set  
clr  
; reset A/D  
; start A/D  
:
Rev. 1.00  
27  
December 13, 2006  
 复制成功!