I looking idea to write C program that will display the letter on LCD. I am using 8051 LCD 16*2 LCD and keil software. like display letter "A" wait for some time than clear screen. than display letter "B" than clean screen repeat process up to letter ''F''. how to start writing program. I have created following algorithm
initialize LCD
send data to LCD
send Command to LCD
wait for LCD
main function
call initialize
while (1)
call command
call wait
call data
call wait
I have no idea what i use array, string, for loop. can any tell me what I need to write program ?
You obviously need to learn more about programming than can be presented here. First, you need to understand the interface to your display. Then, write a routine that handles just that interface. The rest of it should be pretty straightforward.
You obviously need to learn more about programming than can be presented here. First, you need to understand the interface to your display. Then, write a routine that handles just that interface. The rest of it should be pretty straightforward.
I have knowledge of programming. I understand interfacing of LCD. I mentioned algorithm for better understanding.
I am trying to write original program. below are the function that I am going to use in program
void initialize ();
void send_data ();
void send _Command ();
void wait_LCD ();
int main ()
{
while (1)
{
}
}
how many variable have to declared?
do I need to use for loop ? I think yes
I think i have to use conditional statement? if (condition1) display "A" else if (condition2) display "B"....etc
actually I was trying to modify my code. This program display alphabets but I want to display letter "A" wait for some time than clear screen. than display letter "B" than clean screen repeat process up to letter ''F''. how to writing program?
#include<reg51.h>#define display_port P1 //Data pins connected to port 2 on microcontroller
sbit rs = P2^0;//RS pin connected to pin 2 of port 3
sbit rw = P2^1;// RW pin connected to pin 3 of port 3
sbit e = P2^2;//E pin connected to pin 4 of port 3void msdelay(unsignedinttime)// Function for creating delay in milliseconds.{unsigned i,j ;for(i=0;i<time;i++)for(j=0;j<1275;j++);}void lcd_cmd(unsignedchar command)//Function to send command instruction to LCD{
display_port = command;
rs=0;
rw=0;
e=1;
msdelay(1);
e=0;}void lcd_data(unsignedchar disp_data)//Function to send display data to LCD{
display_port = disp_data;
rs=1;
rw=0;
e=1;
msdelay(1);
e=0;}void lcd_init()//Function to prepare the LCD and get it ready{
lcd_cmd(0x38);// for using 2 lines and 5X7 matrix of LCD
msdelay(10);
lcd_cmd(0x0F);// turn display ON, cursor blinking
msdelay(10);
lcd_cmd(0x01);//clear screen
msdelay(10);
lcd_cmd(0x81);// bring cursor to position 1 of line 1
msdelay(10);}void main(){unsignedchar a;
lcd_init();for(a ='A'; a <='O'; a++){
msdelay(50);
lcd_data(a);}
lcd_cmd(0xc0);for(a ='P'; a <='Z'; a++){
msdelay(50);
lcd_data(a);}}