重點(diǎn)資料照明用led多功能智能調(diào)光電路_第1頁
重點(diǎn)資料照明用led多功能智能調(diào)光電路_第2頁
重點(diǎn)資料照明用led多功能智能調(diào)光電路_第3頁
重點(diǎn)資料照明用led多功能智能調(diào)光電路_第4頁
重點(diǎn)資料照明用led多功能智能調(diào)光電路_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、電路圖電路功能:1.     實(shí)現(xiàn)三個(gè)LED燈的十個(gè)不同亮度等級(jí)的調(diào)光,光強(qiáng)等級(jí)在數(shù)碼管上顯示出來;2.     三個(gè)LED燈的調(diào)光方式可以有自動(dòng)調(diào)光、手動(dòng)調(diào)光和根據(jù)外部光強(qiáng)自動(dòng)調(diào)光;3.     本電路還可以進(jìn)一步成為開發(fā)LED燈的更多功能的實(shí)驗(yàn)電路。 驅(qū)動(dòng)程序:#include <at89x51.h>#define uchar unsigned char#define uint unsigned int#include<intrins.h>

2、;sbit st=P30;sbit oe=P35;sbit eoc=P31;sbit up=P32;sbit down=P33;sbit clk=P34;sbit zd=P17;sbit sd=P15;sbit wd=P16;sbit red=P10;sbit green=P11;sbit blue=P12;uchar codetab=0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x80,0x39,0x5e,0x79,0x71,0x00,0xf3,0x76,0x80,0x40;/數(shù)碼管顯示段碼uchar m,k,l;int a=

3、5,b;void maichong();void delaynms(uint x);/nms延時(shí)程序void ad0809();/芯片啟動(dòng)程序main()/*自動(dòng)調(diào)光程序*/  while(!zd)    uint a,b;  uchar c,d;  for(a=0;a<10;a+)                if(!zd)   

4、;    for(c=20000;c>0;c-)       for(d=10;d>0;d-)                      red=1;          green=1;&

5、#160;         blue=1;          P0=codetaba;          delaynms(a);              b=10-a;    

6、      red=0;          green=0;          blue=0;         delaynms(b);             

7、0;                        for(a=9;a>0;a-)                      if(!zd) &

8、#160;    for(c=20000;c>0;c-)        for(d=10;d>0;d-)                             red=1;  

9、                      green=1;                        blue=1;   &

10、#160;      P0=codetaba;          delaynms(a);          b=10-a;                  

11、  red=0;                 green=0;                 blue=0;          delaynms(b);&

12、#160;                                                   

13、;       /*手動(dòng)調(diào)光程序*/     while(!sd)   EA=1;   EX0=1;   EX1=1;   IT0=0;   IT1=0;   a=5;    while(!sd)       

14、    P0=codetaba;      red=1;      green=1;      blue=1;      delaynms(a);      red=0;      green=0;      blue=

15、0;      delaynms(10-a);               /*外動(dòng)調(diào)光程序&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

16、;&&&&&&&&&&&&&&&&&&&&&&&&&&&&/   while(!wd)      int m,i,shu,x;       while(!wd)       c

17、lk=0;   st=0;   oe=0;   eoc=1;   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();         clk=1; 

18、60; _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();     clk=0;   st=1;  

19、0;_nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();         clk=1;   _nop_();   _nop

20、_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();         clk=0;   st=0;   _nop_(); 

21、;  _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();     clk=1;   _nop_();   _nop_();   _nop_(); 

22、60; _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();   _nop_();     for(i=8;i-;i>0) /08個(gè)時(shí)鐘周期       clk=0;   

23、0;_nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();     

24、0;  clk=1;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    

25、_nop_();           clk=0;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_(); 

26、60;  _nop_();      clk=1;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();&#

27、160;   while(!eoc)    clk=0;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    

28、;_nop_();    _nop_();        clk=1;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();  &

29、#160; _nop_();    _nop_();    _nop_();    /等待轉(zhuǎn)換結(jié)束此時(shí)繼續(xù)給脈沖           clk=0;      _nop_();      _nop_();      _nop_();

30、      _nop_();      _nop_();      _nop_();      _nop_();      _nop_();         clk=1;    _nop_();    _nop

31、_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();        clk=0;    oe=1;    _nop_();    _nop_(); &

32、#160;  _nop_();    _nop_();    _nop_();    _nop_();    m=P2;/數(shù)據(jù)有效    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_(); &#

33、160;      clk=1;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();  

34、0;     clk=0;    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();    _nop_();        clk=1;&#

35、160;   oe=0;    _nop_();    _nop_();    _nop_();      clk=0;    _nop_();    _nop_();    _nop_();    _nop_();         

36、60;   shu=(m*2)/51;         for(x=5000;x-;x>0)             P0=codetabshu;     red=1;     green=1;     blue=1;     for(i=shu;i-;i>0)        clk=0;    _nop_();    _nop_();    _nop_(); 

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論