Greetings ,All
Can someone please help me with this code for 16f628a, it does not work I get black squares on the lcd first line. I verified that pic is working and the lcd is lalso working and the circuit is working because I used hex file and burned it every thing working, except my code. I want to use portb for the lcd.The code is:
'PicBasic program (Picbasic pro 2.46) to demonstrate operation of an LCD in 4-bit mode
' 16F628A
'
Define osc 16
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 0 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 1 ' 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
Pause 500 ' Wait for LCD to startup
loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Lcdout $fe, $c0 ' Move cursol to Second line
Lcdout "World" ' Display World
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "abcdefg"
Lcdout $fe, $c0 ' Move cursol to Second line
Lcdout "1234567"
Pause 500
Goto loop ' Do it forever
END
Obaid
Can someone please help me with this code for 16f628a, it does not work I get black squares on the lcd first line. I verified that pic is working and the lcd is lalso working and the circuit is working because I used hex file and burned it every thing working, except my code. I want to use portb for the lcd.The code is:
'PicBasic program (Picbasic pro 2.46) to demonstrate operation of an LCD in 4-bit mode
' 16F628A
'
Define osc 16
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 0 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 1 ' 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
Pause 500 ' Wait for LCD to startup
loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Lcdout $fe, $c0 ' Move cursol to Second line
Lcdout "World" ' Display World
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "abcdefg"
Lcdout $fe, $c0 ' Move cursol to Second line
Lcdout "1234567"
Pause 500
Goto loop ' Do it forever
END
Obaid