#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit r1=P2^0;
sbit r2=P2^1;
void delay(uchar x);
void boma(uchar ba);
unsigned char shuma[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0XD8,0x80,0x90};
main()
{
r1=0,r2=0;
P0=0xc0;
while(1)
{ uchar p2,p3;
uint i=500;
while(i--)
{
boma(p2);
}
while(i--)
{
boma(p3);
}
}
}
void boma(uchar ba)
{
P0=shuma[ba%100];
delay(3);
P0=0xff;
}
void delay(uchar x)
{
unsigned char a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);
}
-
这是仿真
还不行呀
uint i=500;
while(i--)
{
boma(p1);
}
while(i--)
{
boma(p3);
}
一周热门 更多>