|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
一个电子密码锁程序,有个语法错误,好奇怪啊
我找了一个电子密码锁程序,开始有18个错误,我改剩到了一个,说是语法错误,我不知道错在那里!求高人指点一下(网上的电子密码锁程序都有问题,小猫弄好后定将原理图和程序公开!)谢谢了,错误处在void t0(void) interrupt 1 using 0 语法错误??
整个程序如下:#include <AT89X52.H>
#include<intrins.h>
#include<math.h>
unsigned char code ps[]={1,2,3,4,5};
unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x40};
unsigned char pslen=9;
unsigned char templen;
unsigned char digit;
unsigned char funcount;
unsigned char digitcount;
unsigned char psbuf[9];
bit cmpflag;
bit hibitflag;
bit errorflag;
bit rightflag;
unsigned int second3;
unsigned int aa;
unsigned int bb;
bit alarmflag;
bit exchangeflag;
unsigned int cc;
unsigned int dd;
bit okflag;
unsigned char oka;
unsigned char okb;
void main(void)
{
unsigned char i,j;
P1=dispcode[digitcount];
TMOD=0x01;
TH0=(65536-500)/256;
TL0=(65536-500)%256;
TR0=1;
ET0=1;
EA=1;
while(1)
{
if(cmpflag==0)
{
if(P3_6==0) //function key
{
for(i=10;i>0;i--)
for(j=248;j>0;j--);
if(P3_6==0)
{
if(hibitflag==0)
{
funcount++;
if(funcount==pslen+2)
{
funcount=0;
cmpflag=1;
}
P1=dispcode[funcount];
}
else
{
second3=0;
}
while(P3_6==0);
}
}
if(P3_7==0) //digit key
{
for(i=10;i>0;i--)
for(j=248;j>0;j--);
if(P3_7==0)
{
if(hibitflag==0)
{
digitcount++;
if(digitcount==10)
{
digitcount=0;
}
P2=dispcode[digitcount];
if(funcount==1)
{
pslen=digitcount;
templen=pslen;
}
else if(funcount>1)
{
psbuf[funcount-2]=digitcount;
}
}
else
{
second3=0;
}
while(P3_7==0);
}
}
}
else
{
cmpflag=0;
for(i=0;i<pslen;i++)
{
if(ps!=psbuf)
{
hibitflag=1;
i=pslen;
errorflag=1;
rightflag=0;
cmpflag=0;
second3=0;
goto a;
}
}
cc=0;
errorflag=0;
rightflag=1;
hibitflag=0;
a:
cmpflag=0;
}
}
void t0(void) interrupt 1 using 0
{TH0=(65536-500)/256;
TL0=(65536-500)%256;
if((errorflag==1) && (rightflag==0))A
{
bb++;
if(bb==800)
{
bb=0;
alarmflag=~alarmflag;
}
if(alarmflag==1)
{
P0_0=~P0_0;
}
aa++;
if(aa==800)
{
aa=0;
P0_1=~P0_1;
}
second3++;
if(second3==6400)
{
second3=0;
hibitflag=0;
errorflag=0;
rightflag=0;
cmpflag=0;
P0_1=1;
alarmflag=0;
bb=0;
aa=0;
}
}
if((errorflag==0) && (rightflag==1))
{
P0_1=0;
cc++;
if(cc<1000)
{
okflag=1;
}
else if(cc<2000)
{
okflag=0;
}
else
{
errorflag=0;
rightflag=0;
hibitflag=0;
cmpflag=0;
P0_1=1;
cc=0;
oka=0;
okb=0;
okflag=0;
P0_0=1;
}
if(okflag==1)
{
oka++;
if(oka==2)
{
oka=0;
P0_0=~P0_0;
}
}
else
{
okb++;
if(okb==3)
{
okb=0;
P0_0=~P0_0;
}
}
}
} |
|