Shop OBEX P1 Docs P2 Docs Learn Events
Need Help LCD 20x4 Initial problem — Parallax Forums

Need Help LCD 20x4 Initial problem

DukeDuke Posts: 21
edited 2006-06-13 03:38 in BASIC Stamp
Hello,

I have a problem about standard character LCD 20x4 it is not stable (sometimes cannot display).
I think it is because of my programing, In the LCD initial stage·I use the program from my old 16x2 program
because·I don't how to initial 20x4 LCD, Anyway·it works·the LCD can display but·after·on-off many times it doesn't work

The·program is like this.

·'*** Note LCD Module use data 7 bit = D7 D6 D5 D4 RS R/W EN ***
PAUSE 600······· 'LCD wait power on >500 ms
LCDCMD 1,48······ 'Send wakeup seq to LCD
PAUSE 10········· 'Meet LCD spec
LCDCMD 1,48······ 'Send wakeup seq to LCD
PAUSE 1·········· 'Meet LCD spec
LCDCMD 1,48······ 'Send wakeup seq to LCD
PAUSE 1·········· 'Meet LCD spec
LCDCMD 1,32······ 'Set data 4 bit
LCDCMD 1,40······ 'Set to 2 line mode 5x8 font
LCDCMD 1,8······· 'Turn display off
LCDCMD 1,12······ 'Turn display on without cursor
LCDCMD 1,6······· 'Set to auto-increment cursor (no display shift)
LCDCMD 1,1······· 'Clear the display

'**** End Initial LCD *************************

I think the fault is from my programing. I anyone know how to initial the LCD please help me
correct this program.

Thank you.

Duke..

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-13 03:38
    Duke,
    ·· Try the following code and see if it helps.· Let me know how you make out.· Bear in mind, Lcd will need to be set to 1 (constant).· You will also need a variable (nib will suffice) named temp to use this code as it is.
    Init_Lcd:
      PAUSE 1000
      FOR temp = 0 TO 2
        LCDCMD Lcd, 48                      ' Reset LCD (Send 3 times)
        PAUSE 5                             ' Delay Require By LCD Specs
      NEXT
      LCDCMD Lcd, 32                        ' Set 4-bit Mode
      LCDCMD Lcd, 40                        ' Set 2-line Mode
      LCDCMD Lcd, 12                        ' Turn On Display With No Cursor
      LCDCMD Lcd, 6                         ' Set To Auto-Increment Cursor
      LCDCMD Lcd, 1                         ' Clear Display
    ' -----[noparse][[/noparse] Main Routine ]----------------------------------------------------
    Main:
      LCDOUT Lcd, 1, [noparse][[/noparse]"Hello, this is"]   ' Clear LCD & Print Line 1 Text
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.