我有一个错误的代码在爱特梅尔工作室 错误是:expected ')' before numeric
这里是我的代码(我用这个作为atmega32a键盘码):AVR编程
#include <util/delay.h>
#define c1 PINB 4
#define c2 PINB 5
#define c3 PINB 6
#define c4 PINB 7
unsigned char scan[4]={0XFE,0XFD,0XFB,0XF7};
unsigned char arrkey[16]={1,2,3,20,4,5,6,30,7,8,9,40,10,0,11,50};
unsigned char keypad() {
unsigned char r,c,k;
DDRB=0X0F;
PORTB=0XFF;
while(1) {
for (r=0; r<4; r++) {
c=4;
PORTB=scan[r];
_delay_us(10);
if(c1 == 0) c=0;
if(c2 == 0) c=1;
if(c3 == 0) c=2;
if(c4 == 0) c=3;
if (!(c==4)) {
k=arrkey[(r*4)+c];
while(c1==0);
while(c2==0);
while(c3==0);
while(c4==0);
_delay_ms(50);
return k;
}
}
}
}
你能正确地缩进你的程序:
四个宏,以便可以如下定义? – ouah 2015-01-04 12:52:41
在哪一行发生此错误? – ezaquarii 2015-01-04 14:07:01
如果只有一条语句的代码 – 2015-01-04 14:49:38