DEFINE OSC 20
'This setup will tell PBP a 2-line LCD is connected in 4-bit
'mode with the data bus on the top 4 bits of PORTB, Register
'Select on PORTB.1, and Enable on PORTB.0.
'Data Bits it goes like: 3>B.7, 2>B.6, 1>B.5, 0>B.4
' Set LCD Data port
DEFINE LCD_DREG PORTB
' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
' Set LCD Register Select port
DEFINE LCD_RSREG PORTB
' Set LCD Register Select bit
DEFINE LCD_RSBIT 1
' Set LCD Enable port
DEFINE LCD_EREG PORTB
' Set LCD Enable bit
DEFINE LCD_EBIT 0
' 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 2000
' Set data delay time in us
DEFINE LCD_DATAUS 50
i VAR BYTE
Message VAR BYTE[10]
Message[0]="A" 'could also be Message[0]=65
Message[1]="I"
Message[2]="M"
Message[3]=" "
Message[4]="h"
Message[5]="i"
Message[6]="g"
Message[7]="h"
PAUSE 2000
main:
'A quick note on LCDOUT
'LCDOUT #variable displays the numerical contents of variable
'LCDOUT variable interperts variable as an ASCII code
LCDOUT $fe, 1 ' Clear screen
PAUSE 500 ' Wait .5 second
FOR i=0 TO 7
LCDOUT Message[i] 'Display Message
NEXT
PAUSE 500 ' Wait .5 second
LCDOUT $fe, $c0, "World" ' Move to line 2 and display "World"
PAUSE 500 ' Wait .5 second
LCDOUT $fe, 1 ' Clear screen
PAUSE 500 ' Wait .5 second
LCDOUT "It Works" ' Display "Hello"
PAUSE 500 ' Wait .5 second
LCDOUT $fe, $c0, "Jeff" ' Move to line 2 and display "World"
PAUSE 500 ' Wait .5 second
'Lcdout $fe, 1, "x=", #x, " y=", #y, " z=", #z ' Send values to LCD
GOTO main ' Do it forever