Thursday, February 5, 2009

PIC18 HD44780 LCD Driver Interface Code

Update 2013-03-25:

I've updated this example code to work with the latest Microchip XC8 compiler. The code is working perfectly with a PIC18F14K50, but can be very easily modified for use with any PIC.



  1. Hi. I'm playing with one of those displays and sometimes due to electrical reasons, my displays completely hangs up (display goes off and ignores all my messages). How could I detect this hang up? I've tried to check the busy flag but this does not help me.
    I've also tried to compare the value stored in first slot in DDRAM with its theorical value but also seems to not work. I have no more ideas.

  2. This code attempts to call on the 'delays.h' header file. Can you post this file code? Thanks!

  3. delays.h is included with Microchip C18

  4. how can we get this code to show a floating variable?

    Somehow if you do a printf with a float variable, the variable won't appear on the LCD.

    But you printf with a int variable, it works.

    Thanks for your advice in advance

  5. Hmm, printing anything should work. It's just a normal printf. Whatever printf prints will be displayed on the LCD via the LCD putc. I don't know why it wouldn't work.

  6. hmm compiled this in c18 and ran in pic18 simulator and all i get is one garbage character...

  7. hi.. i cant put floating var into the sentence.. hope to seek some reply..

  8. It`s a perfect running code!
    Thanks a lot!

  9. A #DEVICE required before this line
    1 Errors, 0 Warnings.
    Halting build on first failure as requested.

  10. Just updated this example for the latest xc8 compiler:

    Everything is working, tested on a PIC18F14k50.

  11. can use LCD with pic18f4685?
    MPLAB C18 compiler

    Can you do upload again?