16×2 LCD and PIC 18F4550

Home Forums Microcontrollers PIC Microcontroller 16×2 LCD and PIC 18F4550

Tagged: , ,

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #12675
    b0rg
    Participant

    Hi,

    I’m trying to interface 16*2 LCD with pic18f4550 using the code in attachment. I checked the pins and they are declared correctly alsoI’m using 8Mhz external crystal. I also checked one other LCD library which seems to be working, however when using this code I’m getting 1st row black squares like something hasn’t been initialized properly.

    Any input would be really great.

    Thanks

    #12680
    Ligo George
    Keymaster

    Are you sure that it is working with another LCD library ?

    #12681
    b0rg
    Participant

    Yes, as I said in the first post, it works with another library.

    #12682
    Ligo George
    Keymaster

    Are you sure that your PIC microcontroller is oscillating fine ? Just check with LED blinking first and also try replacing PORTBbits with LATBbits.

    #12683
    b0rg
    Participant

    Hi, thanks for the answer. I did first run a LED test, and it works fine, perhaps a bit faster than expected so I also suspect that it is probably oscillator settings, but I can’t find whats wrong in config.h. I did set FOSC = HS in order to use external crystal. Did I miss something ?

    Thanks

    #12684
    b0rg
    Participant

    LATBbits did the black squares trick. However some of the text on the LCD is garbage. for example http://www.electrosome.com looks like elec7roume.6m.

    This is still frequency problem?

     

    thanks

    #12686
    Ligo George
    Keymaster

    It can be frequency problem, noise problem etc. Try reduce the wire length to LCD if you are using long wires and also try adding more filtering capacitors.

    #12687
    b0rg
    Participant

    Hi. Something else lets me believe that its more probable to be code problem rather than hardware. When I tried it with the other LCD library but using internal oscillator (4 mhz input) it did work properly with multiple line outputs. But with this code it outputs some garbage. Will have to check datasheet again for the oscillator settings.

     

     

    #12688
    Ligo George
    Keymaster

    Then try using internal oscillator.

    #13446
    John Jason
    Participant

    Hi,

    I did experience this before, perhaps you should try CodeOffset to 1000 and see if that works (In your programming software)

    Hope that helps!

    John

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
>