Hot![Solved]LCD JHD162G M7 : Jumboo LCD Second Line Not Working...

Page: 123 > Showing page 1 of 3
Author
karan123
Super Member
  • Total Posts : 714
  • Reward points : 0
  • Joined: 2009/02/02 11:11:21
  • Location: 0
  • Status: offline
2018/02/04 02:19:18 (permalink)
0

[Solved]LCD JHD162G M7 : Jumboo LCD Second Line Not Working...

Hello, I am working on 16 x 2 LCD character for ( Character Size 8mm x 5mm approx) with dsPIC33EP32MC202.Pin Alignment on LCD is First Pin is 15, Second Pin is 16 than from (3rd Pin) 1 to (Last Pin) 14 .
15     LED+ 
 16     LED-
1       Gnd
2       VCC
3      Contrast
4      RS
5      RW
6      EN
7-14  <D0-D14>  <Only D4-D7 is used For 4-Bit Mode>

</p>
<p>#define LCD_STROBE (LCD_EN=1);  __delay_us(10); (LCD_EN=0) ;</p>
<p>void InitLCD()
{
LCD_RS = 0; // write control bytes
__delay_ms(1); // power on delay
LCD_BIT_D4 = 1; // init!
LCD_BIT_D5 = 1; //
LCD_STROBE ;
__delay_ms(1); </p>
<p>
LCD_STROBE ;
__delay_ms(1); 

LCD_STROBE ;
__delay_ms(1); 

LCD_BIT_D4 = 0;
LCD_STROBE ;
__delay_ms(1);</p>
<p><b>LCDCommand(0x40); // Set 4 bit mode (Change from 0x28 from  M7)</b>
LCDCommand(0x0C);
LCDCommand(0x01);
LCDCommand(0x06);
LCDCommand(0x80);
}</p>
<p>// In Main</p>
<p>LCDCommand(0x80);
LCDString((unsigned char *)"ABC") ;</p>
<p>LCDCommand(0xC0);
LCDString((unsigned char *)"XYZ") ;</p>
<p>
The LCD is working Fine in 4-bit First Line Only . Second Line is Not Even Show Single Character. (LCD alone is Working[Checked from Other Setup]) Any Special address for second line for LCD JHD162G M7 .?? 
Because Same Code Working Fine on JHD162A with 0x28 for 4-Bit Setting.


--Karan
post edited by karan123 - 2018/02/05 05:01:24
#1

46 Replies Related Threads

    qɥb
    Monolothic Member
    • Total Posts : 2619
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 02:32:46 (permalink)
    0
    Explain about this line
    LCDCommand(0x40); // Set 4 bit mode (Change from 0x28 from  M7)

    why you are sending 40 rather than 28.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #2
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 02:52:42 (permalink)
    0
    With 0x28 LCD Not working... Sometimes Data display for Sometime, Some time Nothing displayed on LCD.
    #3
    qɥb
    Monolothic Member
    • Total Posts : 2619
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 03:24:30 (permalink)
    0
    That is the command that tells the display you are using 4 bit mode, and that it has two lines.
    Assuming your 4 data pins all start low, then you are strobing out 0x30 three times, then 0x20 once.
     
    The first three are forcing it into 8 bit mode (by sending 0x30 multiple times)m then the 0x20 switches it back to 4-bit mode.
    The next command should set the N and F bits. You need N=1 to get two lines, but you are never doing that because you removed writing the 0x28. That means you are never enabling two line mode.
    Sending 0x40 instead just sets the address pointer to CGRAM, which is pointless

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #4
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 03:58:37 (permalink)
    0
    Means I have to sent below sequence :
     

    LCD_BIT_D4=0;
    LCD_BIT_D5=0;
    LCD_BIT_D6=0;
    LCD_BIT_D7=0;

    LCDCommand(0x30);
    LCDCommand(0x30);
    LCDCommand(0x30);
    LCDCommand(0x20);
    LCDCommand(0x28);

    LCDCommand(0x0C);
    LCDCommand(0x01);
    LCDCommand(0x06);
    LCDCommand(0x80);


    Yes/No?
    post edited by karan123 - 2018/02/04 04:05:32
    #5
    qɥb
    Monolothic Member
    • Total Posts : 2619
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 04:09:12 (permalink)
    0
    karan123
    Means I have to sent below sequence :

    No!
    You have not posted the code for LCDCommand(), but presumably it is doing the 4 bit splitting, and maybe waiting for the BF flag.
    You must NOT use that command during the init phase.
    Your current code was doing the correct things, EXCEPT you should be sending the 0x28, not 0x40.

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #6
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 05:04:25 (permalink)
    0
     
    Thanks... for update..

    No!
    You have not posted the code for LCDCommand(), but presumably it is doing the 4 bit splitting, and maybe waiting for the BF flag.

    I am not using BF Flag..

    You must NOT use that command during the init phase.

    OK.. How to send data in Init LCD Phase.?

    Your current code was doing the correct things, EXCEPT you should be sending the 0x28, not 0x40.

    Ok..
    Please Check attachment for code and then update..
    --
    Karan
    post edited by karan123 - 2018/02/04 05:10:39
    #7
    qɥb
    Monolothic Member
    • Total Posts : 2619
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 05:10:32 (permalink)
    0
    As I said, that code is doing all the correct things, EXCEPT for sending 0x40 where you should be sending 0x28.
    Why pick 0x40?
    I would change it back to 0x28, and work from there.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #8
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 05:14:36 (permalink)
    0
    Thanks again
     
    Please Check attachment..

    You must NOT use that command during the init phase

    What is the meaning of this ? Which function I should chose ?
    As I said earlier 0x28  LCD JHD162G M7 I not working  , but  JHD162A is working fine .
    post edited by karan123 - 2018/02/04 05:17:02
    #9
    qɥb
    Monolothic Member
    • Total Posts : 2619
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 05:18:08 (permalink)
    0
    karan123

    You must NOT use that command during the init phase

    What is the meaning of this ?

    In post#5 you showed some alternative code sending the init commands via your LCDCommand() function.
    I was saying DON'T DO THAT.
    Keep doing it the way your original code does it, which is the correct way.
    I already said all this in post#6.
     
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #10
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 05:20:39 (permalink)
    0
    But  LCD JHD162G M7 is not working the code attached in  Msg #10.
    What do I do ? 
    post edited by karan123 - 2018/02/04 05:21:47
    #11
    qɥb
    Monolothic Member
    • Total Posts : 2619
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 05:34:29 (permalink)
    0
    ok, try this. Where you have
        LCD_BIT_D4 = 0;                      
        LCD_STROBE ;
       __delay_ms(1);

    add this extra code straight after.

       LCD_BIT_D6 = 1;
       LCD_BIT_D7 = 1;   // dat = 1110xxxx, N=1, F=1 (4&5 are don't care)
        LCD_STROBE ;
       __delay_ms(1);

    and delete the first call to LCDCommand()
    (that was sending 0x40 or 0x28)
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #12
    1and0
    Access is Denied
    • Total Posts : 7994
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 06:29:01 (permalink)
    0
    Because of this stupid forum, it will take me a few times to completely post this.
     
    In general, when the same LCD routines work for one LCD but not another, it is usually a timing problem. That said, your code is not waiting the execution time of each command since it is not using the BUSY check. Most LCD operations take about 40 us except for Clear Display and Cursor Home which can take up to 1.64 ms. 
     
    So, replace the last delay in L-C-D-Con-vert()        ??? it seems this function name is banned ???
        // snipped 
     
        LCD_STROBE ;
        __delay_us(1);
    }

    with
        __delay_us(40);

    and replace this
    void LCDClear() 
    {
        LCDCommand(0x01);
    }

    with this
    void LCDClear() 
    {
        LCDCommand(0x01);
        __delay_ms(1.64 - 0.04);
    }

     
    And do send 0x28 instead of 0x40 as Qub said.
    post edited by 1and0 - 2018/02/04 06:37:05
    #13
    RISC
    Super Member
    • Total Posts : 5170
    • Reward points : 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 07:41:09 (permalink)
    0
    Hi,
    It seems you don't use XC8 compiler.
    The LCD module you use has a KS0066 controller IC which is HD44780 compatible :
    http://www.datasheetspdf....semiconductor/KS0066/1
    So you can e.g. look at most of the LCD libraries on internet because HD44780 is a standard, at least from the commands point of view.
    What changes from one LCD IC device to the other are the timings. So if you find some example check the timings of the controller IC.
    If you use XC8, you will find a software LCD driver for this kind of chip (KS0066 / HD44780 equivalent) for the PICDEM2 PLUS board :
    http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM163022-1
    Regards
     
    #14
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 2578
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 07:44:21 (permalink)
    0
    Assuming HD44780 which most of these type are.  Download the datasheet.
     
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #15
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 08:14:57 (permalink)
    0
    @RISC
    I am using dsPIC33EP32MC202 so xc16 is used.
    #16
    TS9
    Super Member
    • Total Posts : 514
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 10:38:58 (permalink)
    0
    Yes.. There may be timing issue
    #17
    karan123
    Super Member
    • Total Posts : 714
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 10:43:12 (permalink)
    0
    @qhb ,@1and0 and @TS9

    Thanks
    I will try then update to you tomorrow.
    #18
    RISC
    Super Member
    • Total Posts : 5170
    • Reward points : 0
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 11:24:49 (permalink)
    0
    Hi,
    So if you use a dsPIC33, you can refer to any application note or software example for EXPLORER16 or EXPLORER1632 and uses LCD display.
    It also has a HD44780 based LCD controller IC. Explorer16 demo code on this page : 
    http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM240001
    Regards
     
    #19
    1and0
    Access is Denied
    • Total Posts : 7994
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: LCD JHD162G M7 : Jumboo LCD Second Line Not Working... 2018/02/04 11:59:47 (permalink)
    0
    RISC
    So if you use a dsPIC33, you can refer to any application note or software example for EXPLORER16 or EXPLORER1632 and uses LCD display.
    It also has a HD44780 based LCD controller IC. Explorer16 demo code on this page : 

    As expected from a demo code. Regarding efficiency for starter:
    void LCD_ClearScreen ( void )
    {
        LCD_SendCommand ( LCD_COMMAND_CLEAR_SCREEN , LCD_S_INSTR ) ;
        LCD_SendCommand ( LCD_COMMAND_RETURN_HOME , LCD_S_INSTR) ;
        row = 0 ;
        column = 0 ;
    }

    Whoever coded this has no idea how a LCD works, because a Clear Screen command will automatically return the cursor to home; so the second LCD_SendCommand() is unnecessary. :(  And I have not looked at the other functions yet.
    #20
    Page: 123 > Showing page 1 of 3
    Jump to:
    © 2018 APG vNext Commercial Version 4.5