各位老师:这是我第一个用C编写的程序:依次点亮接在P1口上的LED,并无限循环,程序是书中抄来的,我感觉也是正确的,但编译没通过,不知是什么原因? #include "reg51.h" void main() { data unsigned char ledbuff; for(;;){ ledbuff=0x01;P1=ledbuff; delay(1000); ledbuff=0x02;P1=ledbuff; delay(1000); ledbuff=0x04;P1=ledbuff; delay(1000); ledbuff=0x08;P1=ledbuff; delay(1000); ledbuff=0x10;P1=ledbuff; delay(1000); ledbuff=0x20;P1=ledbuff; delay(1000); ledbuff=0x40;P1=ledbuff; delay(1000); ledbuff=0x80;P1=ledbuff; delay(1000); } } void delay(x) unsigned int x; { if (x==0) return; while(x!=0) x--; }
编译提示信息: MYPOJECT.C(7): Warning C206:'delay':missing fuction-prototype MYPOJECT.C(7): error C267:'delay':requires ANSI-style prototype MYPOJECT.C(26): error C231:'-delay':redefinition |