我用EasyArm2131开发板做单键输入控制实验,按照《ARM微控制器基础与实战》书上P275页程序简单改写了一下,不知为什么编译总出现错误 提示 Error : (Serious) C2282E: expected ')' - inserted before ';' main.c line 33 Error : (Serious) C2282E: expected ')' - inserted before ';' main.c line 33 Error : (Serious) C2304E: <command> expected but found ')' main.c line 33 Error : (Serious) C2282E: expected ')' - inserted before ';' main.c line 35
Error : (Serious) C2282E: expected ')' - inserted before ';' main.c line 35
Error : (Serious) C2304E: <command> expected but found ')' main.c line 35
Error : (Serious) C2282E: expected ')' - inserted before ';' main.c line 38
Error : (Serious) C2282E: expected ')' - inserted before ';' main.c line 38
Error : (Serious) C2304E: <command> expected but found ')' main.c line 38
E:\EasyARM2131\KEYIN-1\src\main.c: 0 warnings, 0 errors, 9 serious errors
#include "config.h"
#define LEDCON 0x00040000; /*P1.18引脚*/ #define KEY 0x00010000; //P0.16引脚
void WaitKey(void) { uint32 i; while(1) { while((IO0PIN&KEY)!=0); //等待按键按下 for(i=0;i<50000;i++); //延时去抖 if((IO0PIN&KEY)==0)break; } while((IO0PIN&KEY)==0); //等待按键放开 }
int main (void) { PINSEL0=0x00000000; PINSEL1=0x00000000; PINSEL2=PINSEL2&(~0x08); IO0DIR=0x00000000; //设置P0口为输入(包括P0.16) IO1DIR=LEDCON; //设置P1.18为输出 控制LED闪烁 while(1) { IO1SET=LEDCON; WaitKey(); IO1CLR=LEDCON; WaitKey(); } return 0; }
|