缘由Proteus 8 7SEG-MPX6-CA不亮-嵌入式-CSDN问答
cpp
#include "reg52.h"
unsigned char code SmZiFu[]={63,6,91,79,102,109,125,7,127,111,128};//0-9.
unsigned char code HELLO[]={118,121,56,56,63,0};//字符
void smxs(unsigned char mz, unsigned char w)
{
unsigned char xd=0;
P0=~0;
P0=~HELLO[mz];
P2=w;
while(++xd);
}
void main()
{
unsigned char ys=0,ys1=0,x=0;
while(1)
{
smxs((x<5?x:5),1);
smxs((x+1<5?x+1:5),2);
smxs((x+2<5?x+2:5),4);
smxs((x+3<5?x+3:5),8);
if(++ys==0)
{
if(++x>5)x=0;
}
}
}

cpp
#include "reg52.h"
unsigned char code HELLO[]={118,121,56,56,63,0};//字符
void smxs(unsigned char mz, unsigned char w)
{
unsigned char xd=0;
P0=~0;
P0=~HELLO[mz];
P2=w;
while(++xd);
}
void main()
{
unsigned char ys=0,x=0;
while(1)
{
smxs((x>3&&x<6?x-4:x>5&&x<9?x-4:5),1);
smxs((x>2&&x<6?x-3:x>5&&x<9?x-3:5),2);
smxs((x>1&&x<6?x-2:x>5&&x<9?x-2:5),4);
smxs((x>0&&x<6?x-1:x>5&&x<9?x-1:5),8);
if(++ys==0)
{
if(++x>9)x=0;
}
}
}
