Shop OBEX P1 Docs P2 Docs Learn Events
JHD162A LCD Initialization — Parallax Forums

JHD162A LCD Initialization

ShaliniShalini Posts: 59
edited 2013-03-30 14:38 in Propeller 1
[h=2] Hi everyone![/h]
I'm using parallax propeller P8X3A-D40 with propeller tool software 1.3.2 to initialize the JHD162A LCD. I'm a beginner to SPIN language. I'm unable to write a SPIN code to initialize the lcd. Here are my pin connections from lcd to propeller:


LCD

P8X32A-D40



Vss
GND



Vcc

+5V



Vee (CONTRAST)

to middle pin of potentiometer (10k)



RS
P24



R/W
P25



E
P26



DB0

P16



DB1
P17



DB2

P18



DB3
P19



DB4
P20



DB5
P21



DB6
P22



DB7
P23





I know that for 8-bit mode (5x10 font style)
- Function Set is 0x3C
- Display Switch is 0x0F (which issues Display,Cursor, and Blink as ON)
- Input Set is 0x06
- Screen Clear is 0x01
- DDRAM AD set to reposition the cursor at Home at anytime is 0x80.

But I'm I don't know where to put what in the code. Can somebody please help me out on how to do the SPIN code for this lcd. I'm really in urge to make my project work....

Your help is greatly appreciated!!!
Thanks in advance

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-03-29 21:06
    Shalini wrote: »
    Hi everyone!
    I'm using parallax propeller P8X3A-D40 with propeller tool software 1.3.2 to initialize the JHD162A LCD. I'm a beginner to SPIN language. I'm unable to write a SPIN code to initialize the lcd. Here are my pin connections from lcd to propeller:


    LCD
    P8X32A-D40


    Vss
    GND


    Vcc
    +5V


    Vee (CONTRAST)
    to middle pin of potentiometer (10k)


    RS
    P24


    R/W
    P25


    E
    P26


    DB0
    P16


    DB1
    P17


    DB2
    P18


    DB3
    P19


    DB4
    P20


    DB5
    P21


    DB6
    P22


    DB7
    P23






    I know that for 8-bit mode (5x10 font style)
    - Function Set is 0x3C
    - Display Switch is 0x0F (which issues Display,Cursor, and Blink as ON)
    - Input Set is 0x06
    - Screen Clear is 0x01
    - DDRAM AD set to reposition the cursor at Home at anytime is 0x80.

    But I'm I don't know where to put what in the code. Can somebody please help me out on how to do the SPIN code for this lcd. I'm really in urge to make my project work....

    Your help is greatly appreciated!!!
    Thanks in advance

    There are many examples in the OBEX and elsewhere, however....

    Have a look at the function LCDINIT at the end of my CHARLCD.fh document to see the sequence and you will notice that although I use $38 because I have a 4-line LCD that you still need to observe the sequence and delays.
    BTW, save yourself a lot of bother and tie the R/W low and simply write to the LCD. Also the LCD really needs to operate from 5V even if they say it can run from 3.3V as the Vlcd (pin 3) needs to be around 4.5V <less than> the supply voltage which means if you do run 3.3V supply then Vlcd needs to be a negative voltage otherwise.
  • ShaliniShalini Posts: 59
    edited 2013-03-30 07:00
    i've given 5V for the lcd and i'm getting black boxes because i haven't done initialization in the code.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-03-30 07:35
    I don't think you are being very helpful then because you haven't posted one speck of code and there is certainly no way that I can guess what you have. The $3C needs to be issued twice and you must have the minimum delays as specified. Don't try to read the busy bit during initialization (or better still, not ever).

    Here's the snippet from my code, you should be able to follow it and bear in mind that LCDCMD is just a blind write to the control register so that $38 LCDCMD means "Write $38 to the LCD control register".
    [COLOR=#000000][FONT=Arial][FONT=Ubuntu Mono]         2 ms[/FONT]
    [/FONT][/COLOR][COLOR=#000000][FONT=Arial][FONT=Ubuntu Mono]         $38 LCDCMD 2 ms               \ Force LCD to 8-bit mode and init[/FONT]
    [/FONT][/COLOR][COLOR=#000000][FONT=Arial][FONT=Ubuntu Mono]         $38 LCDCMD 1 ms                        [/FONT]
    [/FONT][/COLOR][COLOR=#000000][FONT=Arial][FONT=Ubuntu Mono]         $40 LCDCMD $0C LCDCMD $06 LCDCMD[/FONT]
    [/FONT][/COLOR][COLOR=#000000][FONT=Arial][FONT=Ubuntu Mono]         $01 LCDCMD 1 ms[/FONT]
    [/FONT][/COLOR][COLOR=#000000][FONT=Arial][FONT=Ubuntu Mono]         $02 LCDCMD 2 ms[/FONT]
    [/FONT][/COLOR]
    

    Make sure to post all of your code if you really want some useful answers.
  • CrosswindsCrosswinds Posts: 182
    edited 2013-03-30 07:45
    Shalini wrote: »
    i've given 5V for the lcd and i'm getting black boxes because i haven't done initialization in the code.

    Are you sure that this is a sign for not beeing initialized?

    A problem with the contrast-setting could do this also?
  • ShaliniShalini Posts: 59
    edited 2013-03-30 14:34
    now my lcd initialized and displays as per your advice....thank you so much for the help!!!
  • ShaliniShalini Posts: 59
    edited 2013-03-30 14:38
    I'm trying to put the code for the rtc clocking to display time. I'll ask help if I have any issues with that. Thanks for your help!!
Sign In or Register to comment.