• AVR Freaks

Hot!Noob looking for turn-key 2004 LCD Display Hello World C Code

Author
t1d
Senior Member
  • Total Posts : 129
  • Reward points : 0
  • Joined: 2015/01/26 15:49:24
  • Location: 0
  • Status: offline
2019/09/18 23:34:32 (permalink)
0

Noob looking for turn-key 2004 LCD Display Hello World C Code

Particularly for a clone 2004 LCD Display with an assumed HD44780 IC using 8-pin configuration on a 18F4550.
 
I have done my homework and searched the web for example programs. I have worked with at least eight C code programs and I have yet to find one that is plug and play. These displays are known to be finicky about delays for startup and initialization procedure.
 
I know enough about the hardware side of things to be confident that all of my hardware setup is correct... Pins confirmed. Continuity confirmed. Traffic seen on my oscilloscope. Etc. I have tried various displays; I have several... both 2004 and 1602.
 
Please do not tell me that there are plenty of good programs, if I just will give it a google. I have used Student Companion, Electric Wings, Microchip Forum, PIC Forum, and others, all to no avail.
 
I have had intermittent success, with the full circuit working and displaying everything correctly - once... I turned it off and back on and its back to not initializing.
 
This type of behavior is known for these displays, when having initialization problems. Initialization procedure, timing, oscillator settings and voltage can all cause picky problems.
 
At this point I am frustrated and just want to see a code that works. And, I do not want to go I2C, because I want to learn what is wrong with what I have. For me, learning by seeing is best.
 
I am past trying to work through the problems. So much as I don't even want to adjust code working for some other series of PIC. Sorry to whine, but I am fed up.
 
So, I am hopeful that there is a generous sole that knows they have good code and is willing to share it.
 
Thank for your help. My apologies for any ranting.

 
#1

11 Replies Related Threads

    ric
    Super Member
    • Total Posts : 23864
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/18 23:46:19 (permalink)
    +1 (1)
    Why start a second topic when you just started the one at https://www.microchip.com/forums/m1112800.aspx ?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    t1d
    Senior Member
    • Total Posts : 129
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/18 23:50:09 (permalink)
    0
    Hi, Ric,
     
    Thanks for your help.
     
    They are two separate topics. One for the libraries and one for code. If I had put them together, somebody would have said I shouldn't have. So, what to do?
    #3
    pcbbc
    Super Member
    • Total Posts : 1329
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/19 01:08:55 (permalink)
    0
    t1dunnI have had intermittent success, with the full circuit working and displaying everything correctly - once... I turned it off and back on and its back to not initializing.

    Post that project and we can make suggestions as to what is wrong.
    Usually just adding some extra delays during initialisation gets things working. If it worked once then chances are the timing is right on the edge of what is acceptable to the display.
    #4
    t1d
    Senior Member
    • Total Posts : 129
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/19 01:54:13 (permalink)
    0
    pcbbc
    Post that project and we can make suggestions as to what is wrong.
    Usually just adding some extra delays during initialisation gets things working. If it worked once then chances are the timing is right on the edge of what is acceptable to the display.

    I very much appreciate the offer to help correct the code. I have already added the delays and still no joy.
     
    I need to leave the code alone for awhile, to get things back into perspective. That's why I asked for a complete working code. If someone doesn't contribute that, I will let you know.
     
    You a very gracious to jump in. Thank you.
    #5
    PStechPaul
    Super Member
    • Total Posts : 2399
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/19 21:41:46 (permalink)
    0
    It is difficult to write a library for all character LCD displays and all PICs. But here is some code that might work for you. One of these is for a PIC18F2455 and the other is for a PIC16F883. I think both of them use an 8 bit data bus. Good luck!
     
    http://enginuitysystems.com/pix/electronics/LCD_Display_1.zip
     
    http://enginuitysystems.com/pix/electronics/LCD_Display_MikroC%20(2).zip
     
    And here is some code for I2C as used on an LCD display:
     
    http://enginuitysystems.com/pix/electronics/I2C_PES.zip
    http://enginuitysystems.com/pix/electronics/LCD_PES.zip
     

     
    #6
    t1d
    Senior Member
    • Total Posts : 129
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/20 12:10:54 (permalink)
    0
    PStechPaul
    It is difficult to write a library for all character LCD displays and all PICs. But here is some code that might work for you. One of these is for a PIC18F2455 and the other is for a PIC16F883. I think both of them use an 8 bit data bus. Good luck!
     
    http://enginuitysystems.com/pix/electronics/LCD_Display_1.zip
     
    http://enginuitysystems.com/pix/electronics/LCD_Display_MikroC%20(2).zip
     
    And here is some code for I2C as used on an LCD display:
     
    http://enginuitysystems.com/pix/electronics/I2C_PES.zip
    http://enginuitysystems.com/pix/electronics/LCD_PES.zip
     


    Thanks, Paul! You are always so gracious to help.
    One file title says it is for MikroC. Will that compile in MPLab X v5+, XC8; v2.10?
    #7
    PStechPaul
    Super Member
    • Total Posts : 2399
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/20 13:18:09 (permalink)
    0
    All of these use XC8. The version fort MikroC emulates the MicroC functions that were used in the original code that I was modifying for someone.

     
    #8
    t1d
    Senior Member
    • Total Posts : 129
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/20 13:39:35 (permalink)
    0
    PStechPaul
    All of these use XC8. The version fort MikroC emulates the MicroC functions that were used in the original code that I was modifying for someone.


    Thanks for the fast answer.
    I tried LCD_Display_1. It looks like it might be for a PIC18F4455, using PortD for the data lines. I am using a 18F4550, with the data lines on PortB. Also, PI-250_PCB.h is missing. I commented it out, thinking that you did not include it, because it is not needed for the present purpose. Then, a whole bunch of other stuff becomes undefined. I tried C90 and C99. But, thank you for trying to help me.
    #9
    dan1138
    Super Member
    • Total Posts : 3229
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/20 14:14:29 (permalink)
    0
    t1dunn
    I tried LCD_Display_1. It looks like it might be for a PIC18F4455, using PortD for the data lines. I am using a 18F4550, with the data lines on PortB. Also, PI-250_PCB.h is missing. I commented it out, thinking that you did not include it, because it is not needed for the present purpose. Then, a whole bunch of other stuff becomes undefined. I tried C90 and C99. But, thank you for trying to help me.



    A project on git hub for the PIC18F4550 with an LCD and 3 x 4 keypad is here.
     
    It may be of some help.
    #10
    t1d
    Senior Member
    • Total Posts : 129
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/20 15:04:46 (permalink)
    0
    dan1138
    t1dunn
    I tried LCD_Display_1. It looks like it might be for a PIC18F4455, using PortD for the data lines. I am using a 18F4550, with the data lines on PortB. Also, PI-250_PCB.h is missing. I commented it out, thinking that you did not include it, because it is not needed for the present purpose. Then, a whole bunch of other stuff becomes undefined. I tried C90 and C99. But, thank you for trying to help me.



    A project on git hub for the PIC18F4550 with an LCD and 3 x 4 keypad is here.
     
    It may be of some help.


    Thanks, Dan. Much appreciated.
    #11
    t1d
    Senior Member
    • Total Posts : 129
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: Noob looking for turn-key 2004 LCD Display Hello World C Code 2019/09/20 15:08:20 (permalink)
    +2 (2)
    @Paul...
    I have gotten the original code working. So, I am making this quick post to let you know, in hopes of saving you the effort of customizing your code to my needs. I will post my findings, when I have more time.
     
    Thanks to everyone.
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5