LCD Interfacing With 8051 (AT89S52)
by sandeep jagdev in Circuits > Electronics
3906 Views, 2 Favorites, 0 Comments
LCD Interfacing With 8051 (AT89S52)
Hello this is beginning of 8051. LCD can be run by 8-bit and 4-bit mode,but in the case of 8051 8-bit is mostly used ,4-bit used in case of arduino ,AVR and PIC. 8-bit mode means it used 8 wire for transmission of address and data.
Component Required :
LCD 16*2
Micro-controller AT89S52
Crystal oscillator 11.0592MHz
Capacitor 10 uf
Ceramic capacitor 22pf
40 pin IC base
Jumper Wires
Potentio-meter 10k
Hardware Setup:
Hardware connection shown in fig
Connect port 2 to LCD data pins.
Port 0.0 RS and Port 0.1 to ENABLE .
RW to ground.
Resistor and capacitor to RESET pin.
Software Setup:
Install KEIL4 on your PC
Program for LCD interfacing:
#include <reg51.h>
sbit rs=P0^0;
sbit en=P0^1;
void delay();
void cmd();
void dat();
void main()
{
char name[10]="INSTRUCTABLES";
unsigned int b;
P1=0x38;
cmd();
P1=0x80;
cmd();
P1=0x0f;
cmd();
for(b=0;b<=10;b++)
{
P1=name[b];
dat();
delay();
}
}
void cmd()
{
rs=0;
en=1;
delay();
en=1;
}
void dat()
{
rs=1;
en=1;
delay();
en=0;
} void delay()
{
unsigned int a;
for(a=0;a<=500;a++);
}
You can Download from here: