8051 interfacing with LCD

8051 interfacing with LCD

/*
developed by S4silver
license type - open source
created on - 11/12/2014
modified on - 11/14/2014
modification details - refactored
developer - Frank Hust Jincson
contact mail id - silverembeddedsolutions@gmail.com
web link - http://s4silver.blogspot.in/p/programmers-colony.html
*/


#include <REGX51.H>

sbit RS = P3^6;
sbit EN = P3^7;

unsigned int k,s,cnt=0;

void delay(unsigned char del)
{
 unsigned int i,j;
 for(i=0;i<del;i++)
  for(j=0;j<200;j++);
}

void lcd_cmd(unsigned char cmd)
{
 P1 = cmd;
 RS=0;
 EN=1;
 delay(2);
 EN=0;
}

void lcd_data(unsigned char dat)
{
 P1 = dat;
 RS=1;
 EN=1;
 delay(2);
 EN=0;
}

void lcd_str(unsigned char *s)
{
 while(*s)
 {
  lcd_data(*s++);
 }


void main()
{
 P1=0x00;
 RS=0;
 EN=0;

 lcd_cmd(0x38);       // 2 line 8 bit mode     
 lcd_cmd(0x01);  // Reset LCD Display
 lcd_cmd(0x06);  // Shift Display Right
 lcd_cmd(0x0C);  // 0x0E --> Display ON cursor Blinking   0x0C --> Display ON cursor off
 while(1)
 {
  lcd_cmd(0x80);       // First Line First Display
  lcd_str("S4silver");  
 }
}





People who look for this also look for the below topics

blinking of led or port
8051 interfacing DC motor
8051 interfacing with keypad
8051 interfacing with LCD
8051 interfacing with LCD and display Counter
LCD sample program
serial communication (RS-232) in 8051(polling method)
serial with interrupt
how to print serial received data on LCD.
8051 interfacing STEPPER motor
how to use TIMER in 8051
8051 interfacing SEVEN SEGMENT display
Timers with interrupt concept
how to generate PWM in 8051
4 bit LCD interfacing with 8051
8051 Tuitorial
how to install python
Embedded Documents (sensors, protocol...etc)  
Special NEWS