I'm having problems with my LCD (both in real life and simulator) on a
PIC18F system not showing anything, after ensuring that the hardware
is connected properly. I'm beginning to suspect that either my
sequence of operations on the LCD during the initialization before
writing anything isn't done properly, or the timing of the command
functions that I have called (those functions are built-in with mikroC
development suite) aren't proper for my LCD (even though their library
functions are said to be for HD44780 compatible LCDs). It would
fantastic if someone replies on the basic sequence of operations that
I should be instructing the LCD in order for it to work. I have
basically initialized in the program where the data port, RS, Enable,
and R/W pins are connected, turn on the LCD module, clear the display,
turn the cursor display/blinking off, and return the cursor to top
left corner. Thanks!
The mikroC libararies work fine... I've tested them. Check your connections, your contrast, and make sure you have Digital IO for the PIC pins feeding the LCD. If you want to look at some mikroC LCD source code, I wrote a program that writes the modules and functions based on your pin assignments. It helps optimize the code and speeds up the processes:
I have posted a thread on https://www.mikroe.com/forum/viewtopic.php?t=12630 . It has the link to the project folder that I'm having trouble with if you're interested in seeing more details. Does mikroC functions on the LCD incorporate the delays, or do I have to incorporate them myself?
i did't see your post completely and the message was posted by me. Hence i have reoved the content that i posted.
you have provided details, and i was able to see them-as such no issues onwhat you posted, Please
I have one more question, more of a conceptual one: what is the advantage of operating the LCD in 4-bit mode rather than 8-bit mode besides reduction of the amount of pins used on the microcontroller?
I have one more question, more of a conceptual one: what is the advantage of operating the LCD in 4-bit mode rather than 8-bit mode besides reduction of the amount of pins used on the microcontroller?
The only advantage is the reduction in the number of pins. The only disadvantage is slightly slower code. A lot of people don't connect the RW line to save 1 more pin and use a delay after each write to the LCD. Using 6 pins instead of 11 can be the difference between an 18 and a 28 pin pic.
I've posted a routine for MPASM (18F4550) for the Unicorn kit that also includes the soft reset that is often ignored for a typical 16x2 LCD display, It's at the end of the Unicorn Assembly Instructions on my site.
Uses timed slow & safe 50ms delays to get it started but then uses the very fast busy flag in the main routine. **broken link removed**
I haven't gotten it working yet (haven't gotten around to it). I'm still playing around with your example. I've noticed that your example uses a 4-bit interface. I am pondering of switching from an 8-bit interface to a 4-bit interface since I don't benefit much from using an 8-bit interface in terms of execution speed anyway.
I have something that I don't understand in your delay loops in the examples. Why did you declare t0 in the parameters as type char rather than type int?
Also, I have yet to try your code on an actual LCD, but it is not working with the Oshon PIC 18 Simulator.