各位老师好,下面程序编译通过,应在12864(带字库)屏幕闪显示“空不异色”4个汉字,现在不显示,什么原因???
#include<reg52.h>
#include<intrins.h>
sbit RS=P2^0;
sbit RW=P2^1;
sbit EN=P2^2;
#define uchar unsigned char
#define uint unsigned int
void delay(uchar i)//*************************延时1ms函数
{
uchar n,i1,j1;
for(n=0;n<=i;n++){
_nop_();
i1 = 2;
j1= 199;
do
{
while (--j1);
} while (--i1);}
}
void read_busy()//****************************判断忙函数
{
RS=0;
RW=1;
EN=1;
delay(10);
while(P0&0X80);
EN=0;
}
void write_LCD_command(uchar value)//**********************写指令函数
{
read_busy();
RS=0;//1êy¾Y¼Ä′æÆ÷£¬2Ö¸áî¼Ä′æÆ÷
RW=0;
EN=1;
P0=value;
EN=0;
}
void write_LCD_byte(uchar value)//************写数据函数
{
read_busy();
RS=1;
RW=0;
EN=1;
P0=value;
EN=0;
}
void write_LCD_data(uchar *s)//***************连续写数据函数
{
while(*s>0) //
{
write_LCD_byte(*s);//
s++; //
}
}
void initi_LCD()//*******************************LCD12864初始化函数
{
delay(10);
write_LCD_command(0x30);
delay(1);
write_LCD_command(0x0C);
delay(1);
write_LCD_command(0x0C);//
delay(1);
write_LCD_command(0x01);//
delay(1);
write_LCD_command(0x06);
delay(10);
}
void main()//********************************************************主函数
{
initi_LCD();
write_LCD_command(0x01);
write_LCD_command(0X90);
write_LCD_data("空不异色");
delay(1000);
while(1);
}
|