单片机控制数码管显示数字1234

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includereg51.h//unsignedcharcodeliushideng[]=(0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f);/*ledµÆ¹²ÑôĞÍ*/unsignedcharshumaguan[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};/*¹²ÑôĞÍÊıÂë¹Ü*/unsignedchari=0;sbitp20=P2^0;//ÊıÂë¹Üλ¿ØÖƶËsbitp21=P2^1;//ÊıÂë¹Üλ¿ØÖƶËsbitp22=P2^2;//ÊıÂë¹Üλ¿ØÖƶËsbitp23=P2^3;//ÊıÂë¹Üλ¿ØÖƶËvoidyanshi()//ÑÓʱº¯Êı{unsignedintx,y;for(x=0;x10;x++)for(y=0;y20;y++);}voidsmgxs(void)//ÊıÂë¹ÜÏÔʾº¯Êı{p20=1;//¿ªÍ¨Î»1P0=shumaguan[1];//¸³Öµyanshi();//ÑÓʱp20=0;//¹Ø±Õλ1p21=1;//¿ªÍ¨Î»2P0=shumaguan[2];//¸³Öµyanshi();//ÑÓʱp21=0;//¹Ø±Õλ2p22=1;//¿ªÍ¨Î»3P0=shumaguan[3];//¸³Öµyanshi();//ÑÓʱp22=0;//¿ªÍ¨Î»3p23=1;//¿ªÍ¨Î»4P0=shumaguan[4];//¸³Öµyanshi();//ÑÓʱP2=0XF0;//¹Ø±ÕËùÓĞλ}voidmain()/*Ö÷º¯Êı*/{while(1)//·ÀÖ¹³ÌĞòÅÜ·É{smgxs();//ÊıÂë¹ÜÏÔʾ}}

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功