keil5编写的寄存器代码 想要通过按键控制灯亮,但是编译报错少了),想了半天也不知道哪里的问题
RCC_APB2ENR|=(1<<2);//使能PA外设口时钟
RCC_APB2ENR|=(1<<3);//使能PB外设口时钟
RCC_APB2ENR|=(1<<4);//使能PC外设口时钟
//PA0改为上下拉输入模式
GPIO_A_CRL&=~(0x0f<<0*4);
GPIO_A_CRL|=(0x08<<0*4);
//PC13改为上下拉输入模式
GPIO_C_CRH&=~(0x0f<<5*4);
GPIO_C_CRH|=(0x08<<5*4) ;
//PB0改为推挽输出模式
GPIO_B_CRL&=~(0x0f<<0*4);
GPIO_B_CRL|=(0x01<<0*4) ;
//PB1改为推挽输出模式
GPIO_B_CRL&=~(0x0f<<1*4);
GPIO_B_CRL|=(0x01<<1*4) ;
while(1)
{
if(GPIO_A_IDR&(0x01<<1*0)==1)//PA0按键按下
{
GPIO_B_BSRR|=(0x01<<1*0);
}
else if(GPIO_C_IDR&(0x01<<1*13)==1)//PC13按键按下
{
GPIO_B_BSRR|=(0x01<<1*1);
}
}
main.c(47): error: #18: expected a ")"
RCC_APB2ENR|=(1<<2);//使能PA外设口时钟
main.c(48): error: #18: expected a ")"
RCC_APB2ENR|=(1<<3);//使能PB外设口时钟
main.c(49): error: #18: expected a ")"
RCC_APB2ENR|=(1<<4);//使能PC外设口时钟
main.c(52): error: #18: expected a ")"
GPIO_A_CRL&=(0x0f<<04);(0x0f<<54);
main.c(53): error: #18: expected a ")"
GPIO_A_CRL|=(0x08<<04);
main.c(56): error: #18: expected a ")"
GPIO_C_CRH&=
main.c(57): error: #18: expected a ")"
GPIO_C_CRH|=(0x08<<54) ;
main.c(60): error: #18: expected a ")"
GPIO_B_CRL&=(0x0f<<04);(0x0f<<14);
main.c(61): error: #18: expected a ")"
GPIO_B_CRL|=(0x01<<04) ;
main.c(65): error: #18: expected a ")"
GPIO_B_CRL&=
main.c(66): error: #18: expected a ")"
GPIO_B_CRL|=(0x01<<14) ;
main.c(70): error: #18: expected a ")"
if(GPIO_A_IDR&(0x01<<10)==1)//PA0按键按下
main.c(72): error: #18: expected a ")"
GPIO_B_BSRR|=(0x01<<10);
main.c(75): error: #18: expected a ")"
else if(GPIO_C_IDR&(0x01<<113)==1)//PC13按键按下
main.c(77): error: #18: expected a ")"
GPIO_B_BSRR|=(0x01<<11);
main.c: 0 warnings, 15 errors
这种错误,问题不一定出在编译器报错行,检查前面是不是多写了个括号