?? tempad.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 + -