Unless you intend on A/D on:
Code:
DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 4 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 5 'LCD enable bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
OSCCON = %01100000 'Internal RC set to 4MHZ
ANSEL = %00000000 'Disable Analogue Inputs
<font color="red">ADCON1 = 7 ' or ADCON1 = %00000111</font> 'Disable A/D converter
OPTION_REG = %01000000 'Enable PORTB pullups
CMCON = %00000111 'Disable Comparators
ManualLCDInit:
FLAGS=2 ' Void PBP lcd initialisation... it's a nice feature !!!
PAUSE 500
Lcdout $FE, $33
Lcdout $FE, $33
Lcdout $FE, $20 ' official 4 bit mode
@ bsf LCD_EREG, LCD_EBIT
PAUSEUS 20
@ bcf LCD_EREG, LCD_EBIT
Lcdout $FE, $28 ' Function Set
Lcdout $FE, $14 ' Bias
Lcdout $FE, $78 ' Contrast set
Lcdout $FE, $5E ' Power/Icon/Contrast
Lcdout $FE, $6A ' Follower control
Lcdout $FE, $0C ' Display ON
Lcdout $FE, $01 ' Clear display
Lcdout $FE, $06 ' Entry mode Set
' --------------------------------- End LCD init!
LCDOUT $FE,1,"Line1",$FE,$C0,"Line 2"
LOOP:
Goto LOOP
end
Bookmarks