完全找不到头绪啊!!
#include<reg51.h>
#define LCD1602_DATAPINS P0;
sbit LCD_RS=P2^6;
sbit LCD_RW=P2^5;
sbit LCD_E=P2^7;
unsigned char code DATA[]="I Want You" ;
void Delay1ms(unsigned int c)
{
unsigned char a,b;
for(;c>0;c--);
for(a=38;a>0;a--);
for(b=130;b>0;b--);
}
void lcdcom(unsigned char com)
{
LCD_E=0;
LCD_RS=0;
LCD_RW=0;
LCD1602_DATAPINS=com;
Delay1ms(10);
LCD_E=1;
Delay1ms(10);
LCD_E=0;
}
void lcddat(unsigned char dat)
{
LCD_E=0;
LCD_RS=1;
LCD_RW=0;
LCD1602_DATAPINS=dat;
Delay1ms(10);
LCD_E=1;
Delay1ms(10);
LCD_E=0;
}
void lc
tinit()
{
lcdcom(0x38);
lcdcom(0x0c);
lcdcom(0x06);
lcdcom(0x01);
}
void main()
{
lcdinit();
while(1)
{ unsigned char i;
lcdcom(0x80);
for(i=0;i<9;i++)
{
lcddat(DATA[i]);
}
}
}
Build target 'Target 1'
compiling lcd.c...
LCD.C(20): warning C275: expression with possibly no effect
LCD.C(20): error C141: syntax error near '='
LCD.C(51): error C141: syntax error near '='
Target not created
一周热门 更多>