(重点资料)照明用led多功能智能调光电路电路图电路功能:,光强等级在数码管上显示出来;、手动调光和根据外部光强自动调光;。驱动程序:#include<>#defineucharunsignedchar#defineuintunsignedint#include<>sbitst=P3^0;sbitoe=P3^5;sbiteoc=P3^1;sbitup=P3^2;sbitdown=P3^3;sbitclk=P3^4;sbitzd=P1^7;sbitsd=P1^5;sbitwd=P1^6;sbitred=P1^0;sbitgreen=P1^1;sbitblue=P1^2;ucharcodetab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x80,0x39,0x5e,0x79,0x71,0x00,0xf3,0x76,0x80,0x40};//数码管显示段码ucharm,k,l;inta=5,b;voidmaichong();voiddelaynms(uintx);//nms延时程序voidad0809();//芯片启动程序main(){/*************自动调光程序********************/while(!zd){uinta,b;ucharc,d;for(a=0;a<10;a++){if(!zd){for(c=20000;c>0;c--){for(d=10;d>0;d--){red=1;green=1;blue=1;P0=codetab[a];delaynms(a);b=10-a;red=0;green=0;blue=0;delaynms(b);}}}}for(a=9;a>0;a--){if(!zd){for(c=20000;c>0;c--){for(d=10;d>0;d--){red=1;green=1;blue=1;P0=codetab[a];delaynms(a);b=10-a;red=0;green=0;blue=0;delaynms(b);}}}}}/**********************手动调光程序**********************/while(!sd){EA=1;EX0=1;EX1=1;IT0=0;IT1=0;a=5;while(!sd){P0=codetab[a];red=1;green=1;blue=1;delaynms(a);red=0;green=0;blue=0;delaynms(10-a);}}/*******************************外动调光程序&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&/while(!wd){intm,i,shu,x;while(!wd){clk=0;st=0;oe=0;eoc=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();clk=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();clk=0;st=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();clk=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();clk=0;st=0;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();clk=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();for(i=8;i--;i>0)//0~8个时钟周期{clk=0;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();clk=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();}clk=0;_nop_();_nop_();_nop_();_nop_();_nop_();_
(重点资料)照明用led多功能智能调光电路 来自淘豆网www.taodocs.com转载请标明出处.