Brian,
I see what you mean about the minimum power-up time of 10ms and the big power supply. Couple things you might try.
If you have an extra pin available? You could use that to power the LCD. It would allow a nice fast rise time independant of the power supply. It only draws 4-5ma for the logic. Power the backlight separately (if there is one).
Or, if you want to try the software initialization. Here's something I threw together.
The datasheet shows a slightly different init sequence than a normal HD44780. It doesn't even say which driver chip the display uses.
This routine follows the datasheet, and over emphasizes the delays, just in case. (16F only)
Code:
;---- Change these to match your hardware ---------------------------
@ Device pic16F877A, HS_OSC, BOD_OFF, PWRT_ON, WDT_ON, PROTECT_OFF
DEFINE OSC 20
DEFINE LOADER_USED 1
DEFINE LCD_DREG PORTD ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTD ' Set LCD Register Select port
DEFINE LCD_RSBIT 5 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTD ' Set LCD Enable port
DEFINE LCD_EBIT 4 ' 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
;CMCON = 7 ' if needed
;ADCON1 = 7
;--------------------------------------------------------------------
GOSUB LCD_INIT ' Do manual LCD Initialization
LCDOUT "Hello World!"
stop
;---- Manual LCD Initialization -------------------------------------
TempB VAR BYTE
BUSdata VAR BYTE
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
;-----------------------------------------
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
;---------- END LCD_INIT --------------------------------------------
HTH,
Bookmarks