#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit wela=P2^7;
sbit dula=P2^6;
sbit d1=P1^0;
uint code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,0xff,0xff};
uint code table1[]={
0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
void delay(uint z);
void main()
{
EA=1;
EX0=1;
int i,num;
while(1)
{
num=0;
do
{
for(i=0;i<6;i++)
{
wela=1;
P0=table1[i];
wela=0;
dula=1;
P0=table[num];
dula=0;
delay(1000);
num++;
d1=1;
}
}
while(num<16);
}
}
void delay(uint z)
{
int x,y;
for(x=z;x>0;x--)
for(y=100;y>0;y--);
}
void exter0() interrupt 0
{
d1=0;
delay(1000);
}
错误原因:
ZDSY_1.C(22): error C141: syntax error near 'int'
ZDSY_1.C(22): error C202: 'i': undefined iden
tifier
ZDSY_1.C(25): error C202: 'num': undefined identifier
ZDSY_1.C(28): error C202: 'i': undefined identifier
ZDSY_1.C(31): error C202: 'i': undefined identifier
ZDSY_1.C(34): error C202: 'num': undefined identifier
ZDSY_1.C(37): error C202: 'num': undefined identifier
ZDSY_1.C(41): error C202: 'num': undefined identifier
把int i,sum放到main的下面试试
一周热门 更多>