|
#include <reg51.h>
sbit p1_0=P1^0;
sbit p1_1=P1^1;
sbit p1_2=P1^2;
sbit p1_3=P1^3;
sbit p1_4=P1^4;
sbit p1_5=P1^5;
sbit p1_6=P1^6;
sbit p1_7=P1^7;
sbit p3_2=P3^2;
sbit p3_1=P3^1;
sbit P3_7=P3^7;int i;
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char count=0;
void delay(unsigned int t)
{
unsigned char n;
for(;t>0;t--)
for(n=0;n<125;n++)
{;}
}
main(){
P0=P2=table[0];
while(1){
if(p3_2==0){
p1_0=0;
delay(500);
p1_0=1;
p1_1=0;
delay(500);
p1_1=1;
p1_2=0;
delay(500);
p1_2=1;
p1_3=0;
delay(500);
p1_3=1;
p1_4=0;
delay(500);
p1_4=1;
p1_5=0;
delay(500);
p1_5=1;
p1_6=0;
delay(500);
p1_6=1;
p1_7=0;
delay(500);
p1_7=1;}
if(p3_1==0){
p1_0=0;
delay(1000);
p1_0=1;
p1_1=0;
delay(1000);
p1_1=1;
p1_2=0;
delay(1000);
p1_2=1;
p1_3=0;
delay(1000);
p1_3=1;
p1_4=0;
delay(1000);
p1_4=1;
p1_5=0;
delay(1000);
p1_5=1;
p1_6=0;
delay(1000);
p1_6=1;
p1_7=0;
delay(1000);
p1_7=1;}
if(P3_7==0){count=0;
P0=table[count/10];
P2=table[count%10];
for(i=0;i<98;i++)
{count++;
delay(1000);
P0=table[count/10];
P2=table[count%10];
if(P3_7==0){
P0=table[count/10];
P2=table[count%10];
while(P3_7==0){;}
break;}
}
}
}}
|
-
-
123.rar
883 Bytes, 下载次数: 5, 下载积分: 黑币 -5
|