fjl120794520 2015-04-24 23:41 采纳率: 0%
浏览 6915

求助,keil错误 C141: syntax error near 'unsigned'

#include
//#include "REG51.h"
//#include "intrins.h"

// Define P3 pins
#define DATA_BUS (P0)
#define RS (P2.0)
#define RW (P2.1)
#define E (P2.2)

// Define new types
typedef unsigned char uchar;
typedef unsigned int uint;

// Function Prototypes
void check_busy(void);
void write_command(uchar com);
void write_data(uchar data);
void LCD_init(void);
void string(uchar ad ,uchar *s);
void lcd_test(void);
void delay(uint);

void main(void)
{ LCD_init();
while(1)
{ string(0x80,"fire!");
string(0xC0," Proteus VSM");
delay(100);
write_command(0x01);
delay(100);

}
}

/*******************************************
LCD1602 Driver mapped as IO peripheral
*******************************************/

// Delay
void delay(uint j)
{ uchar i = 60;
for(; j>0; j--)
{ while(--i);
i = 59;
while(--i);
i = 60;
}
}

// Test the Busy bit
void check_busy(void)
{ do
{ DATA_BUS = 0xff;
E = 0;
RS = 0;
RW = 1;
E = 1;
__no_operation();
} while(DATA_BUS & 0x80);
E = 0;
}

// Write a command
void write_command(uchar com)
{ check_busy();
E = 0;
RS = 0;
RW = 0;
DATA_BUS = com;
E = 1;
__no_operation();
E = 0;
delay(1);
}

// Write Data
void write_data(uchar data)
{ check_busy();
E= 0;
RS = 1;
RW = 0;
DATA_BUS = data;
E = 1;
__no_operation();
E= 0;
delay(1);

}

// Initialize LCD controller
void LCD_init(void)
{ write_command(0x38); // 8-bits, 2 lines, 7x5 dots
write_command(0x0C); // no cursor, no blink, enable display
write_command(0x06); // auto-increment on
write_command(0x01); // clear screen
delay(1);
}

// Display a string
void string(uchar ad, uchar *s)
{ write_command(ad);
while(*s>0)
{ write_data(*s++);
delay(100);
}
}

  • 写回答

2条回答

  • oyljerry 2015-04-24 23:57
    关注

    是否支持无符号类型。

    评论

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决