Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

print letter on display using program

Status
Not open for further replies.

vead

Full Member level 5
Joined
Nov 27, 2011
Messages
285
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Activity points
3,815
Hello everyone

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
 
Last edited:

Just use a counter as an index into an array. Use a for loop, or a while loop, or whatever.
 

Just use a counter as an index into an array. Use a for loop, or a while loop, or whatever.

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?

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#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 3
 
void msdelay(unsigned int time)  // Function for creating delay in milliseconds.
{
    unsigned i,j ;
    for(i=0;i<time;i++)
    for(j=0;j<1275;j++);
}
void lcd_cmd(unsigned char command)  //Function to send command instruction to LCD
{
    display_port = command;
    rs= 0;
    rw=0;
    e=1;
    msdelay(1);
    e=0;
}
 
void lcd_data(unsigned char 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()
 {
 unsigned char 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);
  }
 }

 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top