重点资料照明用led多功能智能调光电路_第1页
重点资料照明用led多功能智能调光电路_第2页
重点资料照明用led多功能智能调光电路_第3页
重点资料照明用led多功能智能调光电路_第4页
重点资料照明用led多功能智能调光电路_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、电路图电路功能:1.     实现三个LED灯的十个不同亮度等级的调光,光强等级在数码管上显示出来;2.     三个LED灯的调光方式可以有自动调光、手动调光和根据外部光强自动调光;3.     本电路还可以进一步成为开发LED灯的更多功能的实验电路。 驱动程序:#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;/数码管显示段码uchar m,k,l;int a=

3、5,b;void maichong();void delaynms(uint x);/nms延时程序void ad0809();/芯片启动程序main()/*自动调光程序*/  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、;       /*手动调光程序*/     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);               /*外动调光程序&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

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个时钟周期       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_();    /等待转换结束此时继续给脉冲           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;/数据有效    _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等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论