Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: hazzer123 on January 19, 2008, 07:02:49 PM

Title: Hitachi HD44780 LCD
Post by: hazzer123 on January 19, 2008, 07:02:49 PM
I have a standard Hitachi HD44780 LCD module, and i am trying to show some text on it using a PIC18f4525 and Microchip C18. I am using the XLCD library with C18.

So far i have not ben able to display anything. When i hook everything up to the power, the top line of the display is just a line of blocks (every pixel is dark) and the bottom is clear (no pixel is dark). When i run the MCU nothing happens on the display. If i put an LED on the pins of the PIC which communicate with the LCD it flashes as if data is being sent.
Im starting to think the module may be faulty.

Is there any way of knowing if it is faulty or not?

Any ideas?

Thanks
Title: Re: Hitachi HD44780 LCD
Post by: rgcustodio on January 19, 2008, 07:27:27 PM
Maybe the code is sending data incorrectly.

BTW, have you set the contrast properly?

This could be of some help:
http://home.iae.nl/users/pouweha/lcd/lcd0.shtml
http://ouwehand.net/~peter/lcd/lcd.shtml
http://www.repairfaq.org/filipg/LINK/F_Tech_LCD.html
Title: Re: Hitachi HD44780 LCD
Post by: hazzer123 on January 19, 2008, 07:34:16 PM
Thanks for your reply again :D

I have just been going through the code instruction by instruction. I have found something but using LEDs on the 4 data lines.

I found something really strange. When any of the bits on the PORTA of my PIC are changed, the whole port seems to reset. For example -
 
I have 5 bits: Enable, then D8 - D4 on my PORTA. I set the bits i need for the nibble i want to send to the LCD but when i try to strobe the enable pin with this code -
Code: [Select]
PORTAbits.RA4 = 1The D8-D4 turn off and the enable turns on.

The same happens with this code -

Code: [Select]
PORTA ^= 0b00010000;
I don't know why this is...

Any ideas.
Title: Re: Hitachi HD44780 LCD
Post by: rgcustodio on January 21, 2008, 03:17:35 PM
i don't have any ideas :( sorry i'm not a PIC guy.
Title: Re: Hitachi HD44780 LCD
Post by: hazzer123 on January 21, 2008, 04:11:33 PM
No Problem, I went to the microchip forum and they helped me out. Apparently a new feature of the PIC18s means that you use LATA (meaning Latch on port A) as your port register rather than PORTA as with PIC16s. Im not really sure of the electronics behind this, but it works.

so the new code is

Code: [Select]
LATAbits.LATA4 = 1
Thankyou anyway :D
Title: Re: Hitachi HD44780 LCD
Post by: airman00 on January 21, 2008, 05:12:34 PM
No Problem, I went to the microchip forum and they helped me out. Apparently a new feature of the PIC18s means that you use LATA (meaning Latch on port A) as your port register rather than PORTA as with PIC16s. Im not really sure of the electronics behind this, but it works.

so the new code is




Code: [Select]
LATAbits.LATA4 = 1
Thankyou anyway :D

thanks for sharing the answer , it will come in helpful for me later  ;)