Hello Travis,
The alternate RSTO function on the PTC4 pin, that you have allocated to the LCD pin RS, is controlled by the SOPT1 register. This is a write once register, so it is probably a good idea that your initialisation code explicitly writes to this register, possibly with the power up default value.
The initLCD() function should strobe the display when the data value 0x3 is present. The strobe pulse should occur three times, with a minimum delay of 4.1ms between the first and second strobes, and a minimum delay of 100us between the second and third strobes, (according to AN1745). The application note also suggests that the value 0x2 be strobed to the display immediately following the third strobe pulse above.
I also notice that your code for the functions LCDCmd() and LCDChar() seems identical. You appear not to explicitly clear or set the RS bit, as required. Since RS belongs to the same port as the data nybble, the default value will be clear following the write to the port register, so must be set (when required), prior to each strobe pulse.
I would assume that the MCU operates from a supply of 3 volts, and the LCD display from a supply of 5 volts. Additionally, I assume that you do not have additional level shifting circuitry between the the two units. My understanding is that the 3 volt logic swing originating from the MCU will just meet the input logic-high lower limit for the LCD interface, so should be satisfactory. However, if the read of data from the LCD module should be attempted, this is likely to be problematic for the MCU because of over-voltage.
I suggest that you do not attempt to read the busy flag, but rely on suitable timing delays for the completion of each command. A 40 us delay should probably be included before the LCDCmd() and LCDChar functions terminate. But note that the Clear Dispay and Home Cursor command require considerably more delay. If delays are used, the RW line might be permanently tied low.
Regards,
Mac
Message Edited by bigmac on 2009-03-17 05:49 PM