lcd1602显示不了

是哪里出问题了?请为我指点迷津

img

img


代码
#include <reg52.h>

sbit RS=P0^7;
sbit RW=P0^6;
sbit EN=P0^5;

void Read_Busy()
{
unsigned char busy;
P2=0xff;
RS=0;
RW=1;
do
{
EN=1;
busy=P2;
EN=0;
}while(busy&0x80);

}

void Write_command(unsigned char command)
{
Read_Busy();
RS=0;
RW=0;
P2=command;
EN=1;
EN=0;
}

void Write_Date(unsigned char date)
{
Read_Busy();
RS=1;
RW=0;
P2=date;
EN=1;
EN=0;
}

void main()
{
Write_command(0x38);//设置16*2显示
Write_command(0x0c);//开显示
Write_command(0x06);//地址指针加一
Write_command(0x80);//显示地址
Write_command(0x01);//清屏
Write_Date(2+'0');
while(1);
}

缺显示函数
要想显示先得给DDRAM发地址也就是发命令后发要写的字符数据
参照这个网址看看https://zhuanlan.zhihu.com/p/266391922
void LCD1602_ShowChar(unsigned char xpos,unsigned char ypos,char xsz)
{
ypos%=2;
if(ypos==0)
{
LCD1602_write_cmd(0x80+xpos);
}
else
{
LCD1602_write_cmd(0x80+0x40+xpos);
}
LCD1602_write_data(xsz);
}