LCD programming help. PIC, Assembly.

Status
Not open for further replies.

oasacorp

Newbie level 4
Joined
Jul 5, 2011
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,330
I am an absolute beginner, and I just want to learn how to program on LCD. I am using Oshon PIC Simulator. Since am a beginner I want to interface it in 8-bit mode. I have read some tutorials from : Lcd display - Pic tutorial - Tutorials and **broken link removed** . I understood the concepts and all. I tried to program myself understanding the steps (in my 2nd link). The steps that I found from some other site is :


1) Initialize the LCD.

2) Select the command or instruction register (RS=0 or RS=1).

3) Set RW low (to write to LCD).

4) Send a high to low pulse on EN pin.

5) Check if the LCD is busy (Optional Step, it eliminates the delay issue).

6) Move to instruction or command function.

7) Repeat above steps


And as for the first step, Initialize, I followed the flowchart for 8-bit from the second site. This is what I understand :
1) give time to initialize
2) Send 00110000 to the Data Pins and RS=0, R/w =0
3)wait
4) send 00110000 again
5) send 00110000 again
6) send 00011000 as i want only 1 line and 5X7 display
7) send 00001000 to set display off
8) send 01h to clear
9) send 00000110 - I am not sure about this. It is some entry mode. Which i chose as increment and shift off. I dont know what this do.

Having completed with the first step, the second is set RS=0.

I set RW=0

This is another part where am not clear with. Assuming you just have to send a 1 and then after some time 0. I made a subroutine which does this :

Code:
 pulse_e
 bsf PORTA,1 ;set enable pin high to low
 call delay
 call delay
 call delay
 bcf PORTA,1
 Return

I am not checking Busy Flag.

Then I moved 41h to the Data Bus. (to Display 'A')

I just want it to display 'A'. Unfortunately I cant see. Can you guys please help ?

I have attached my source. View attachment lcdtry.txt Its not optimized. I have called many unnecessary delays. Whenever the simulator said "Delay error" i added one to avoid all delay errors. But still nothing. Any help is appreciated
 
Last edited:

Hi,

The lcd routine is not an easy one for a beginner to code, so do not be concerned about using some existing code to get you going.

There are several good lcd routines around, some handling the data in slightly different ways - each with their own advantages.

Have a look at these three good tutorials -
PIC Tutorial* Three - LCD Modules
EPE FAQs & Resources
**broken link removed**
 

If you wish to try with your own code check out the commands that the lcd uses and timing required.

**broken link removed**

As the previous poster said, they are not the easiest thing to start with.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…