这是源程序
#include <REGX52.H>
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uchar num;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void delay(uint z)
void main()
{
num=0;
tt=0;
TMOD=0x01;
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
EA=1;
ET0=1;
TR0=1;
wela=1;
P0=0xea;
wela=0;
while(1)
{
if(tt==20)
{
tt=0;
P1^0=1;
if(num==16)
num=0;
num++;
dula=1;
P0=table[num];
dula=0;
delay(1000);
}
}
}
void delay(uint z)
{
unit x,y;
for(x=z;x>0;x--)
for(y=110;y>0,=;y--);
}
void exter0() interrupt 1
{
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
t++;
}
这是错误
learn3.c(14): error C132: 'main': not in formal parameter list
learn3.c(14): error C141: syntax error near '{'
learn3.c(15): error C136: 'num': 'void' on variable
learn3.c(15): error C244: 'num': can't initialize, bad type or class
learn3.c(15): error C136: 'num': 'void' on variable
learn3.c(15): error C132: 'num': not in formal parameter list
learn3.c(16): error C244: 'tt': can't initialize, bad type or class
learn3.c(16): error C132: 'tt': not in formal parameter list
learn3.c(17): error C244: 'TMOD': can't initialize, bad type or class
learn3.c(17): error C132: 'TMOD': not in formal parameter list
learn3.c(18): error C244: 'TH0': can't initialize, bad type or class
learn3.c(18): error C132: 'TH0': not in formal parameter list
learn3.c(19): error C244: 'TL0': can't initialize, bad type or class
learn3.c(19): error C132: 'TL0': not in formal parameter list
learn3.c(20): error C244: 'EA': can't initialize, bad type or class
learn3.c(20): error C132: 'EA': not in formal parameter list
learn3.c(21): error C244: 'ET0': can't initialize, bad type or class
learn3.c(21): error C132: 'ET0': not in formal parameter list
learn3.c(22): error C244: 'TR0': can't initialize, bad type or class
learn3.c(22): error C132: 'TR0': not in formal parameter list
learn3.c(23): error C244: 'wela': can't initialize, bad type or class
learn3.c(23): error C132: 'wela': not in formal parameter list
learn3.c(24): error C244: 'P0': can't initialize, bad type or class
learn3.c(24): error C132: 'P0': not in formal parameter list
learn3.c(25): error C244: 'wela': can't initialize, bad type or class
learn3.c(25): error C132: 'wela': not in formal parameter list
learn3.c(26): error C141: syntax error near 'while'
learn3.c(26): error C141: syntax error near '1'
learn3.c(28): error C141: syntax error near '==', expected ')'
learn3.c(30): error C231: 'tt': redefinition
learn3.c(31): error C129: missing ';' before '^'
我死了算了
|