版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
綠色照明系統(tǒng)設(shè)計(jì)摘要本設(shè)計(jì)針對的是教室燈光控制,通過對教室環(huán)境調(diào)查,給出了節(jié)約電能實(shí)現(xiàn)與控制方法,即基于單片機(jī)的綠色照明系統(tǒng)設(shè)計(jì)。該系統(tǒng)以單片機(jī)作為主控制器,采用光敏電阻模塊檢測教室自然光強(qiáng)度,根據(jù)環(huán)境光照強(qiáng)度對燈光進(jìn)行分級控制。采用熱釋紅外傳感器檢測并統(tǒng)計(jì)人數(shù),以此對教室燈具進(jìn)行分組控制,系統(tǒng)再綜合光照強(qiáng)度及室內(nèi)人數(shù)進(jìn)行識別和判斷,從而控制燈具的具體開關(guān)盞數(shù)。系統(tǒng)可以晚上提醒學(xué)生離開教室,定時(shí)對教室燈光進(jìn)行集中管理,其定時(shí)關(guān)燈時(shí)間可根據(jù)具體作息時(shí)間進(jìn)行調(diào)整。在寒暑假等較長假期可以設(shè)定某些月份關(guān)閉照明系統(tǒng)。另外系統(tǒng)通過使用節(jié)能LED,使整個(gè)系統(tǒng)更加節(jié)能。關(guān)鍵詞分組控制,白光LED,定時(shí)控制,傳感器ABSTRACTThisdesignisaimedprimarilyattheclassroomlightingcontrol,classroomenvironmentsurvey,giventheenergysavingsachievedwiththecontrolmethod,whichisbasedonmicrocontrollergreenlightingsystemdesign.Thesystemmicrocontrollerasthemaincontroller,thethephotoresistormoduledetectsclassroomnaturallightintensityaccordingtotheambientlightintensitylightinghierarchicalcontrol.Pyroelectricinfraredsensorstodetectanddeterminethespecificlocationofthepeople,inordertogroupclassroomlightingcontrolsystemandthenintegratedlightintensityandthenumberofindooridentifyandjudge,soastocontrolthelightingswitchlamp.Thesystemcanremindstudentstoleavetheclassroom,regularclassroomlightingforcentralizedmanagement,thetiminglightsareturnedofftimecanbeadjustedaccordingtothespecificworkschedules.Shutdownthelightingsystemcansetsomemonthsinthewinterandsummervacationsandlongerholidays.Inaddition,thesystemthroughtheuseofenergy-efficientLEDtomakethewholesystemmoreenergyefficient.KeyWords:Packetcontrol,ThewhiteLED,Thetimingcontrol,Thesensor目錄TOC\o"1-3"\h\u94871.緒論 附錄電氣原理圖程序#include<reg52.h>#include<string.h>#defineucharunsignedchar#defineuintunsignedintsbitzhuan=P2^0;sbitsound=P2^1;sbitSDA=P1^7;sbitCLK=P1^6;sbitRST=P1^5;sbitRS=P2^5;sbitRW=P2^6;sbitEN=P2^7;sbitk1=P3^4;sbitk2=P3^5;sbitk3=P3^6;sbitk4=P3^7;ucharcodedis_alarm0[]="ALARMMHM";uchardis_alarm1[]="TM:00:00:00"ucharyue=0;ucharshi=0;ucharfen=0;uchartcount=0;ucharmonthdays[]={0,31,0,31,30,31,30,31,31,30,31,30,31};uchar*week[]={"sun","mon","tus","wen","thu","fri","sat"};ucharidatalcd_dis_buffer1[]={"DT:2000-00-00"};ucharidatalcd_dis_buffer2[]={"TM:00:00:00"};uchardatetime[7];ucharadjust_index=-1;ucharchange_flag[]="-MHDM-Y"; voiddelay(uintx){uchari;while(x--)for(i=0;i<120;i++);}voidwrite_to_DS(ucharx){uchari;for(i=0;i<8;i++){ SDA=x&1;CLK=1;CLK=0;x>>=1;}}ucharget_from_DS(){uchari,b,t;for(i=0;i<8;i++){ b>>=1;t=SDA;b|=t<<7;CLK=1;CLK=0;} returnb/16*10+b%16;}ucharread_data(ucharaddr){uchardat;RST=0;CLK=0;RST=1;write_to_DS(addr);dat=get_from_DS();CLK=1;RST=0;returndat;}voidwrite_DS(ucharaddr,uchardat){ CLK=0;RST=1; write_to_DS(addr); write_to_DS(dat); CLK=0;RST=0;}voidset_DS(){uchari;write_DS(0x8E,0x00);//writecontrol,deleteprotetefor(i=1;i<7;i++){write_DS(0x80+2*i,(datetime[i]/10<<4)|(datetime[i]%10)); } write_DS(0x8E,0x80);//addprotect}voidgettime(){uchari;for(i=0;i<7;i++) { datetime[i]=read_data(0x81+2*i); }}ucharread_lcd_state(){ucharstate;RS=0;RW=1;EN=1;delay(1);state=P0;EN=0;delay(1);returnstate;} voidlcd_busy_wait(){ while((read_lcd_state()&0x80)==0x80); delay(5);}voidwrite_lcd_data(uchardat){lcd_busy_wait();RS=1;RW=0;EN=0;P0=dat;EN=1;delay(1);EN=0;}voidwrite_lcd_cmd(ucharcmd){lcd_busy_wait();RS=0;RW=0;EN=0;P0=cmd;EN=1;delay(1);EN=0;}voidInit_lcd(){write_lcd_cmd(0x38); delay(1);write_lcd_cmd(0x01);delay(1);write_lcd_cmd(0x06); delay(1);write_lcd_cmd(0x0C);delay(1);}voidset_lcd_pos(ucharp){write_lcd_cmd(p|0x80);}voiddis_lcd_string(ucharp,uchar*s){uchari;set_lcd_pos(p);for(i=0;i<16;i++)//16*2 { write_lcd_data(s[i]); delay(1); }}voidalarm_xs(){dis_alarm1[5]=yue/10+'0';dis_alarm1[6]=yue%10+'0';dis_alarm1[8]=shi/10+'0';dis_alarm1[9]=shi%10+'0';dis_alarm1[11]=fen/10+'0';dis_alarm1[12]=fen%10+'0';dis_lcd_string(0x00,dis_alarm0); dis_lcd_string(0x40,dis_alarm1); }voidformat_datetime(uchard,uchar*a){a[0]=d/10+'0';a[1]=d%10+'0';}ucharisleapyear(uinty){return(y%4==0&&y%100!=0||(y%400==0));}voidrefreshweekday(){uinti,d,w=5;for(i=2000;i<2000+datetime[6];i++){ d=isleapyear(i)?366:365; w=(w+d)%7; }d=0;for(i=1;i<datetime[4];i++)d+=monthdays[i];d+=datetime[3];datetime[5]=(w+d)%7+1;}voiddatetime_adjust(ucharx){switch(adjust_index){ case6: if(x==1&&datetime[6]<99)datetime[6]++; if(x==-1&&datetime[6]>0)datetime[6]--; monthdays[2]=isleapyear(2000+datetime[6])?29:28; if(datetime[3]>monthdays[datetime[4]]) datetime[3]=monthdays[datetime[4]]; refreshweekday();//refreshweekday break; case4: if(x==1&&datetime[4]<12)datetime[4]++; if(x==-1&&datetime[4]>1)datetime[4]--; monthdays[2]=isleapyear(2000+datetime[6])?29:28; if(datetime[3]>monthdays[datetime[4]]) datetime[3]=monthdays[datetime[4]]; refreshweekday(); break; case3: monthdays[2]=isleapyear(2000+datetime[6])?29:28; if(x==1&&datetime[3]<monthdays[datetime[4]])datetime[3]++; if(x==-1&&datetime[3]>0)datetime[3]--; refreshweekday();//refreshweekday break; case2: if(x==1&&datetime[2]<23)datetime[2]++; if(x==-1&&datetime[2]>0)datetime[2]--; break; case1: if(x==1&&datetime[1]<59)datetime[1]++; if(x==-1&&datetime[1]>0)datetime[1]--; break;}}voidT0_int()interrupt1{ TH0=-50000/256;TL0=-50000%256;if(++tcount!=2)return; tcount=0;if(zhuan==0){ format_datetime(datetime[6],lcd_dis_buffer1+5);//displayline1,6stposition format_datetime(datetime[4],lcd_dis_buffer1+8); format_datetime(datetime[3],lcd_dis_buffer1+11); strcpy(lcd_dis_buffer1+13,week[datetime[5]-1]);format_datetime(datetime[2],lcd_dis_buffer2+5); format_datetime(datetime[1],lcd_dis_buffer2+8); format_datetime(datetime[0],lcd_dis_buffer2+11); dis_lcd_string(0x00,lcd_dis_buffer1); dis_lcd_string(0x40,lcd_dis_buffer2); }else if(zhuan==1) { alarm_xs(); }}voidEX_int0()interrupt0 {if(k1==0) { if(zhuan==1) {while(k1==0); yue++; if(yue>12)yue=1; } else if(zhuan==0) { while(k1==0); if(adjust_index==-1||adjust_index==1)adjust_index=7; adjust_index--; if(adjust_index==5)adjust_index=4; lcd_dis_buffer2[13]=''; lcd_dis_buffer2[14]=change_flag[adjust_index]; lcd_dis_buffer2[15]=''; }}else if(k2==0) { if(zhuan==1) {while(k2==0); shi++; if(shi>23)shi=0; } else if(zhuan==0) {while(k2==0);datetime_adjust(1);}}Elseif(k3==0){if(zhuan==1) {while(k3==0); fen++; if(fen>59)fen=0; }elseif(zhuan==0) { while(k3==0);datetime_adjust(-1); } } else if(k4==0) { if(zhuan==1) {while(k4==0);yue=0;shi=0;fen=0;} else if(zhuan==0) {while(k4==0); set_DS(); lcd_dis_buffer2[13]=''; lcd_dis_buffer2[14]=''; lcd_dis_buffer2[15]=''; adjust_index=-1;}}}sbitTLC549_DOUT=P1^0;sbitTLC549_CS=P1^1;sbitTLC549_CLK=P1^2;voiddelayus(unsignedchari){ while(--i);}unsignedcharTLC549_ReadByte(void){ unsignedcharvalue=0,i=0; TLC549_DOUT=1; for(i=0;i<8;i++) { if(TLC549_DOUT==1) value|=(0x80>>i); TLC549_CLK=1; TLC549_CLK=0; delayus(50); } returnvalue;}unsignedcharTLC549_GetValue(void){ unsignedcharConvertValue; TLC549_CS=0; ConvertValue=TLC549_ReadByte(); TLC549_CS=1; delayus(50);returnConvertValue;}sbitSW=P1^3;sbitA=P2^2;sbitD=P2^3;sbitC=P2^4;sbitSW1=P1^4;ucharCLASS_STATE,renshu; voidlight_state_judge(){ ucharzrgz_value; zrgz_value=TLC549_GetValue(); if((zrgz_value>150)){SW1=1;SW=1;} elseif((zrgz_value>50)){SW=0;SW1=1;} else{SW=0;SW1=0;} }voidclass_state_judge(){if((datetime[4]==yue)|((datetime[2]>=shi)&&(datetime[1]==fen+5)))CL
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2019湘美版 高中美術(shù) 選擇性必修5 工藝《第二單元 印染工藝》大單元整體教學(xué)設(shè)計(jì)2020課標(biāo)
- 2024屆貴州省平壩縣新啟航教育高三第二次適應(yīng)性(模擬)檢測試題數(shù)學(xué)試題
- 2024屆廣東省重點(diǎn)名校高三下期1月月考數(shù)學(xué)試題
- 餐館服務(wù)員勞務(wù)合同
- 材料供應(yīng)合同協(xié)議
- 病情免責(zé)協(xié)議書
- 北京市勞動合同法實(shí)施細(xì)則全文
- 期末 試題 -2024-2025學(xué)年人教PEP版英語六年級上冊 (含答案)
- 湖北省孝感市漢川市2024-2025學(xué)年九年級上學(xué)期期中歷史試題
- 鋁壓延加工材相關(guān)行業(yè)投資規(guī)劃報(bào)告范本
- 簡歷制作技巧培訓(xùn)
- JGT161-2016 無粘結(jié)預(yù)應(yīng)力鋼絞線
- 高鐵乘務(wù)員職業(yè)規(guī)劃書
- MES項(xiàng)目啟動會模板
- 新版實(shí)驗(yàn)室CNAS認(rèn)可質(zhì)量手冊、程序文件及其記錄表卡
- 企業(yè)發(fā)展面臨問題困難專題調(diào)研報(bào)告范文六篇
- 輸血與血型的教學(xué)設(shè)計(jì)
- 蘇州市2023-2024學(xué)年高一上學(xué)期期中考試化學(xué)試題 試卷及答案
- 新編2020實(shí)驗(yàn)室CNAS認(rèn)可質(zhì)量手冊和程序文件全套轉(zhuǎn)版
- 百貨零售領(lǐng)域:翠微股份企業(yè)組織架構(gòu)及部門職責(zé)
- 《過新年》教學(xué)設(shè)計(jì)
評論
0/150
提交評論