Microcontroller › 8051 › INTERFACING LCD TO 8051 BY Qurat-ul-ain › Hello, every one few new
Hello,
every one
few new thing about h/w and s/w
just try it it may be useful to all who have LCD problem
1. if u connect LCD with PORT 0 then connect 10K pull-up resistors with M/C
2. connect pin no. 5,1,16 of LCD to GND
3. connect pin n0. 2,15 to +ve 5 V
4. connect excet 10K variable resistor / pot / trimmer as middle pin with pin no. 3 of LCD
below is the sample code for display ” 16×2 character LCD ” on LCD screen
LCD is connect with PORT 2 and RS at pin 1 and EN at pin 2 of PORT 1 and RW is GND in my below code..
just assume this code and you also edit it as per your requriment..
#inclde<REG51.h>
#include<stdio.h>
#defoine lcd P2
sbit rs = P1^0;
sbit en = P1^1;
void cmd(unsigned char value)
{
lcd=value;
rs=0;
en=0;
en=1
}
void data(unsigned char value)
{
lcd=value;
rs=1;
en=0;
en=1
}
void main()
{
unsigned char a[]=”16×2 character LCD”;
unsigned int i;
cmd(0x38);
cmd(0x01);
cmd(0x06);
cmd(0x0E);
cmd(0x80);
for(i=0;a!=’