⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tempad.c

📁 一个热水器程序!三星9454单片机
💻 C
字号:
#include "Define1.h"

//******************************************************************
//*************************************************************************
//按键测试子过程(A/D转换方式进行)
uchar TempADcon(void)
{  
    uchar times = 0x5;
    uchar high  = 0xff;
    uchar AD2=0xff;
    ////di;可以不禁止中断
    Clr_WatchDog;
    while(times)
    {
      ADCON =0x77 ;//0x83 P26 is AD covert 0x47;//0x11;//0x27;//0x41; 0x39;     select P0.4 is AD input  //selectP0.1// P0.2is as AD convert,input clock=Fosc/1     
      while(!Test_ADOK);      //一直等转换结束标志,注意有分号!!!
      if  (ADDATAH  < high)   //The data in ADDATAH is 8; in ADDATAL is 2. 
          high = ADDATAH;
      times--;
    }     
    

   if  ((high>0xfD)&&(high <0xff))AD2=0x01; //E9
   
   if  ((high>2)&&(high <0xfD))AD2=high; //Temp AD2
   
   if  ((high>0)&&(high <2))AD2=0x03;//E1
     
    ////ei;   
    return  (AD2);   //rede AD data.
}





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -