二进制常量前的keil uvision 5语法错误

keil uvision 5 syntax error before binary constant

我正在尝试构建此代码。 但我不知道错误在哪里?我做错了什么?

#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
 
#define LCD_PORT GPIOC
#define LCD_RCC_GPIO RCC_AHB1Periph_GPIOC
#define LCD_E_Pin GPIO_Pin_12
#define LCD_RS_Pin GPIO_Pin_10

void delay(unsigned int s);
void lcd_init_gpio();
void lcd_write_data(u16 data);
void lcd_init();
void lcd_write_str(char*str);
void lcd_write_cmd(u16 cmd);
void lcd_set_cursor(int line,int pos);
void lcd_write_dec_xxx(uint16_t data);
void lcd_write_dec_xxx(uint16_t data);
void lcd_write_dec_xx(uint8_t data);
void lcd_write_dec_x(uint8_t data);
int main(void)
{
    lcd_init();
  while (1)
    {

    }
}

void delay(unsigned int s){
    while(--s > 0) {
        __NOP();
    }
}

const uint8_t lcd_2x16_decode[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

void lcd_write_dec_xxxx(uint16_t data){
    lcd_write_data(lcd_2x16_decode[(data / 1000) & 0x0F]);
    lcd_write_data(lcd_2x16_decode[((data % 1000) / 100) & 0x0F]);
    lcd_write_data(lcd_2x16_decode[((data % 1000) % 100) / 10 & 0x0F]);
    lcd_write_data(lcd_2x16_decode[((data % 1000) % 100) % 10 & 0x0F]);
}

void lcd_write_dec_xxx(uint16_t data){
    lcd_write_data(lcd_2x16_decode[(data / 100) & 0x0F]);
    lcd_write_data(lcd_2x16_decode[((data % 100) / 10) & 0x0F]);
    lcd_write_data(lcd_2x16_decode[((data % 100) % 10) & 0x0F]);
}

void lcd_write_dec_xx(uint8_t data){
    lcd_write_data(lcd_2x16_decode[((data % 100) / 10) & 0x0F]);
    lcd_write_data(lcd_2x16_decode[((data % 100) % 10) & 0x0F]);
}

void lcd_write_dec_x(uint8_t data) {
    lcd_write_data(lcd_2x16_decode[data]);
}
void lcd_init_gpio() {
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
    GPIO_InitTypeDef init;
    init.GPIO_Mode = GPIO_Mode_Out_PP;
    init.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_10 | GPIO_Pin_12;
    GPIO_Init(LCD_PORT,&init);
}
void lcd_write_data(u16 data) {
    GPIO_SetBits(LCD_PORT,data | LCD_E_Pin);
    delay(0xFFFF);
    GPIO_ResetBits(LCD_PORT,LCD_E_Pin | data);
}
void lcd_init() {
    lcd_init_gpio();
    int del = 99999;
    GPIO_ResetBits(LCD_PORT, LCD_RS_Pin);
    delay(del);
    lcd_write_data(0b00110000);
    delay(del);
    lcd_write_data(0b00110000);
    delay(del);
    lcd_write_data(0b00110000);
    delay(del);
    lcd_write_data(0b00111000);
    delay(del);
    lcd_write_data(0b00001111);
    delay(del);
    lcd_write_data(0b00000001);
    delay(del);
    lcd_write_data(0b00000110);
    delay(del);
    lcd_write_data(0b00000010);
    delay(del);
    GPIO_SetBits(LCD_PORT,LCD_RS_Pin);
}

void lcd_write_str(char*str) {
    do {
        lcd_write_data(*str);
    }while(*++str);
}
void lcd_write_cmd(u16 cmd) {
    GPIO_ResetBits(LCD_PORT,LCD_RS_Pin);
    lcd_write_data(cmd);
    GPIO_SetBits(LCD_PORT,LCD_RS_Pin);
}
void lcd_set_cursor(int line,int pos) {
    pos |= 0b10000000;
    if (line == 1) {
        pos += 0x40;
    }
    lcd_write_cmd(pos);
}
 

main.c(76): error: #18: expected a ")" lcd_write_data(0b00110000);

main.c(78): error: #18: expected a ")" lcd_write_data(0b00110000);

main.c(80): error: #18: expected a ")" lcd_write_data(0b00110000);

main.c(82): error: #18: expected a ")" lcd_write_data(0b00111000);

main.c(84): error: #18: expected a ")" lcd_write_data(0b00001111);

main.c(86): error: #18: expected a ")" lcd_write_data(0b00000001);

main.c(88): error: #18: expected a ")" lcd_write_data(0b00000110);

main.c(90): error: #18: expected a ")" lcd_write_data(0b00000010);

main.c(106): error: #65: expected a ";" pos |= 0b10000000;

Keil支持二进制常量吗? uVision 3 不符合 this link. Try replacing 0b00110000 with the equivalent 0x30, and likewise for the other 0b... values. (Another support page)

0b00110000 0x30
0b00110000 0x30
0b00110000 0x30
0b00111000 0x38
0b00001111 0x0f
0b00000001 0x01
0b00000110 0x06
0b00000010 0x02
0b10000000 0x80