Microcontroller › 8051 › Help me to create a 16×2 LCD display in AT 89s52
- This topic has 7 replies, 7 voices, and was last updated 12 years, 6 months ago by
balaji.n.
-
AuthorPosts
-
December 1, 2010 at 9:19 pm #485
Manas Paul
ParticipantI am trying to create a LCD dispaly in AT89S52.I was full copy the (How to display number on 16×2 LCD using 8051 microcontroller (AT89C51) ) program and design the circuit. But it is not working.I had change at the first time the header file.
Please Help me to create a 16×2 in AT89S52 microcontroller,with circuit design and C program.Thank You.
December 4, 2010 at 6:29 am #5183dagakshay
Participantthe code must work it might be soome loose connection in the the circuit… what extaclly you getting on LCD.. i mean your LCD is fully blank, or some boxes in first line… or the back light of LCD is not glowing at all…
have you used variable resistance??… it is use to set the contarst… try to set that….
plz be a bit more specify about your problem so that i can help you out….
March 21, 2011 at 2:36 am #5777Rajesh
ParticipantI am getting black sqaure boxes on the LCDJHD 162. can any one help?
March 22, 2011 at 9:25 am #5793dagakshay
Participantthis type of cases comes when the controller will not a be able to communicate with LCD…
check the connections onces… see weather you code is properly working… check your delay function you have there must be atleast 50 micro second delay….April 7, 2011 at 1:31 pm #5923chuduc
ParticipantMy english is very bad I can not express their answers, Here is my code written for lcd16x2, hope it is for your help
#include “reg52.h”
const unsigned char clr=1,home=2,d_on=15,d_off=12,set=56;
sbit rs=P2^0;
sbit rw=P2^1;
sbit e=P2^2;/* P0 noi voi LCD data
noi 3 bit thap cua P2 voi chan cam LCD_CONTROL
co the su dung board thi nghiem 89_v2 de chay chuong trinh
cac lenh su dung:
int_lcd(); cai dat lcd
lenh(clr); xoa lcd
lenh(home); dua con tro ve dau dong
lenh(d_on); mo display,blink
lenh(set); che do 16×2
dat(1 ki tu); xuat 1 ki tu ra lcd
dat_str(“chuoi”); xuat 1 chuoi ki tu ra lcd
*/void delay(unsigned int msec) // chuong trinh con tao thoi gian tre ms
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
//
void busy() //chuong trinh con kiem tra lcd co ban ko
{
rs=0;
rw=1;
P0_7=1;
while(P0_7!=0)
{
e=0;
e=1;
}
}
//
void lenh(unsigned char ma) //chuong trinh con xuat lenh len LCD
{
busy();rs=0;
rw=0;
e=1;
P0=ma;
e=0;
}
//
void dat(unsigned char ma) //chuong trinh con xuat du lieu len LCD
{
busy();
rs=1;
rw=0;
e=1;
P0=ma;
e=0;
}
//
void mov(unsigned char row, unsigned char col) //chuong trinh di chuyen con tro
{
lenh(128 | (row << 6) | col); //row =0 la hang dau,=1 la hang 2
}
//
void dat_str(unsigned char *str) //chuong trinh xuat ra LCD mot chuoi ki tu
{
while (*str!=’