Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic18f4550 and lcd

Status
Not open for further replies.

neelam29

New Member
dear all
m trying to interface 16 x 2 LCD with pic18f4550.please help me with code
 
Last edited:
How is your LCD connected to your Pic, the above code assumes it is connected via a serial shift register.

Mike.
 
Why are you using the 74595? You can conrtol the LCD with a few pins, and your using an 18F4550

**broken link removed**

And after setting up the code, its fairly easy to interface with them with higher languages

Code:
Device = 18F452
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)                       // Decrement 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

Not being familiar with C, this is my breakdown of LCD interfacing with pic's, might give you ideas on wiring and the such?
 
i have to make further more applications in this for which m short of pins..so m using IC74595 and specifically it is mentioned in my college to use the chip 74595.so please help me find mistake in the same code of mine.
 
Without looking too closely you have the following:-

lcd_goto(0x80);

If this routine does what I think it does , then the text will be off screen anyway, try 0x00 or 0x40.

Mark
 
UTMonkey said:
Without looking too closely you have the following:-

lcd_goto(0x80);

If this routine does what I think it does , then the text will be off screen anyway, try 0x00 or 0x40.

Mark
That command is correct. It's the command code plus the address 00h for Line 1.
Code:
        radix   dec
Line1    equ     128             ;
Line2    equ     128+64          ;
Line3    equ     128+20          ;
Line4    equ     128+64+20       ;
 
nice thread..
we wanna do the same..
using a 2 x 16 LCD to PIC18F4550..
and using C as the source code..

1. How are we going to connect the pins??
2. How is the code done (example code)??
 
Hi urefowei!

Try this link: Bitmap Calculator for KS0108, HD61202 and similars....

Look at the bottom of page for character or graphich type LCD. They also has wonderfull simulator for graphicg LCD. Look arround on Internet.
I used most popular LCD with HD44780 controller. This type of LCD can be initialised to work in 4-bit or 8-bit data mode.
This means that in the 4-bit mode the data must be send in nibbles: 4 MSB`s (4-7) first than 4 LSB`s (0-3). In 8-bit data mode whole byte is sending at once. I wrote this line of text because there is explanation only for 8-bit mode.
One of the best articles that helped me to made my LCD to work is at http://www.jameco.com/Jameco/Products/ProdDS/652332.pdf but the interesting part is at Adobe PDF Reader page 50.

Peca.
 
Last edited:
Be patient :) I am translating comments from serbian to english in my working project PIC18F4550+HD44780 2x16 TLCD (I am very, very short on time).
 
Last edited:
I finished my work.
Look at the new thread: "Again: TLCD HD44780 + PIC18F4550 for education". I started a new thread for more people to see and to use it.
I also, attached the whole project in one *.zip file.
That code works fine on my board so I am very curious to know the results from other.
So, I hope that you will turn ON your TLCD and work with it because it seems to me that the command set is identical. Good luck!
Ask me and I will try to answer everything that I know.
 
Status
Not open for further replies.

Latest threads

Back
Top