Content originally posted in LPCWare by Rob65 on Tue Sep 10 07:43:17 MST 2013
That looks more like it - thanks.
What kind of LCD controller are you using?
Are you sure about the levels of LCDEN and LCDWR.
You code assumes that the LCDEN is active high, the LCD I use has an active low enable pin.
And the R/W line ? You are setting LCDWR high to read and low to write (seems OK to me but you never know)
Same goes for LCDRS: 0 = Control register and 1 = Data register ???
The lcd_data_write and lcd_command_write look strange.
You first set LCDEN, then set the data, then clear LCDEN, then set LCDEN again, set the data and clear LCDEN.
After this you call wait_lcd().
Make sure the data and LCDRS are set to the correct values before triggering LCDEN.
as an optimization: combine lcd_command_write() and lcd_data_write(), they are the same (they should be) except for the value of LCDRS.