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.

HD44780 LCD hookup question, using PIC18F1320, C18

Status
Not open for further replies.

Triode

Well-Known Member
I'm trying to make this lcd useful. I've found plenty of example that just hand you the C18 code, such as this
and **broken link removed**

Im currently trying to do the second one (code at bottom so it doesn't cloud up the post). The code compiles, but I'm confused about the connections. It specifies the connections to the LCD as:
PORTBbits.RB4 Pin used for the E line.
PORTBbits.RB5 Pin used for the RS line.
PORTBbits.RB6 Pin used for the RW line.
Data Lines PORTB

My question is, isn't it a problem to use PORTB for two things? pins B4,5 and 6 are being used for specific things, then again for the whole set of data lines. I figured it might mean to skip them, but then there arent enough, data lines to the LCD are 7-14, (datasheet for my lcd) which requires all of a port. If I use them all, well the chip doesn't detect to program, so I don't know that the LCD wouldn't work. Which I guess might just mean I have to connect it all with some overlapping but not connect the programmer and the LCD at the same time, but that doesn't make sense to me anyway, because how could you use the same pin for two things?

Maybe I just need to redefine the outputs, but I haven't worked with serial communication much, so I'm not sure how to do that, I don't even see in this code where they define which outputs to use.

little help?

Edit: after posting this I found this guide and I'm going through it, it looks pretty through, I'll post if it works in case someone else comes in here looking for how to do this.
 
Last edited:
Those LCD modules can be used in 4bit mode so only the 4 upper data lines from the LCD are required.
 
that makes more sense then. so should I just hook up 11-14 to port B 0-3?
 
Last edited:
Yes, that would work. You also have to change the code as mentioned in the library pdf:
 

Attachments

  • 4or8bit.PNG
    4or8bit.PNG
    59.8 KB · Views: 262
Thnaks,
ive changed the call in openlcd to FOUR_BIT, and left UPPER undefined. I'm not sure what else is needed.

btw is it normal the the chip wont program when the LCD's logic power is connected?
 
What programmer are you using? It is possible that it can't supply enough 5V for both the PIC and the LCD.
 
A junebug. And thats a good point, I'll hook up a 5V supply and see if it takes care of it.
 
Hi triode, i myself am making a tutorial of C18 libraries and will upload them soon.Here is a working model of the XLCD part.Use Proteus to run simulation.Please leave comments. I will upload them as soon as i finish all the material.
 

Attachments

  • software lcd.zip
    5.2 KB · Views: 220
  • 18f1320lcd.zip
    15.4 KB · Views: 205
To get more power from the Junebug to the target especially for an LCD with backlight, put a small wire jumper on the 16 pin header between U5V & +5V
This will supply current directly from your USB port.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top