8051 Keil code to Rotate a String on LCD screen

/** Code Source :- www.tentuts.com **/

#include<reg51.h>
sbit rw=P2^0;  //read write pin
sbit rs=P2^1;  // data/command pin
sbit en=P2^2; //enable pin


void lcd_init(void );
void lcd_cmd(unsigned char );
void delay(unsigned int );
void lcd_display(unsigned char);
void lcd_clear(void );
const unsigned char text[]={"Welcome to MUFADDAL KAGDA World  Of  Programming!!"};

void main(void ){
 unsigned char i,loc=0x80;
  rw=0;
  lcd_clear();
  lcd_init();
  for(i=0;text[i]!='\0';i++){
   loc++;
   lcd_display(text[i]);
   if(loc>=0x8f)
    lcd_cmd(0x18);
  }

}
void lcd_clear(void){
  
    lcd_cmd(0x01);
 }
void lcd_init(void ){

   lcd_cmd(0x30);
   lcd_cmd(0x0c);
   lcd_cmd(0x06);
 }

void lcd_cmd(unsigned char cmd){

  rs=0;
  P1=cmd;
  en=1;
  delay(75);
  en=0;
 }

void lcd_display(unsigned char text){

 rs=1;
 P1=text;
 en=1;
 delay(1);
 en=0;
 }
void delay(unsigned int time){
unsigned int i,j;
for (i=0;i<time;i++)
 for(j=0;j<1275;j++);
 }


THANK YOU FOR VISITING..!!
PLEASE COMMENT

1 comment:

  1. your blog is more usefull ans easly use...

    Fancy designer wear and fashioable.......
    Here We Have Some For You In Your Budget
    For More.... Plz visit Plz visit:-
    designer wear printed

    ReplyDelete