《单片机实验程序_3.docx》由会员分享,可在线阅读,更多相关《单片机实验程序_3.docx(12页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、单片机实验程序一#include#include#defineucharunsignedcharsbitH1=P36;sbitH2=P37;sbitL1=P05;sbitL2=P06;sbitL3=P07;tab1=0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff;tab2=0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3b,0x37,0x2f,0x1f;tab3=0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe;ta
2、b4=0x1f,0x2f,0x37,0x3b,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f;voidDelay1s()/11.0592MHzunsignedchari,j,k;for(i=10;i0;i-)for(j=200;j0;j-)for(k=250;k0;k-)voiddelay20ms()unsignedchari,j;for(i=100;i0;i-)for(j=60;j0;j-);voidflick()uchard;while(dwhile(1)n=b;y=(n%2);if(y=1)ucharx;for(x=0;x二#include#include
3、#defineucharunsignedcharsbitH1=P36;sbitH2=P37;sbitL1=P05;sbitL2=P06;sbitL3=P07;tab1=0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff;tab2=0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3b,0x37,0x2f,0x1f;tab3=0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe;tab4=0x1f,0x2f,0x37,0x3b,0
4、x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f;voidDelay1s()/11.0592MHzunsignedchari,j,k;for(i=10;i0;i-)for(j=200;j0;j-)for(k=250;k0;k-)voiddelay10ms()unsignedchari,j,k;for(i=5;i0;i-)for(j=4;j0;j-)for(k=248;k0;k-);voidflick()uchard;while(dvoidmain()ucharb,y,n;flick();while(1)n=b;y=(n%2);if(y=1)ucharx;for(x=
5、0;xL3=1;if(!L1|!L2|!L3)delay10ms()if(!L1|!L2|!L3)b+=1;while(!L1|!L2|!L3);三#include#include#defineucharunsignedcharsbitH1=P36;sbitH2=P37;sbitL1=P05;sbitL2=P06;sbitL3=P07;tab1=0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff;tab2=0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3b,0x37,0x2f,0x1f;t
6、ab3=0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe;tab4=0x1f,0x2f,0x37,0x3b,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f;voidDelay1s()/11.0592MHzunsignedchari,j,k;for(i=0;iucharx;for(x=0;x#include#defineucharunsignedcharsbitH1=P36;sbitH2=P37;sbitL1=P05;sbitL2=P06;sbitL3=P07;tab1=0xfe,0xfd,0x
7、fb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff;tab2=0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3b,0x37,0x2f,0x1f;tab3=0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe;tab4=0x1f,0x2f,0x37,0x3b,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f;voidDelay1s()/11.0592MHzunsignedcharh,i,j,k;for(h=0;hif(!
8、L1|!L2|!L3)b+=1;while(!L1|!L2|!L3);if(y=0)ucharx;for(x=0;x#include#defineucharunsignedcharsbitH1=P36;sbitH2=P37;sbitL1=P05;sbitL2=P06;sbitL3=P07;tab1=0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff;tab2=0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3b,0x37,0x2f,0x1f;tab3=0xff,0xff,0xff,0xff,
9、0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe;tab4=0x1f,0x2f,0x37,0x3b,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f;voidDelay1s()/11.0592MHzunsignedcharh,i,j,k;for(h=0;h0;i-)for(j=145;j0;j-);voidflick()uchard;while(dL2=1;L3=1;if(!L1|!L2|!L3)Delay10ms();if(!L1|!L2|!L3)b+=1;while(!L1|!L2|!L3);if(y=0)ucharx;for(x=0;x#include#defineucharunsignedcharsbitH1=P36;sbitH2=P37;sbitL1=P05;sbitL2=P06;sbitL3=P07;