#include"delay.h"
bit busyTest()
{
bit temp;
lcdrs=0;
lcdrw=1;
lcden=1;
delayms(1);
temp=P0&0x80;
lcden=0;
return temp;
}
void write_com(uchar com)
{
while(busyTest()==1);
lcdrs=0;
lcdrw=0;
lcden=1;
P0 = com;
delayms(2);
lcden = 0;
}
void write_dat(uchar dat)
{
while(busyTest()==1);
lcdrs=1;
lcdrw=0;
lcden=1;
P0 = dat;
delayms(2);
lcden = 0;
}
void lcd_init()
{
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
write_com(0x80);
write_dat('-');
write_com(0x83);
write_dat('-');
write_com(0x90);
write_dat(':');
write_com(0x93);
write_dat(':');
}
这段代码是1602液晶的,我想把它封装在一个模块里,但是老是出现这个错误,不知道哪里出问题了
这里是头文件里的
#ifndef __12864_H__
#define __12864_H__
sbit lcdrs = P2^0; //寄存器选择位,将RS位定义为P2.0引脚
sbit lcdrw = P2^1; //读写选择位,将RW位定义为P2.1引脚
sbit lcden = P2^2; //使能信号位,将E位定义为P2.2引脚
extern bit busyTest();
extern void write_com(uchar com);
extern void write_dat(uchar dat);
extern void lcd_init();
#endif
错误提示
12864.H(8): error C141: syntax error near 'com', expected ')'
12864.H(9): error C141: syntax error near 'dat', expected ')'
compiling delay.c...
12864.H(8): error C141: syntax error near 'com', expected ')'
12864.H(9): error C141: syntax error near 'dat', expected ')'
compiling 12864.c...
12864.H(8): error C141: syntax error near 'com', expected ')'
12864.H(9): error C141: syntax error near 'dat', expected ')' |