Unable to print to second row of character LCD

Comments

4 comments

  • Adam Steele

    Update:

    The behavior on the old system is intermittently incorrect.  again/recompiling/rebooting it that also won't print to the second line. Then after powering down /rebooting again it started to print to the second line.

    Maybe there is a DDRAM issue for that second line?

    Is there some power sequencing or timing which is critical here?

     

    More data:  From a cold start

    on-> display operates normally -> Reset uC -> second line won't write. POwer down/up -> second line glitch persists -> power down. short/ground all pins -> power up -> display operates normally

    0
  • Adam Steele

    The culprit was the wake sequence! The one in the library does NOT work, at least in 4-bit mode. It also does not match the datasheet. I have no idea why the wake sequence changes whether or not line 2 can be written to subsequently but i put my solution here to help anyone else who find themselves in this position.

    Manufacturer's Arduino library  wake function. It works only under certain startup conditions.

    void NHD_Character_LCD::wakeup()
    {
        command(0x30);
        delay(30);
        command(0x30);
        delay(10);
        command(0x30);
        delay(10);
    }

     

    This one works consistently on an Uno in 4-bit mode, and I'd claim it better matches the datasheet

    void NHD_Character_LCD::wakeup()
    {
       delay(100);
       setCommandMode();
       setWriteMode();
       set4bitDataPins(0x30);
       delay(30);
       dataLatch();
       delay(30);
       dataLatch();
       delay(30);
       dataLatch();
       delay(10);
    }

     

    the above does NOT work on a board with my Teensy. I don't know why, maybe a timing issue, maybe a level shifter, but if you simply repeat the Uno sequence above, that does work.

    0
  • Engineering Support
    Community moderator

    Hi Adam,

    Thank you for sharing the issue and for providing the working solution.  It is likely that the original library was written specifically for 8-bit mode.  The issue may also be related to the logic level differences between the Teensy (3.3V) and Arduino Uno (5V).  I'm glad the display is now working for you.

    0
  • Adam Steele

    Hi, There is a level shifter for 3.3V to 5V between the microcontroller and the display so I don't think that is the issue, unless it is somehow related to a propagation delay but i find that unlikely given with how slow the comms are here.

    0

Please sign in to leave a comment.