Hey
Hope there is somebody there can help us with some trouble with an LCD display
We are trying to write to a LCD display but the display doesn't show any signs of response. We have an LED to flash during the program to make sure it is running through it. We are using "PICDEM 2 PLUS DEMO BOARD 2006" as our platform for the controller and LCD, so the connection should be correct. As our microcontroller we have an 16F877A and as the programmer "MPLAB ICD 2"
Our codes is written in PicBasic
'*********Start***********
' Example program from manual to blink an LED connected to PORTB.0 about once a second
Define conf_word = 0x3f72
Define clock_frequency = 4
Alldigital
'Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
'Set number of lines on LCD
DEFINE LCD_LINES 2
'Set command delay time in us
DEFINE LCD_COMMANDUS 1500
'Set data delay time in us
DEFINE LCD_DATAUS 44
'Set LCD Data port
DEFINE LCD_DREG PORTD
'Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 0
'Set LCD Register Select port
DEFINE LCD_RSREG PORTA
'Set LCD Register Select bit
DEFINE LCD_RSBIT 3
'Set LCD RW Select port
DEFINE LCD_RWREG PORTA
'Set LCD RW Select bit
DEFINE LCD_RWBIT 2
'Set LCD Enable port
DEFINE LCD_EREG PORTA
'Set LCD Enable bit
DEFINE LCD_EBIT 1
Pause 1000
DEFINE LCD_READ_BUSY_FLAG = 1
TrisD = %00001011
TrisA = %00000000
PortD = %00000000
Pause 1000
TrisB.3 = 0 'turns off a LED
loop:
PortB.3 = 1 'turns on a LED
LCDOUT $FE,1
PAUSE 500
PortB.3 = 0 'turns off a LED
LCDOUT "Hello World"
PAUSE 1000
Goto loop ' Go back to loop and blink LED forever
End
'*********End***********
Bookmarks