#include <reg52.h>
#include <intrins.h>
sbit LCD_RS = P2^6; //数据或指令
sbit LCD_RW = P2^5; //读或写
sbit LCD_EN = P2^7; //使能
void delay(unsigned int i); //延时函数
void WCmd(unsigned char cmd); //写指令
void WData(unsigned char data); //写数据
void main()
{
WCmd(0x06);
WCmd(0x0c);
WData('l');
}
/*延时函数*/
void delay(unsigned int i)
{
unsigned char j;
for (; i>0; i--)
{
for (j=255; j>0; j--);
}
}
/*写指令*/
void WCmd(unsigned char cmd)
{
LCD_RS = 0;
LCD_RW = 0;
delay(5);
LCD_EN = 1;
P0 = cmd;
LCD_EN = 0;
}
/*写数据*/
void WData(unsigned char data)
{
LCD_RS = 1;
LCD_RW = 0;
delay(5);
LCD_EN = 1;
P0 = data;
LCD_EN = 0;
}
MY-TEST.C(10): error C141: syntax error near ')'
MY-TEST.C(45): error C141: syntax error near ')'
MY-TEST.C(52): error C141: syntax error near 'data' |