void LCD1602(void)
{
EN = 0;
RS = 1;
RW = 1;
LCD_DATA = 0xFF;
}
void Read_Busy(void)
{
RS=0;
RW=1;
EN=1;
while(LCD_DATA & 0x80);
EN=0;
}//读状态
void Write_Lcd(unsigned char Value, bit i) //i = 0写指令.i = 1写数据;
{
Read_Busy();
RS = i;
RW = 0;
EN = 1;
LCD_DATA = Value;
EN = 0;
}
void Init_Lcd(void)
{
Delay(15000);
Write_Lcd(0x38,0);
Delay(5000);
Write_Lcd(0x38,0);
Delay(5000);
Write_Lcd(0x38,0);
Write_Lcd(0x08,0);
Write_Lcd(0x01,0);
}
void Delay(unsigned int i)
{
while(-- i);
}//延时
void main(void)
{ LCD1602();
Init_Lcd();
Write_Lcd(0x80,0);
Write_Lcd('K',1);
while(1);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>