【正文】
b2second)。 else led2en=0。 //掃描故障信號 } } }25。 else led1en=0。 else if(k3num==3) dispswitch(a3hour,a3minute,a3second)。 } } } dir2=1。0x07) { case 0: countb=1。 break。 //關(guān)計(jì)時(shí)1 led1switch=1。 alarmspeaker=0。0口 currentp1=P1。 else disdead(hour,minute,second)。amp。 aihour=0。 if(aihour==24) aihour=0。 TL1=(6553650000)%256。 second++。 } goto out1。 TR0=1。 default: break。 led1switch=1。 else alarmen=0。 break。b1hour,amp。a2second)。 case 1: increase(amp。 case 0xf6:// 顯示切換 key3 k3num++。 break。b2hour,amp。a3second)。 case 2: decrease(amp。minute,amp。 break。 case 3: (*h)。0xfe。 else if (k3num==4) display(b1hour,b1minute,b1second)。 if (temp!=0xfe) { temp1=pc8255。 } } /******************/uchar keyscan () //鍵盤掃描{ uchar temp,temp1。j8。 else pa8255 = table[n]。 } } void disdead1(uchar h,uchar m,uchar s,uchar wei1,uchar wei2) //調(diào)時(shí)熄滅顯示 { uchar n,j,temp=0x80。j++) {pb8255 = temp。 else pa8255 = table[n]。} /*顯示函數(shù)*/ void display(uchar h,uchar m,uchar s) //顯示{ uchar n,j,temp =0x80/*選管最高位*/。 ET1=1。 TH0=(6553650000)/256。 second=0。 //是否全局變量待定uchar ms/*毫秒*/,msd,ms500, second,minute,hour,//時(shí)鐘a1hour,a1minute,a1second,//a燈開燈時(shí)間a2hour,a2minute,a2second, //a燈關(guān)閉時(shí)間a3hour,a3minute,a3second, //a燈燈亮?xí)r長aihour,aiminute,aisecond, //a燈定時(shí)時(shí)間b1hour,b1minute,b1second, //b燈開燈時(shí)間b2hour,b2minute,b2second, //b燈關(guān)燈時(shí)間b3hour,b3minute,b3second, //b燈燈亮?xí)r長bihour,biminute,bisecond, //b燈定時(shí)時(shí)間k2num,// 調(diào)時(shí)開關(guān)k3num,//切換顯示開關(guān)k6num。sbit led1switch=outnum^3。sbit sensor2value=sensorvalue^1。 //p1實(shí)時(shí)信號sbit sunshine=currentp1^0。在系統(tǒng)設(shè)計(jì)過程中,充分利用單片機(jī)的強(qiáng)大功能,力求以方便靈活的軟件編程簡化復(fù)雜難調(diào)的硬件電路,滿足系統(tǒng)設(shè)計(jì)要求。變壓器的作用是將交流市電變換成所需要的交流電壓;整流電路的作用是將交流電變換成單向脈動直流電;濾波電路的作用是將脈動電壓中的脈動成分去掉,輸出比較平滑的直流電壓;穩(wěn)壓電路的作用是使得輸出的直流電壓在電網(wǎng)電壓或負(fù)載電流發(fā)生變化時(shí)保持穩(wěn)定。燈體內(nèi)也沒有松動的部分,這些特點(diǎn)使得LED可以說是不易損壞的。此時(shí)運(yùn)放便形成一個(gè)電壓比較器,其輸出如不是高電平(V+),就是低電平(V或接地)?;谝陨显颍x用了成本較低的方案二。 關(guān)鍵詞:STC89C52RC單片機(jī) LED指示燈 故障報(bào)警 Abstract:The system USES the monolithic STC89C52RC as the core of the system simulation street lamp control. Infrared sensor by electric circuit, photosensitive feedback circuit, keyboard input and digital pipe display circuit, LED lamp circuit structure, voice and LED indicator light buzzer circuit, constant current source circuit. The clock by singlechip microputer system structure, using photoconductive resistance induction external environment light and dark change and detection of LED lights, using state reflecting photoelectric sensor test the way information. Reliable hardware design and optimization software algorithm, and independent keyboard and seven period of digital tube makes street lamp of the control system of the operation is simple, intuitive, system has set up fault alarm function, make this a design more humane. Keyword: STC89C52RC Singlechip LED Indicator Fault alarm1 方案論證與比較 采樣方法選擇光亮檢測方案:方案一:采用光敏二極管感受外屆光照變化,無光照時(shí),有很小的飽和反向漏電流,二極管截止;光照時(shí)反向電流增大,形成光電流。可靠的硬件設(shè)計(jì)和優(yōu)化的軟件算法,以及獨(dú)立鍵盤與七段數(shù)碼管使得路燈控制系統(tǒng)的操作簡單、直觀,系統(tǒng)設(shè)置了故障報(bào)警功能,令本設(shè)計(jì)更加人性化。由于紅外光波長比可見光長,因此受可見光的影響比較小,同時(shí),紅外對管還具有以下優(yōu)點(diǎn):質(zhì)量輕,靈敏度高,線性好,接口電路比較簡單,安裝方便,足夠滿足對本系統(tǒng)中物體檢測的要求。比較器 當(dāng)去掉運(yùn)放的反饋電阻時(shí),或者說反饋電阻趨于無窮大時(shí)(即開環(huán)狀態(tài)),理論上認(rèn)為運(yùn)放的開環(huán)放大倍數(shù)也為無窮大(實(shí)際上是很大,如LM324運(yùn)放開環(huán)放大倍數(shù)為100dB,既10萬倍)。這就是說:。它由電源變壓器、整流電路、濾波電路、穩(wěn)壓電路等4部分組成的。