求大神指教,初学51C程序。帮我看下该怎么改。我用的位移来改变数码管的移动。
#define uchar unsigned char
#define uint unsigned int
sbit wela=P2^7;
sbit dula=P2^3;
void delay(uint ms)
{
uint z,y;
while(ms--)
{
for(z=y;y>0;z--)
for(y=0;y>120;y++);
}
}
void main()
{
uchar z;
wela=1;
P0=0XC0;
wela=0;
while(1)
{
dula=0x3f;
for(z=0;z<4;z++)
{
dula=1;
P0=0x5b;
dula=0;
delay(250);
P0=P0>>2;
}
dula=0x5b;
for(z=0;z<4;z++)
{
dula=1;
dula=0x66;
dula=0;
delay(250);
for(z=0;z<4;z++);
P0=P0>>2;
}
}
}
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit wela=P2^7;
sbit dula=P2^3;
void delay(uint ms)
{
uint z,y;
while(ms--)
{
for(z=y;y>0;z--)
for(y=0;y>120;y++);
}
}
void main()
{
uchar z;
wela=1;
P0=0XC0;
wela=0;
while(1)
{
dula=0x3f;
for(z=0;z<4;z++)
{
dula=1;
P0=0x5b;
dula=0;
delay(250);
P0=P0>>2;
}
dula=0x5b;
for(z=0;z<4;z++)
{
dula=1;
dula=0x66;
dula=0;
delay(250);
for(z=0;z<4;z++);
P0=P0>>2;
}
}
}