- 39
- 0
- 约1.17万字
- 约 33页
- 2017-07-05 发布于河南
- 举报
AD、蜂鸣器、时钟芯片(国外英文资料)
AD、蜂鸣器、时钟芯片
/ / definition and AD conversion of special function registers
//ADCON conversion control register
The //ADDATAH conversion result register is 8 bits high
The //ADDATAL conversion result register is 8 bits low
//P1 port function selection
P1CONL=0xB6 //P1.3 output, P1.2AD input, P1.1 external input interrupt, P1.0 output
P1CONH=**101010 //**=00 input, **=10 output
P1_INT=0x? / / there are problems
Int GetAD () //AD function
{
Unsigned char AD_finish=0; / / AD conversion storage mark
Int AD_result; / / define a variable to store the AD conversion results
//ADC_DATAH=0; //AD data register high 8 bit clear
//ADC_DATAL=0xFB; //AD data register low, 2 bit clear
Delayms (1); / / the input voltage reaches a stable delay
ADCON=0x23; / select the P1.2 channel, the AD flag, =0, fxx/8 (50uS complete conversion), and start the AD conversion
While (AD_finish==0) / / wait for the end of the AD conversion
{
AD_finish= (ADCON0x08); / / ADC_FLAG bit is set to 1 queries
}
AD_result=ADDATAH*4+ (ADDATAL0x03); / / read the AD conversion results, because the ADC_DATAH stored in the high accuracy of 8 digits in 10, ADC_DATAL in the low two
AD data storage / low 2, when converted to decimal number, need to be left in the ADC_DATA shift 2, i.e. by 4 ADC_DATAL low two
ADCON=0xf7; / / remove marks the end of conversion
Return AD_result; / / return results to the function
}
Char Continue_heating / / set as a global variable, and then continue to complete the key processing by the change of his assignment, to judge the continue heating to 92 degrees, the 1 said to be heated, repeat
/ / button for 3 seconds to return to normal, the variable is set to 0
Uchar checking / / set as a global variable, its value by the timer interrupt every time plus 1 to 100, 0, AD for interval extraction results on Middle_variable, so the current
Comparison of AD and Middle_variable / / results, if it is equal, said electric heating has been extremely bad, unable to work.
Uchar NTC_checking / /
您可能关注的文档
- !!!变压器的要求和技术参数(国外英文资料).doc
- (上卷)重新学会笑--------中国式新森田教...(国外英文资料).doc
- (宁鸣)晨间(国外英文资料).doc
- (四)津液-(国外英文资料).doc
- (新版)高强轻质高温耐火砖生产制造制备及应用工艺专利技术文集(国外英文资料).doc
- (图解)普林斯顿进攻体系(国外英文资料).doc
- (第1章) 单片机教案(国外英文资料).doc
- (考试时间:70分钟 试卷满分:70分 考试形式:开卷)(国外英文资料).doc
- - 上海LNG加气站 上海CNG加气站博客上海LNG加气站 上海CNG加气站博客(国外英文资料).doc
- ...我相信能耐耐心心看完文章的人,不用再对手机这东西纠结了_百度文库...(国外英文资料).doc
最近下载
- Unit 1 Animal friends Hit it big(课件)外研版(三起)(2024)英语三年级下册.pptx VIP
- 《英语修辞学》第七章.ppt VIP
- 公路工程分包合同(标准版).docx VIP
- 《英语修辞学》第六章.ppt VIP
- 虚拟电厂整合.pptx VIP
- 2025北京东城五年级(上)期末英语(含答案).pdf VIP
- 2025年东营科技职业学院单招考试文化素质数学试题及完整答案详解(夺冠系列).docx
- 深度解析(2026)《GBT 23588-2020钕铁硼生产加工回收料》(2026年)深度解析.pptx VIP
- 2025年澳门高一英语试卷及答案.doc VIP
- 2026 年中考数学基础夯实专项试卷(附答案可下载).docx VIP
原创力文档

文档评论(0)