【正文】
21 disp_buf[0]=t1%10。 TH1=0xfd。 /*得小數(shù)部分的 LSB數(shù) */ temper[0]=temper[0]2。 /* 啟動溫度轉(zhuǎn)換 */ delay(500)。 writebyte(0xCC)。 } /***********************CPU讀取溫度值 ***************************/ void readtemp(void) /*讀取溫度 */ { uchar a=0,b=0。 i0。i) { DQ = 0。 /*拉高總線 */ delay(14)。 內(nèi)蒙古科技大學(xué) 信息工程學(xué)院實訓(xùn)報告 18 return rece。inum。 } /************************************************************************** 函數(shù)名稱 : ZLG7290_SendCmd **************************************************************************/ uchar ZLG7290_SendCmd(uchar Data1,uchar Data2) { uchar Data[2]。j60。 } *s=RcvByte()。 Start_I2c()。 /*發(fā)送非就答位 */ Stop_I2c()。 s++。 /*啟動總線 */ SendByte(sla)。 /*啟動總線 */ SendByte(sla)。 _Nop()。 } /******************************************************************** 應(yīng)答子函數(shù) 原型 : void Ack_I2c(bit a)。 retc=retc1。 /*置時鐘線為低,準備接收數(shù)據(jù)位 */ _Nop()。 } /******************************************************************* 字 節(jié)數(shù)據(jù)傳送函數(shù) 內(nèi)蒙古科技大學(xué) 信息工程學(xué)院實訓(xùn)報告 13 ********************************************************************/ uchar RcvByte() { uchar retc。 _Nop()。 _Nop()。0x80)SDA=1。 /*發(fā)送 I2C總線結(jié)束信號 */ _Nop()。 /*發(fā)送結(jié)束條件的數(shù)據(jù)信號 */ _Nop()。 /* 起始條件鎖定時間大于 4μ s*/ _Nop()。 SCL=1。 /*應(yīng)答標志位 */ uchar g。 /*顯示緩沖區(qū) */ uchar temper[2]。 用戶按下某個鍵時, ZLG7290 的 INT 引腳會產(chǎn)生一個低電平的中斷請求信號,讀取鍵值后,中斷信號就會自動撤銷。其實中斷可以根據(jù)自己所選的中斷而定。 ZLG7290 芯片 ZLG7290 作用及其功能介紹 ZLG7290 能夠直接驅(qū)動 8 位共陰式數(shù)碼管(或 64 只獨立的 LED),同時還可以掃描管理多達 64 只按鍵。 表 2 一部分溫度對應(yīng)值表 溫度 /℃ 二進制表示 十六進制表示 +125 0000 0111 1101 0000 07D0H +85 0000 0101 0101 0000 0550H + 0000 0001 1001 0000 0191H + 0000 0000 1010 0001 00A2H + 0000 0000 0000 0010 0008H 0 0000 0000 0000 1000 0000H 1111 1111 1111 0000 FFF8H 1111 1111 0101 1110 FF5EH 1111 1110 0110 1111 FE6FH 55 1111 1100 1001 0000 FC90H 另外,由于 DS18B20 單線通信功能是分時完成的,它有嚴格的時隙概念,因此讀寫時序很重要。因此,可用多只 DS18B20同時測量溫度并進行報警搜索。第9字節(jié)讀出前面所有8字節(jié)的 CRC碼,可用來檢驗數(shù)據(jù),從而保證通信數(shù)據(jù)的正確性。頭2個字節(jié)包含測得的溫度信息,第3和第4字節(jié)TH和TL的拷貝,是易失的,每次上電復(fù)位時被刷新。 主要原理 系統(tǒng)整體硬件電路包 括,傳感器采集電路,溫度顯示電路,單片機主板電路等。 關(guān)鍵詞: 溫度、傳感器、 yeelink、物 聯(lián)網(wǎng)、遠程采集 內(nèi)蒙古科技大學(xué) 信息工程學(xué)院實訓(xùn)報告 III Abstract With the rapid development of the Inter, many new industries emerged and flourished, it is in this wave of Inter of things platform emerge as the times require Yeelink. Yeelink is the universal substance an open work platform, mainly to provide sensor data access, storage and display services, open source software and hardware enthusiasts, all manufacturing enterprises, to provide a IOT project platform. The hardware and the manufacturer cannot care about server implementation details and operation, capability of electronic products have a IOT of delivery. The biggest characteristic of Yeelink platform, is not only to provide uplink data, also can realize the control function of household electrical appliances, want to wash a hot bath es before, or to turn on the air conditioner in advance? Very simple, intelligent mobile phone App, these are to lift a finger. Say simply, is that we can put your collected data submitted to the Yeelink, and the Yeelink will be displayed in a certain form. For example, we collect temperature data, and then submitted to go up, so, whether you are in where, as long as you can access the Inter, you can monitor realtime temperature value. This training contents is through digital temperature sensor will be realtime collection of temperature in the digital tube display, and send it to PC through the serial port, PC posted to the Inter through Yeelink serial port forwarding tool. Keys: Temperature Sensor Yeelink Fetishism Remote monitoring 內(nèi)蒙古科技大學(xué) 信息工程學(xué)院實訓(xùn)報告 1 目錄 實訓(xùn)任務(wù)書 .................................................................................................................................I 摘 要 ....................................................................................................................................... II Abstract ..................................................................................................................................... III 硬件電路 ..................................................................................................................... 2 背景知識 ........................................................................................................... 2 課題介紹 ........................................................................................................... 2 主要原理 .............