LCD initialing

Status
Not open for further replies.

zeeba

New Member
Hi
I want some help to anderstand this code specially Initialise the LCD [LCD commands] >>watch the numbers in red how do we choose them??

I tried it on the board but nothing was displayed on the LCD what is the problem??

 
The figures in red come from the datasheet, and are included in the table at the top of my tutorial.

If it doesn't work, then you've probably connected something wrong - the routines (and hardware) are fully tested and working, and in use by many people all round the world.

Typical mistakes are trying to make it on breadboard, which is unreliable and prone to mistakes, or shorting two of the pins together on the LCD.
 
Nigel Goodwin!! are you the real one who wrote this code?? that's so interesting =]

anyway,
I have the data sheet for the LCD and the PIC, but I didn't understand how to choose to write 20H I mean why is is 20 not 2 or any other number?? I now it's from the data sheet but again I didn't get it

I don't think it a matter of connection because I've checked it many times as well as my partners
 
Nigel Goodwin!! are you the real one who wrote this code?? that's so interesting =]

Yes, that's me.


Like I said, there's a table at the top of my tutorial (labelled 'LCD Command Control Codes') which gives you a specifc bitwise list of the different commmand codes.

You then, as the datasheet explains, feed the correct sequence of initialising commands to the LCD.

If it's NOT initialised, then you should be able to see a single line of solid block characters as you turn the contrast up.
 
Iam using PIC16F876A and LCD is HD44780U
I've changed simple things in the original code inorder to suit my PIC but still it's not working
what do you think the problem is??

the code in the first post is with the changes I made

the hardware connection is :

from B0 to B3 is connected to D4 to D7

RS is connected to C4

E is connected to C7

RW is connected to 0V
 
If you've altered the pin connections then you will have to substantially alter the code to match it - my code is designed for specific pin connections.

Why would you try and alter it?.
 
Just wondering - is Assembly a must for this project? If it is, then please disregard this post!

If not, then you could make use of a higher language (such as Swordfish/Proton/C) that makes the above issues quite easy to tackle, consider:

Code:
Device = 18F4520
Clock = 20
 
// some LCD options...
#option LCD_DATA = PORTD.4              // Assign the LCD connections
#option LCD_EN = PORTD.3                //
#option LCD_RS = PORTD.2                //
 
// import LCD library...
Include "LCD.bas"
Include "convert.bas"
Dim Variable As Word
 
// Start Of Program...
DelayMS(150)                            // Let the LCD warm up
LCD.Cls                                 // Clear the LCD screen
LCD.WriteAt(1,1,"Hello World")          // Send some text to the LCD
Variable = 0                            // Clear the "Variable" register
While True
    Inc(Variable)                       // Increment the "Var1" register
    // Convert to a string,
    //  and always display 5 characters   
    LCD.WriteAt(2,1,Convert.DecToStr(Variable,5))  
 
    DelayMS(1000)                       // Delay for 1 second                
Wend

**broken link removed**

An old school video from the guide:

 
Last edited by a moderator:
hi gramo aka spencey.

Long time no see.

Regarding Swordfish, heard some talk that its not been supported or upgraded for sometime, have you any factual data about its current status.??
 
Last edited:
Hi Eric, yes - been quite a while!

Re Swordfish - it did get a little quite for a while, and there were a lot of rumours getting around.. David Barker is back an has released 4 updates in the last month (it looks like he's back from what we can only assume was the Amicus project)

**broken link removed**
 
It would be a shame if swordfish went away. I hope it is not so, but if it is perhaps the author could be persuaded to make it open source so people could at least add new chips.
 
If you've altered the pin connections then you will have to substantially alter the code to match it - my code is designed for specific pin connections.

Why would you try and alter it?.

I tried to to adjest the code to suite my PIC if you see the code you will notice some changes

actually Im having senior project and Iam rush in time so seriosly I neeed help in this Im trying hard but Iam not good in programing

If you can help me I would appritiate it so much
 

thanQ for your help but I don't prefer to work with C language I need to do it in assembly
 

hi,
Many thanks for the info, its good news.

Regards
 

Move the pin connections back - the port doesn't matter, but it's VERY important that the data pins connect to the first four bits (in the correct order).
 
Hi
I want some help to anderstand this code specially Initialise the LCD [LCD commands] >>watch the numbers in red how do we choose them??

I tried it on the board but nothing was displayed on the LCD what is the problem??
Try this link
EPE FAQs & Resources
the lcd pdf's are very informative (shout out to eric gibbs who posted the links in another thread)
 
OK before I see any thing..
If I want to use the original code for defferent PIC which is 16F876A what should I change ??


BTW Iam getting a single line of solid block characters as you turn the contrast up .
 
Last edited:
OK before I see any thing..
If I want to use the original code for defferent PIC which is 16F876A what should I change ??

There are versions of the code for the 16F876 and 16F877, for the 'a' version you only need to alter the config fuse settings.
 
where can I find those codes??

I've just checked - and I haven't added any on that tutorial, but the differences are trivial, and listed here:



I've used the same tutorial code on various PIC's, and different ports, with not a single problem.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…