可以帮忙看看这个程序的错误吗!拜托了,真的找不出了,14个错误,谢谢!!!
#include<reg52.h>
#define unchar unsigned char
#define unint unsigned int
#define SW1 0x2e
#define SW2 0x2d
#define SW3 0x2b
#define SW4 0x27
#define SW5 0x0f
#define ZHENGZHUAN 0
#define FANZHUAN 1
#define TINGZHI 2
#define JIASU 3
#define JIANSU 4
unsigned char code dispcode[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xal,0x84,0xff,0xf7};
unsigned char dispbitcode[]={0x7f,0xbf,0xdf,0xef};
unsigned char dispbuf[4]={0,0,0,0};
unsigned char dispbitcnt;
unint i;
unchar tp=0;
unint count=0;
unint n=0;
unint xs;
unint m;
unchar keyvalue;
sbit p07=P0^7;
sbit p30=P3^0;
sbit p31=P3^1;
sbit p37=P3^7;
sbit p10=P1^0;
sbit p11=P1^1;
sbit p12=P1^2;
sbit p13=P1^3;
sbit p15=P1^5;
void ledshow();
unsigned char keyscan()
void zhengzhuan();
void fanzhuan();
void tingzhi();
void jiasu();
void jiansu();
void t0(void);
void INT_0(void);
void Timer_1(void);
void main(void);
{
P30=1;
P31=0;
TMOD=0x12;
THO=0x66;
TLO=0x50;
EA=1;
ET0=1;
ET1=1;
TR0=1;
TR1=1;
IT0=1;
EX0=1;
while(1)
{
ledshow();
keyvalue=keyscan();
switch(keyvalue);
{
case ZHENGZHUAN:
zhengzhuan();
break;
case FANZHUAN:
fanzhuan();
break;
case TINGZHI:
tingzhi();
break;
case JIASU:
jiasu();
break;
case JIANSU:
jiansu();
break;
default:break;
}
}
}
void delay()
{
unsigned char i,j;
for (i=1;i<=125;i++)
for (j=1;j<=50;j++)
{}
]
unsigned char keyscan()
{
unchar temp=0;
P1=0xff;
if((P1&0x2f)!=0x2f)
{
delay();
if((P1&0x2f)!=0x2f)
{
temp=P1&0x2f)!
switch (temp)
{
case SW1:
return 0;
break;
case SW2:
return 1;
break;
case SW3:
return 2;
break;
case SW4:
return 3;
break;
case SW5:
return 4;
break;
default:break;
}
}
}
while((P1&0x2f)!=0x2f);
}
void ledshow()
{
P2|0xf0;
P0=dispcode[dispbuf[0]];
P2=0xef;
for(i=0;i<700;i++);
P2|0xf0;
P0=dispcode[dispbuf[1]];
P2=0xdf;
p07=0;
for(i=0;i<700;i++);
P2|0xf0;
P0=dispcode[dispbuf[2]];
P2=0xbf;
for(i=0;i<700;i++);
P2|0xf0;
P0=dispcode[dispbuf[3]];
P2=0x7f;
for(i=0;i<700;i++);
disbuf[3]=xs/1000;
dispuf[2]=(xs%1000)/100;
dispuf[1]=(xs%100)/10;
dispuf[0]=xs%10;
}
void t0(void)interrupt 1 using 0
{
if (count>100)
count=0;
if(count>tp)
P37=0;
else P37=1;
count++;
}
void INT_0(void) interrupt 0
{
EX1=0;
n++;
EX1=1;
}
void Timer_1(void) interrupt 3
{
TH1=0x65;
TL1=0xF3;
m++;
if(m==20)//50*20=1S
{
xs=(n*10)/4;
m=0;
n=0;
}
}
void zhengzhuan()
{
P30=0;
P31=1;
}
void tingzhi()
{
P30=0;
P31=0;
}
void jiasu()
{
if(tp>99)
tp=100;
else tp=tp+2;
}
void jiansu()
tp=0;
else tp=tp-2;
}
|