Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

#include<reg51.

h>
//LCD
sfr LCDdata=0xA0;
sbit LCDrs=P1^0;
sbit LCDen=P1^2;

// LCD DATA lines


// LCD register Select Pin
// LCD Enable pin

//Delay Function, Produces 1 mS of delay with 11.0592 Crystal,AT89C51 Controller


And uvision ver1 complier
// Sets LCD in command mode and passes commands
void lcdcmd (unsigned char DATA)
{
LCDrs=0;
LCDen=1;
LCDdata=DATA;
LCDen=0;
}
//Delay Function for LCD
void delay (unsigned int a )
{
unsigned int k; unsigned char l;
for (k=0;k<a;k++)
{
for (l=0;l<100;l++)
{
}
}
}
// Initialization of LCD
void initialize (void)
{
lcdcmd (0x30);
delay(30);
lcdcmd (0x38);
delay(30);
lcdcmd (0x0c);
delay(30);
lcdcmd (0x01);
delay(30);
lcdcmd (0x06);
delay(30);
}
// Sets LCD in command data and passes data
void lcddat (unsigned int DATA)
{
LCDrs=1;

//

LCDen=1;
LCDdata=DATA;
LCDrs=1;
LCDen=0;

}
// Easy function to print data and strings to LCD
void display_lcd (unsigned char location, unsigned char *d)
{
lcdcmd(0x80 | location);
#include<reg51.h>
//LCD
sfr LCDdata=0xA0;
sbit LCDrs=P1^0;
sbit LCDen=P1^2;

// LCD DATA lines


// LCD register Select Pin
// LCD Enable pin

//Delay Function, Produces 1 mS of delay with 11.0592 Crystal,AT89C51 Controller


And uvision ver1 complier
// Sets LCD in command mode and passes commands
void lcdcmd (unsigned char DATA)
{
LCDrs=0;
LCDen=1;
LCDdata=DATA;
LCDen=0;
}
//Delay Function for LCD
void delay (unsigned int a )
{
unsigned int k; unsigned char l;
for (k=0;k<a;k++)
{
for (l=0;l<100;l++)
{
}
}
}
// Initialization of LCD
void initialize (void)
{
lcdcmd (0x30);
delay(30);
lcdcmd (0x38);
delay(30);
lcdcmd (0x0c);
delay(30);
lcdcmd (0x01);
delay(30);
lcdcmd (0x06);
delay(30);
}
// Sets LCD in command data and passes data

void lcddat (unsigned int DATA)


{
LCDrs=1;

//

LCDen=1;
LCDdata=DATA;
LCDrs=1;
LCDen=0;

}
// Easy function to print data and strings to LCD
void display_lcd (unsigned char location, unsigned char *d)
{
lcdcmd(0x80 | location);
#include<reg51.h>
//LCD
sfr LCDdata=0xA0;
sbit LCDrs=P1^0;
sbit LCDen=P1^2;

// LCD DATA lines


// LCD register Select Pin
// LCD Enable pin

//Delay Function, Produces 1 mS of delay with 11.0592 Crystal,AT89C51 Controller


And uvision ver1 complier
// Sets LCD in command mode and passes commands
void lcdcmd (unsigned char DATA)
{
LCDrs=0;
LCDen=1;
LCDdata=DATA;
LCDen=0;
}
//Delay Function for LCD
void delay (unsigned int a )
{
unsigned int k; unsigned char l;
for (k=0;k<a;k++)
{
for (l=0;l<100;l++)
{
}
}
}
// Initialization of LCD
void initialize (void)
{
lcdcmd (0x30);
delay(30);
lcdcmd (0x38);
delay(30);

lcdcmd (0x0c);
delay(30);
lcdcmd (0x01);
delay(30);
lcdcmd (0x06);
delay(30);
}
// Sets LCD in command data and passes data
void lcddat (unsigned int DATA)
{
LCDrs=1;

//

LCDen=1;
LCDdata=DATA;
LCDrs=1;
LCDen=0;

}
// Easy function to print data and strings to LCD
void display_lcd (unsigned char location, unsigned char *d)
{
lcdcmd(0x80 | location);
#include<reg51.h>
//LCD
sfr LCDdata=0xA0;
sbit LCDrs=P1^0;
sbit LCDen=P1^2;

// LCD DATA lines


// LCD register Select Pin
// LCD Enable pin

//Delay Function, Produces 1 mS of delay with 11.0592 Crystal,AT89C51 Controller


And uvision ver1 complier
// Sets LCD in command mode and passes commands
void lcdcmd (unsigned char DATA)
{
LCDrs=0;
LCDen=1;
LCDdata=DATA;
LCDen=0;
}
//Delay Function for LCD
void delay (unsigned int a )
{
unsigned int k; unsigned char l;
for (k=0;k<a;k++)
{
for (l=0;l<100;l++)
{
}

}
}
// Initialization of LCD
void initialize (void)
{
lcdcmd (0x30);
delay(30);
lcdcmd (0x38);
delay(30);
lcdcmd (0x0c);
delay(30);
lcdcmd (0x01);
delay(30);
lcdcmd (0x06);
delay(30);
}
// Sets LCD in command data and passes data
void lcddat (unsigned int DATA)
{
LCDrs=1;

//

LCDen=1;
LCDdata=DATA;
LCDrs=1;
LCDen=0;

}
// Easy function to print data and strings to LCD
void display_lcd (unsigned char location, unsigned char *d)
{
lcdcmd(0x80 | location);
#include<reg51.h>
//LCD
sfr LCDdata=0xA0;
sbit LCDrs=P1^0;
sbit LCDen=P1^2;

// LCD DATA lines


// LCD register Select Pin
// LCD Enable pin

//Delay Function, Produces 1 mS of delay with 11.0592 Crystal,AT89C51 Controller


And uvision ver1 complier
// Sets LCD in command mode and passes commands
void lcdcmd (unsigned char DATA)
{
LCDrs=0;
LCDen=1;
LCDdata=DATA;
LCDen=0;
}
//Delay Function for LCD

void delay (unsigned int a )


{
unsigned int k; unsigned char l;
for (k=0;k<a;k++)
{
for (l=0;l<100;l++)
{
}
}
}
// Initialization of LCD
void initialize (void)
{
lcdcmd (0x30);
delay(30);
lcdcmd (0x38);
delay(30);
lcdcmd (0x0c);
delay(30);
lcdcmd (0x01);
delay(30);
lcdcmd (0x06);
delay(30);
}
// Sets LCD in command data and passes data
void lcddat (unsigned int DATA)
{
LCDrs=1;

//

LCDen=1;
LCDdata=DATA;
LCDrs=1;
LCDen=0;

}
// Easy function to print data and strings to LCD
void display_lcd (unsigned char location, unsigned char *d)
{
lcdcmd(0x80 | location);

You might also like