数码管动态显示01234567
原理图如下:
程序如下:
#include
#define uint unsigned int
#define uchar unsigned char
//共阳数码管段码表0-F
uchar code smg_dw[]={
0xc0,0xf9,0xa4,0xb0,
0x99,0x92,0x82,0xf8,
0x80,0x90,0x88,0x83,
0xc6,0xa1,0x86,0x8e};
//数码管段位码表0-F
//uchar code smg_wm[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; //显示01234567
uchar code smg_wm[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};//显示76543210
void delay_ms(uint); //延时子函数声明
void main()
{
uchar i;
while(1)
{
for(i=0;i