#define F_CPU 4000000UL
#include <avr/io.h>
#include <util/delay.h>
#define INT8U unsigned char
#define INT16U unsigned int
//按键定义
#define K1_DOWN() ((PIND & _BV(PD1)) == 0x00)
#define K2_DOWN() ((PIND & _BV(PD4)) == 0x00)
#define K3_DOWN() ((PIND & _BV(PD7)) == 0x00)
//LED定义
#define LED1_ON() ( PORTC=0B11111110 )
#define LED2_0N() ( PORTC=0B11111101 )
#define LED3_ON() ( PORTC=0B11111011 )
//电机控制端A,B操作定义
#define MA_0() ( PORTC & =~_BV(PB0) )
#define MA_1() ( PORTC | = _BV(PB0) )
#define MB_0() ( PORTC & =~_BV(PB1) )
#define MB_1() ( PORTC | =~_BV(PB1) )
//-----------------------------------------------------------------
// 主程序
//-----------------------------------------------------------------
int main(void)
{
DDRB=0xFF; PORTB=0xFF;
DDRC=0xFF; PORTC=0xFF;
DDRD=0x00; PORTD=0xFF;
LED3_ON();
while(1)
{
if(K1_DOWN())
{
while(K1_DOWN());
LED1_ON();MA_0();MB_1(); /ERROR
}
if(K2_DOWN())
{
while(K2_DOWN());
LED2_ON(); MA_1(); MB_0(); /ERROR
}
if(K3_DOWN())
{
while(K3_DOWN());
LED3_ON(); MA_0(); MB_0(); /ERROR
}
}
}
错误行已标出 大家帮我看看
标出ERROR的是错误的地方