




已閱讀5頁,還剩69頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
第一節(jié)電路圖和PCB 一 系統(tǒng)構(gòu)成1 溫度濕度采集控制電路2 集中顯示電路控制溫濕度采集控制電路二 溫度濕度采集控制電路溫度傳感器1 模擬接口2 數(shù)字接口18b20 三 集中顯示電路控制溫濕度采集控制電路1 鍵盤和數(shù)碼管顯示72792 單片機主控控制電路3 485通信 一 溫度濕度采集控制電路程序 main c主程序 含繼電器控制rs232 c rs232 h 485通信程序ds18b20 c ds18b20 h 溫度濕度采集程序 第二節(jié)器件介紹和C51編程 includevoidrelay control void externvoiddelay unsignedchar externvoidread tmp void externvoidread tmp 1 void externvoidread tmp 2 void externvoidread tmp 3 void sbitr control P3 5 sbitled P3 3 sbitptt P1 4 voidrev ptt void voidsend ptt void externunsignedchardata main c externunsignedchardatasenddata 16 externunsignedchardatarevdata 8 externunsignedchardata psenddata externunsignedchardata prevdata externunsignedchardatatmp l 4 externunsignedchardatatmp h 4 unsignedcharcodeme address 0 x81 unsignedcharcodetemp table l 21 33 31 30 28 28 28 28 25 25 25 25 25 25 25 21 21 21 21 21 21 21 unsignedcharcodetemp table h 21 35 33 32 30 30 30 30 28 28 28 28 28 28 28 27 27 27 27 27 27 27 unsignedchardatatemp time 20 unsignedinttmp v unsignedinttest time 0 externbitrev ok main ptt 0 TMOD 0 x20 TL1 0 xf4 TH1 0 xf4 SCON 0 x50 PCON 0 x00 TR1 1 ES 1 EA 1 led 0 prevdata revdata psenddata senddata while 1 read tmp read tmp 1 read tmp 2 read tmp 3 senddata 4 me address relay control if r control senddata 13 0 xaa elsesenddata 13 0 x00 if rev ok rev ok 0 delay 1 ptt 1 delay 1 TI 1 voidrelay control void tmp v tmp h 0 二 集中顯示電路控制程序 main c主程序rs232 c rs232 h 485通信程序7279 C 7279 h 鍵盤程序ds1302 c ds1302 h 時鐘程序24c64 c 24c64 h EEROM程序utility htemp h include include include includemain void main init I init ttt2 e read block ttt1 e write block if eromimager 0 0 xff senddata 5 20 else store true 1 senddata 5 eromimager 7 delay 20 main c while 1 v get1302 time precess if cur minute curtime 1 if number1 0 number2 0 key press1 0 key numcancel f2 precess delay 20 f3 precess delay 20 f4 precess delay 9000 voidmain init void hd7279 rst 0 delay 1500 hd7279 rst 1 led 0 psenddata senddata prevdata revdata send byte cmd reset pctime settime v set1302 pctime TMOD 0 x20 TL1 0 xf4 TH1 0 xf4 SCON 0 x50 PCON 0 x00 PS 1 EX0 1 TR1 1 ES 1 EA 1 ptt 1 TI 1 key press 0 v setcharge v get1302 cur second curtime 0 cur minute curtime 1 cur hour curtime 2 cur date curtime 3 cur month curtime 4 cur year curtime 7 delay 10000 key press3 1 unsignedcharh compute unsignedcharn w h unsignedcharn w l unsignedcharw h unsignedcharw l unsignedintt1 t2 unsignedcharsub val temp val t1 int n w h 16 n w l 0625 0 5 10 t2 int w h 16 w l 0 0625 0 5 10 sub val unsignedchar t1 t2 5 0 5 temp val unsignedchar t1 10 if sub val 0 return t h temp val 1 sub val 1 elsereturn 0 三 HD7279A器件介紹及C51編程 pindefinesbitcs P1 5 sbitclk P1 6 sbitdat P1 7 sbitkey P3 2 voidsend byte unsignedcharout byte unsignedchari cs 0 long delay for i 0 i 8 i if out byte unsignedcharreceive byte void unsignedchari in byte dat 1 long delay for i 0 i 8 i clk 1 short delay in byte in byte 2 if dat in byte in byte 0 x01 clk 0 short delay dat 0 return in byte voidwrite7279 unsignedcharcmd unsignedchardta send byte cmd send byte dta unsignedcharread7279 unsignedcharcommand send byte command return receive byte voidlong delay void unsignedchari for i 0 i 0 x10 i voidshort delay void unsignedchari for i 0 i 4 i voiddisplay uh tmp unsignedchars unsignedcharr inta b c unsignedchars1 c int s 16 r 0 0625 0 5 10 a int c 100 b int c a 100 10 s1 c a 100 b 10 b b 0 x80 write7279 0 x88 0 xff write7279 0 xcc 0 x0c write7279 0 x87 s1 write7279 0 x86 b write7279 0 x85 a voiddisplay d tmp unsignedchars unsignedcharr inta b c unsignedchars1 c s 16 r 0 0625 0 5 10 a int c 100 b int c a 100 10 s1 c a 100 b 10 b b 0 x80 write7279 0 xc8 0 x0b write7279 0 x83 s1 write7279 0 x82 b write7279 0 x81 a voidservice int0 void interrupt0 鍵盤中斷 readkey board voidreadkey board void 按鍵程序 unsignedcharkey r number if key key r number read7279 cmd read while key cur minute curtime 1 switch key r number case6 f1 key f1 break case38 f2 key f2 break case7 f3 key f3 break case39 f4 key f4 break case14 1 key num0 9 1 break case22 2 key num0 9 2 break case30 3 key num0 9 3 break case46 4 key num0 9 4 break case54 5 key num0 9 5 break case62 6 key num0 9 6 break case15 7 key num0 9 7 break case23 8 key num0 9 8 break case31 9 key num0 9 9 break case55 0 key num0 9 1 break case63 ok key numok break case47 cancel key numcancel break case255 break default break return 四 18b20及C51編程 ds18b20 c include include includevoiddelay unsignedchartime unsignedchars for s 0 s time s first18b20voidwrite bit unsignedcharbitval EA 0 DQ 0 nop nop if bitval 1 DQ 1 EA 1 delay 5 DQ 1 unsignedcharow reset void unsignedcharpresence DQ 0 delay 120 DQ 1 delay 10 presence DQ delay 20 return presence unsignedcharread byte void unsignedchari unsignedcharii 0 unsignedcharvalue 0 for i 0 i 8 i if read bit ii 0 x01 i value ii delay 5 return value bitread bit void bitdat EA 0 DQ 0 nop nop nop DQ 1 nop nop nop nop nop nop nop dat DQ EA 1 delay 5 return dat voidwrite byte unsignedcharval unsignedchari unsignedchartemp for i 0 i i temp voidread tmp void unsignedinta b temp ow reset write byte 0 xcc write byte 0 x44 delay 20 temp ow reset write byte 0 xcc write byte 0 xbe delay 20 tmp l 0 read byte tmp h 0 read byte include functiondefinevoiddelay unsignedchar first18b20voidwrite bit unsignedchar unsignedcharow reset void unsignedcharread byte void bitread bit void voidwrite byte unsignedchar voidread tmp void sbitDQ P1 0 ds18b20 h unsignedchardatatmp l 4 unsignedchardatatmp h 4 unsignedchardatatemp unsignedchardatatmp 0 unsignedchardataz 8 sbitled P3 3 sbitz1 P1 5 第三節(jié)12864M介紹和GAL邏輯 了解12864M液晶 理解單片機總線時序及12864M液晶接口時序?qū)W會使用GAL進行接口邏輯的編程及應(yīng)用 modulewstitle ADDRESSENCODEdesigner YXMVER1 002003 9 01 wsdevice P22V10 ALE WR RD A8 A9 A10 A11 A12 A13 A14 A15pin1 2 3 4 5 6 7 8 9 10 11 EOC CSRAM CS0 CS1 CS2 CS3 CS4 CS5 ADALE ADOE INT0pin13 14 15 16 17 18 19 20 21 22 23 equationsCSRAM A15 CS0 WR A14 A13 A12 A15 CS1 WR A14 A13 A12 A15 CS2 WR A14 A13 A12 A15 CS3 WR A14 A13 A12 A15 CS4 RD A14 A13 A12 A15 CS5 RD A14 A13 A12 A15 ADALE WRendws
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025企業(yè)勞動合同書模板
- 2025中級會計實務(wù)預(yù)習(xí)知識考點:合同收入確認
- 2025兼職國慶節(jié)臨時工合同范文
- 2025年房地產(chǎn)經(jīng)紀人之業(yè)務(wù)操作過關(guān)檢測試卷B卷附答案
- 2025年執(zhí)業(yè)藥師之中藥學(xué)專業(yè)一題庫練習(xí)試卷B卷附答案
- 2025辦公室裝修設(shè)計合同范本2
- 林業(yè)機械節(jié)能減排技術(shù)考核試卷
- 肥料在農(nóng)業(yè)產(chǎn)業(yè)鏈優(yōu)化中的地位考核試卷
- 航空航天器星載紅外探測器技術(shù)考核試卷
- 石棉制品在戶外燒烤設(shè)備的防火考核試卷
- (廣東二模)2025年廣東省高三高考模擬測試(二)語文試卷(含答案解析)
- SL631水利水電工程單元工程施工質(zhì)量驗收標準第3部分:地基處理與基礎(chǔ)工程
- 新22J01 工程做法圖集
- GB/T 5013.5-2008額定電壓450/750V及以下橡皮絕緣電纜第5部分:電梯電纜
- GB/T 26519.1-2021工業(yè)過硫酸鹽第1部分:工業(yè)過硫酸鈉
- GB/T 2440-2017尿素
- GB/T 17166-2019能源審計技術(shù)通則
- 充電設(shè)施安全風(fēng)險辨識清單
- 鈣與維生素D的補充教案課件
- 中國胸痛中心建設(shè)流程及認證標準解讀課件
- DB44-T 1661-2021《河道管理范圍內(nèi)建設(shè)項目技術(shù)規(guī)程》-(高清現(xiàn)行)
評論
0/150
提交評論