#include<reg51.h>
#define A P0
#include<intrins.h>
unsigned int c,flag;
void
timer0() interrupt1;
void delay(unsigned int t);
void main()
{
char ls[]={0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
while(1)
{
char i;
for(i=0;i<9;i++)
{
A=ls[i];
delay(1000);
A=_cror_(A,1);
}
for(i=7;i>0;i--)
{
A=ls[i];
delay(1000);
A=_crol_(A,1);
}
}
}
void timer0() interrupt1
{
c--;
if(c==0)
flag=1;
}
void delay(unsigned int t)
{
TMOD=0x01;
TR0=1;
EA=1;
ET0=1;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
c=t;
flag=0;
while(flag==0);
}
还是不行啊
Build target 'Target 1'
compiling 定时器延时.c...
定时器延时.C(32): error C132: 'interrupt1': not in formal parameter list
定时器延时.C(32): error C141: syntax error near '{'
定时器延时.C(33): error C132: 'c': not in formal parameter list
定时器延时.C(35): error C244: 'flag': can't initialize, bad type or class
定时器延时.C(35): error C132: 'flag': not in formal parameter list
定时器延时.C(36): error C141: syntax error near '}'
Target not created
一周热门 更多>