Good morning to everybody,
I have a problem with my code.LCD--->16F628
Please check my code!!!
Thnks
' PicBasic program to demonstrate operation of an LCD in 4-bit mode
'
' LCD should be connected as follows:
' LCD PIC
' DB4 PortA.0
' DB5 PortA.1
' DB6 PortA.2
' DB7 PortA.3
' RS PortA.4 (add 4.7K pullup resistor to 5 volts)
' E PortB.3
' RW Ground
' Vdd 5 volts
' Vss Ground
' Vo 20K potentiometer (or ground)
' DB0-3 No connect
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT ' system clock options
@ DEVICE pic16F628, WDT_ON ' watchdog timer
@ DEVICE pic16F628, PWRT_ON ' power-on timer
@ DEVICE pic16F628, MCLR_OFF ' master clear options (internal)
@ DEVICE pic16F628, BOD_ON ' brown-out detect
@ DEVICE pic16F628, LVP_OFF ' low-voltage programming
@ DEVICE pic16F628, CPD_OFF ' data memory code Protect
@ DEVICE pic16F628, PROTECT_OFF ' program code protection
Define LCD_BITS 4 ' 4-bit interface
Define LCD_LINES 2 ' 2 line LCD
' LCD should be connected as follows:
' LCD PIC
' DB4 PortA.0
' DB5 PortA.1
' DB6 PortA.2
' DB7 PortA.3
Define LCD_DREG PORTA
Define LCD_DBIT 0
' RS PortA.4 (add 4.7K pullup resistor to 5 volts)
Define LCD_RSREG PORTA
Define LCD_RSBIT 4
' E PortB.3
Define LCD_EREG PORTB
Define LCD_EBIT 3
' RW Ground
' Vdd 5 volts
' Vss Ground
' Vo 20K potentiometer (wire wiper to Vo, adjust for contrast)
' DB0-3 No connect
Define LCD_COMMANDUS 2000 ' Adjust for slower LCD modules
Define LCD_DATAUS 50
INCLUDE "MODEDEFS.BAS"
INTCON = 0 ' Disable interrupts
CMCON = 7
Pause 500 ' Wait for LCD to startup
loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "By:Geronikolos" ' Display Hello
Pause 500 ' Wait .5 second
Lcdout $fe,$c0,"World" ' Clear LCD screen
Pause 500 ' Wait .5 second
Lcdout $fe,$c0,"Hello" ' Clear LCD screen
Pause 500 ' Wait .5 second
Goto loop ' Do it forever
Bookmarks