Hi guys
I am posting this here, after going nuts trying to figure it out myself (repeatedly) and much googling with no luck.
I have a PIC16F88 and a 2 x 16 serial LCD using a ST7036 Sitronix controller. The controller is HD44780 compatible. The display remains blank (ie: nothing happens).
The code is as follows:
Code:
INCLUDE "modedefs.bas"
DEFINE OSC 4
DEFINE CHAR_PACING 1000
@ DEVICE PIC16F88, INTRC_OSC_CLKOUT, WDT_OFF, PWRT_ON, BOD_OFF, MCLR_OFF, PROTECT_OFF
osccon = %01101110
sspcon = %00110001
trisb = %00000000
disable interrupt
pause 500 ' wait for LCD to startup
LCD_ChipSelect var portb.0
LCD_CommandLow VAR portb.1
LCD_SerialIn VAR portb.2
LCD_Clock VAR portb.4
Symbol LCDMode = N1200
HIGH LCD_ChipSelect ' select LCD on SPI bus
LOW LCD_CommandLow ' select command mode
Serout LCD_SerialIn, LCDMode, [$38] ' function set
pause 50
Serout LCD_SerialIn, LCDMode, [$39] ' function set
pause 50
Serout LCD_SerialIn, LCDMode, [$14] ' bias
pause 50
Serout LCD_SerialIn, LCDMode, [$78] ' contrast set
pause 50
Serout LCD_SerialIn, LCDMode, [$5E] ' contrast control
pause 50
Serout LCD_SerialIn, LCDMode, [$6E] ' follower control
pause 200
Serout LCD_SerialIn, LCDMode, [$0C] ' display on
pause 50
Serout LCD_SerialIn, LCDMode, [$01] ' clear display
pause 50
Serout LCD_SerialIn, LCDMode, [$06] ' entry mode right
pause 50
HIGH LCD_CommandLow ' data mode
loop:
Serout LCD_SerialIn, LCDMode, ["Hello world"]
Pause 500 ' Wait .5 second
Goto loop ' Do it forever
So, since this is my first ever LCD project, I have probably made a bunch of assumptions which have gotten me into trouble. Any criticism or pointers would be much appreciated.
Best regards
Richard
Bookmarks