新手上路
- 积分
- 44
- 金钱
- 44
- 注册时间
- 2016-12-7
- 在线时间
- 10 小时
|
2金钱
..\SOURSE\LCD12864.H(4): error C141: syntax error near 'dat', expected ')'
..\SOURSE\LCD12864.H(6): error C141: syntax error near 'com', expected ')'
..\SOURSE\LCD12864.H(7): error C141: syntax error near 'dat', expected ')'
..\SOURSE\LCD12864.H(8): error C141: syntax error near 'x', expected ')'
..\SOURSE\LCD12864.H(9): error C141: syntax error near 'x', expected ')'
H代码
#ifndef __LCD12864_H
#define __LCD12864_H
void Set_byte(u8 dat);
void Busy();
void Writer_com(u8 com);
void Writer_dat(u8 dat);
void Writer_cursor(u8 x,u8 y);
void Writer_string(u8 x,u8 y,u8 *str);
void Init_lcd12864();
#endif
C代码
#include "config.h"
#include "lcd12864.h"
void Set_byte(u8 dat)
{
u8 i = 0;
for(i = 0;i < 4;i++)
{
e = 1;
if(dat & 0x80)
rw = 1;
else
rw = 0;
dat <<= 1;
e = 0;
}
}
void Busy()
{
u8 i = 0;
u8 dat = 0;
u8 dat1 = 0;
rs = 0;
rs = 1;
Set_byte(0xfc);
for(i = 0;i < 7;i++)
{
if(rw & 0x01)
dat = 1;
else
dat = 0;
dat |= dat;
dat <<= 1;
}
while(dat1 & 0x80);
}
void Writer_com(u8 com)
{
Busy();
rs = 0;
Set_byte(0xf8);//写指令
Set_byte(com & 0xf0);
Set_byte(com << 4);
rs = 1;
}
void Writer_dat(u8 dat)
{
Busy();
rs = 0;
Set_byte(0xfa);
Set_byte(dat & 0xf0);
Set_byte(dat << 4);
rs = 1;
}
void Writer_cursor(u8 x,u8 y)
{
u8 cursor = 0;
switch(x)
{
case 1: cursor = 0x80;break;
case 2: cursor = 0x90;break;
case 3: cursor = 0x88;break;
case 4: cursor = 0x98;break;
}
cursor = y + cursor;
Writer_com(cursor);
}
void Writer_string(u8 x,u8 y,u8 *str)
{
Writer_cursor(x,y);
while(*str != '\0')
{
Writer_dat(*str++);
}
}
void Init_lcd12864()
{
Writer_dat(0x01);
Delay_1ms(45);
Writer_dat(0x30);
Delay_1us(100);
Writer_dat(0x30);
Delay_1us(40);
Writer_dat(0xC0);
Delay_1us(100);
Writer_dat(0x01);
Delay_1ms(10);
Writer_dat(0x06);
}
|
最佳答案
查看完整内容[请看2#楼]
这有什么好奇怪的?很明显是你的自定义数据类型没声明好,
#ifndef __LCD12864_H[/backcolor]
#define __LCD12864_H[/backcolor]
//在这个位子包含你的数据类型重定义头文件或者是实体
void Set_byte(u8 dat);[/backcolor]
void Busy();[/backcolor]
void Writer_com(u8 com);[/backcolor]
void Writer_dat(u8 dat);[/backcolor]
void Writer_cursor(u8 x,u8 y);[/backcolor]
void Writer_string(u8 x,u8 y,u8 *str ...
|