freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

溫度檢測的系統(tǒng)設(shè)計實驗報告-資料下載頁

2025-02-25 10:30本頁面

【導(dǎo)讀】此次溫度檢測系統(tǒng)設(shè)計在硬件方面主要采用STC89C52單片機(jī)作為主控核心。A/D1100數(shù)模轉(zhuǎn)換到單片機(jī)進(jìn)行處理。STC89C52單片機(jī)是由Atmel公司推出的,種溫度檢測器,不僅廣泛應(yīng)用于工業(yè)測溫,而且被制成各種標(biāo)準(zhǔn)溫度計。

  

【正文】 ***************溫度檢測顯示程序 *****************/ /************AD1100模數(shù)轉(zhuǎn)換 ***************/ /********1602液晶顯示 *************/ include include define uint unsigned int define uchar unsigned char /*****ADS1100管腳定義 ****/ sbit Sda=P2^0。 sbit Scl=P2^1。 /****1602管腳定義 ****/ sbit RS=P2^2。 sbit RW=P2^3。 sbit E=P2^4。 /*****段和位選 ******/ sbit DU=P2^6。 sbit WE=P2^7。 uchar code table[]= TEMP IS : 。 /******延時函數(shù) **********/ void delay_xms(uint xms) { uint i,j。 for(i=xms。i0。i) for(j=112。j0。j)。 } /***************1602液晶顯示 ********************/ /*****寫命令 ******/ write_(uchar ) { 29 RS=0。 //數(shù)據(jù) /命令選擇端 H/L RW=0。 //讀寫選擇端 H/L P0=。 delay_xms(5)。 E=1。 //打開使能信號 delay_xms(5)。 E=0。 } /*******寫數(shù)據(jù) *********/ write_data(uchar date) { RS=1。 RW=0。 P0=date。 delay_xms(5)。 E=1。 delay_xms(5)。 E=0。 } /*******1602初始化 *******/ init_1602() { RS=0。 RW=0。 E=0。 DU=1。 P0=0X00。 DU=0。 write_(0X01)。 write_(0X38)。 write_(0X0f)。 write_(0X06)。 write_(0X80+0X03)。 } /***************AD TRANSFER*********************/ /* 啟動 IIC總線 */ void start(void) { Sda=1。 30 _nop_()。 Scl=1。 _nop_()。 Sda=0。 _nop_()。 Scl=0。 } /* 停止 IIC總線 */ void stop(void) { Sda=0。 _nop_()。 Scl=1。 _nop_()。 Sda=1。 _nop_()。 Scl=0。 } /* 應(yīng)答 IIC總線 */ void ack(void) { Sda=0。 _nop_()。 Scl=1。 _nop_()。 Scl=0。 _nop_()。 } /* 非應(yīng)答 IIC總線 */ void noack(void) { Sda=1。 31 _nop_()。 Scl=1。 _nop_()。 Scl=0。 _nop_()。 } /* 發(fā)送一個字節(jié)配置寄存器 */ void send(unsigned char Data) { unsigned char BitCounter=8。 unsigned char temp。 do { temp=Data。 //送入數(shù)據(jù) Scl=0。 //時鐘為 0 _nop_()。 if((tempamp。0x80)==0x80) //判斷高位是為 1還是為 0 Sda=1。//A/D數(shù)據(jù)送入端開啟, D7=1 else //D7=0 Sda=0。//A/D數(shù)據(jù)送入端關(guān)閉 Scl=1。//時鐘 =1 temp=Data1。//左移一位 ,將 D6位送入 D7 位 Data=temp。 //重新賦值 BitCounter。//自減,判斷 8位數(shù)據(jù)是否檢測完畢的依據(jù) } while(BitCounter)。//若檢測完則順序執(zhí)行,否則循環(huán)下去 Scl=0。 //當(dāng)一個字節(jié)數(shù)據(jù)檢測完畢后,時鐘關(guān)閉 //發(fā)送一個字節(jié)完畢 } /* 讀入一個字節(jié)并返回 */ unsigned char read(void) { uchar temp=0。 uchar temp1=0。 uchar BitCounter=8。 Sda=1。 //數(shù)據(jù)端開啟 do 32 { //開始讀入數(shù)據(jù) Scl=0。 _nop_()。 Scl=1。 _nop_()。 if(Sda) //Sda由高位的為 1為 0控制的 temp=temp|0x0001。//將低位 D0置 1 else temp=tempamp。0xfffe。//將低位 D0置 0 if(BitCounter1) { temp1=temp1。 //左移一位 temp=temp1。 } BitCounter。 } while(BitCounter)。 return(temp)。//采集 16 位 SDA的數(shù)據(jù),賦值給 temp //讀入一個字節(jié)完畢 } /****顯示程序 *******/ void display(unsigned long k) { unsigned int temp。 unsigned long int v。 v=5*k/(32768)。 write_(0x80+0x0a)。 temp=v/10000。 //取 D5整位 write_data(temp+0x30)。 temp=v/1000%10。 //取 D5整位 write_data(temp+0x30)。 temp=v/100%10。 //取 D5整位 write_data(temp+0x30)。 temp=v/10%10。 //取 D5整位 write_data(temp+0x30)。 temp%=v%10。 //取 D5整位 write_data(temp+0x30)。 } void display1() { uchar num。 33 write_(0x80)。 //在第一行開頭顯示“ TEMP IS” for(num=0。num13。num++) { write_data(table[num])。 delay_xms(5)。 } } void main() { short m,n,k。 init_1602()。 display1()。 while(1) { //配置寄存器,默認(rèn)設(shè)置 0x8c start()。 send(0x90)。//1001 0000單周期轉(zhuǎn)換工作 ack()。 send(0x8c)。//1000 1100控制轉(zhuǎn)換速率 8sps,連續(xù)轉(zhuǎn)換工作 , ack()。 start()。 send(0x91)。//1001 0001 PGA=2。00,PGA=1。10,PGA=4。11,PGA=8。 ack()。 m=read()。 ack()。 //調(diào)用應(yīng)答 II2總線 n=read()。 noack()。 //調(diào)用非應(yīng)答 II2總線 stop()。 k=(0x00ff amp。 m)8|n。//左移 8/n,n=temp k=0。 display(k)。 } } 34
點擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1