Thanks !
I found this great piece of code (Thanks to Mr.Darell !!!) ; ALL my LCD's work fine now !!!
Code:
GOSUB LCD_INIT ' Do manual LCD Initialization
;---- Manual LCD Initialization -------------------------------------
LCD_INIT:
@ MOVE?CT 0, LCD_RSREG,LCD_RSBIT ; Start with RS LOW
@ MOVE?CT 0, LCD_RSREG+80h,LCD_RSBIT ; RS is OUTPUT
@ MOVE?CT 0, LCD_EREG,LCD_EBIT ; Start with Enable LOW
@ MOVE?CT 0, LCD_EREG+80h,LCD_EBIT ; Enable is OUTPUT
@ MOVE?CT 0, LCD_DREG+80h,LCD_DBIT ; Data Bus is OUTPUT
@ MOVE?CT 0, LCD_DREG+80h,LCD_DBIT +1
@ MOVE?CT 0, LCD_DREG+80h,LCD_DBIT +2
@ MOVE?CT 0, LCD_DREG+80h,LCD_DBIT +3
PAUSE 1000
BUSdata = 3
GOSUB Send4Bit : pause 8 ; FunctionSet 4 times
GOSUB Send4Bit : pauseUS 200
GOSUB Send4Bit : pauseUS 200
GOSUB Send4Bit : pauseUS 200
BUSdata = 2 : GOSUB Send4Bit ; 4-bit mode
BUSdata = 2 : GOSUB Send4Bit ; 2-line, 5x7
BUSdata = 8 : GOSUB Send4Bit
BUSdata = 0 : GOSUB Send4Bit ; Display OFF
BUSdata = 8 : GOSUB Send4Bit
BUSdata = 0 : GOSUB Send4Bit ; Display Clear
BUSdata = 1 : GOSUB Send4Bit
PAUSE 3
BUSdata = 0 : GOSUB Send4Bit ; Entry Mode Set
BUSdata = 6 : GOSUB Send4Bit
PAUSE 3
BUSdata = 0 : GOSUB Send4Bit ; Display ON
BUSdata = $C : GOSUB Send4Bit
@ MOVE?CT 1, LCDINITFLAG ; Tell PBP LCD is already Initialized
return
Send4Bit:
@ MOVE?CT 1, LCD_EREG,LCD_EBIT ; Enable LCD
@ MOVE?BB LCD_DREG, _TempB ; Put Data on the Bus R-M-W
@ if LCD_DBIT == 0 ; Bus starts at 0
TEMPB = (TEMPB & $F0) | BUSdata
@ else ; Bus starts at 4
TEMPB = (TEMPB & $0F) | (BUSdata << 4)
@ endif
@ MOVE?BB _TempB, LCD_DREG
PAUSEUS 25 ; Keep enabled extra long
@ MOVE?CT 0, LCD_EREG,LCD_EBIT ; Disable LCD
Pauseus 50
return
;---------- END LCD_INIT --------------------------------------------
Bookmarks