Posts Tagged ‘Displaying String using microcontroller’

This program can show your desired text message in LCD screen.The application of this field is vast.This project can be used for customer care,for lighting,for publish a notice or any other application.This is very simple application of micro-controller and cost is very low.The main component of this project is only a micro-controller .So keep enjoy it….

Program Source Code
*********************************************************
#include <REG52.H>
sbit RS = P2∧0; // Control signal RESET of the LCD connected
to pin P2.0
sbit RW = P2∧1; // Write (RW) Signal pin connected to pin P2.1
sbit EN = P2∧2; // Enable (EN) LCD control signal connected to
pin P2.2
int i;
void delay(void); // Delay function
void INIT(void); // Function for the commands to Initialization of
the LCD
void ENABLE(void); // Function for the commands to enable the LCD
void LINE(int); /∗ Function for the commands to choose the line for
displaying the characters on the LCD ∗/
void LINE(int i) // start of LINE function
{ if (i==1)
{RS=0; // first make the reset signal low
RW=0; // make RW low to give commands to the LCD
P1=0x80; // force cursor to beginning of the first line
ENABLE(); // enable the LCD
RS=1;
}else
{RS=0;
RW=0;
P1=0xC0; // force cursor to beginning of the second line
ENABLE();
RS=1;
}
}

void delay() // Invoking the delay function.
{int j;
for (j=0;j<10;j++)
{for (i=0;i<100;i++);
}}
void ENABLE(void) // Invoking the enable function
{ EN=1; // Give high to low pulse to Enable the LCD.
delay();
EN=0;
delay();
}
void INIT(void) // Initialization of the LCD by giving the proper
commands.
{ RS=0;
RW=0;
EN=0;
P1 = 0x38; // 2 lines and 5∗7 matrix LCD.
ENABLE();
ENABLE();
ENABLE();
ENABLE();
P1 = 0x06; //Shift cursor to left
ENABLE();
P1 = 0x0E; // Display ON, Cursor Blinking
ENABLE();
P1 = 0x01; // Clear display Screen.
ENABLE();
}
void main (void)
{
char code dis[] = “We Thank Springer Publishers”;
char code dis2[] = “From Authors”; // Array of characters
to be display.

char ∗p; // Pointer to point the data in the array.
int j,x;
while(1)
{for (x=1;x<3;x++)
{
INIT();
LINE(1); // Display on the line 1 of the LCD.
if (x==1)
{p=&dis; // point the character address from the array “dis” where
it is stored.
}else
{p=&dis2; // Point the Character address from the “dis2” where it
is stored/
}for (j=0;j>8;j++){ P1= ∗p++; // Increment the pointer by 1.
ENABLE();
} LINE(2); // Display the second array on the second line on the LCD.
}}
}
*********************************************************