本帖最后由 caoye87 于 2014-6-26 20:42 编辑
大家好,本来刚开始学习LCD1602,按照资料上的程序用
proteus仿真1602,想显示一个字符“A”,结果不显示,程序和仿真
电路如下,请高手指教。
程序如下:
#include <reg52.h>
#include "lcd.h"
void main(void)
{
LCD1602();
Init_Lcd();
Write_Lcd(0x80,0);
Write_Lcd('A',1);
while(1);
}
/******************/
#ifndef _LCD_H_
#define _LCD_H_
#include <reg52.h>
#define LCD_DATA P1
sbit RS=P3^0;
sbit RW=P3^1;
sbit EN=P3^2;
void LCD1602(void);
void Read_Busy(void);
void Write_Lcd(unsigned char Value,bit i);
void Init_Lcd(void);
void Delay(unsigned int i);
#endif
/*********************/
#include "lcd.h"
void LCD1602(void)
{
EN=0;
RS=1;
RW=1;
LCD_DATA=0xFF;
}
void Read_Busy(void)
{
LCD_DATA=0xFF;
RS=0;
RW=1;
EN=1;
while(LCD_DATA & 0x80);
EN=0;
}
void Write_Lcd(unsigned char Value,bit i)
{
Read_Busy();
LCD_DATA=Value;
RS=i;
RW=0;
EN=1;
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);
Write_Lcd(0x06,0);
Write_Lcd(0x0c,0);
}
void Delay(unsigned int i)
{
while(--i);
}
谢谢你的回复,可还是不起作用
一周热门 更多>