I am new to using the PICBASIC but I have background experience with PIC microcontrollers. I am trying to learn how to use an LCD with a PIC16F687. I have tried to copy the example that I found on the MELABS website but it does not seem to functioning. The program will compile just fine but when the micro does not seem to be doign anything when powered up. I am using a scope and it appears that the Data bit pins are just cycling on and off about every 500 ms. I am not sure what I am supposed to be looking at. I would assume that the pins would be switching at a fast rate but I am not seeing that happen. I modified my program to use the PORTC instead of PORTA for the data bits. No other pins are changing. Any suggestions? Thanks for the help.
Below is the code.
DEFINE OSC 4
DEFINE LCD_DREG PORTC 'set LCD DATA port
DEFINE LCD_DBIT 4 'set starting DATA bit (0 or 4) if 4-bit
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 6 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us
'CMCON = 7
ADCON1 = 7
ANSEL = %00000000
TRISA = %00000000
TRISB = %00000000
TRISC = %00000000
PORTA = %00000000
PORTB = %00000000
PORTC = %00000000
Pause 500 ' Wait for LCD to startup
loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second
Goto loop ' Do it forever
Bookmarks