Home › Forums › Microcontrollers › PIC Microcontroller › 16×2 LCD and PIC 18F4550
- This topic has 9 replies, 3 voices, and was last updated 6 years, 1 month ago by John Jason.
-
AuthorPosts
-
July 11, 2016 at 6:38 pm #12675b0rgParticipant
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
July 11, 2016 at 8:29 pm #12680Ligo GeorgeKeymasterAre you sure that it is working with another LCD library ?
July 11, 2016 at 8:35 pm #12681b0rgParticipantYes, as I said in the first post, it works with another library.
July 11, 2016 at 8:48 pm #12682Ligo GeorgeKeymasterAre you sure that your PIC microcontroller is oscillating fine ? Just check with LED blinking first and also try replacing PORTBbits with LATBbits.
July 11, 2016 at 9:14 pm #12683b0rgParticipantHi, 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
July 11, 2016 at 9:19 pm #12684b0rgParticipantLATBbits 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
July 11, 2016 at 9:30 pm #12686Ligo GeorgeKeymasterIt 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.
July 11, 2016 at 9:33 pm #12687b0rgParticipantHi. 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.
July 11, 2016 at 10:13 pm #12688Ligo GeorgeKeymasterThen try using internal oscillator.
January 30, 2017 at 11:18 am #13446John JasonParticipantHi,
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
-
AuthorPosts
- You must be logged in to reply to this topic.