SR library incompatible with NHD 0216 series by default timings (ST7066U Controller)

Issue #90 new
Wesley W.S. created an issue

I’m aware that the library is stated to be only compatible with proper Hitachi chips, but I figured I’d share the quick fix for NHD devices running in 3-Wire SR mode. just increase the delay time a bit and everything works as intended. Here’s the function pre-patched from the latest (at the time of writing) release. Might be nice if a “Slow-Mode” was released for these so patching wasn’t necessary for compatibles.

Under “LiquidCrystal_SR.cpp”:

void LiquidCrystal_SR::send(uint8_t value, uint8_t mode)
   // Divide byte in two nibbles include the RS signal
   // and format it for shiftregister output wiring to the LCD
   // We are only interested in my COMMAND or DATA for myMode
   uint8_t myMode = ( mode == LCD_DATA ) ? SR_RS_BIT : 0; // RS bit; LOW: command.  HIGH: character.

   if ( mode != FOUR_BITS )
      shiftIt(myMode | SR_EN_BIT | ((value >> 1) & 0x78)); // upper nibble

   shiftIt(myMode | SR_EN_BIT | ((value << 3) & 0x78)); // lower nibble
    * Add some delay since this code is so fast it needs some added delay
    * even on AVRs because the shiftout is shorter than the LCD command execution time.
#if (F_CPU <= 16000000)
    delayMicroseconds ( 10 );
    delayMicroseconds ( 100 ); // 3 wire mode on NHD displays needs an even longer delay (ST7066U Controller)
   delayMicroseconds ( 37 );      // commands & data writes need > 37us to complete


Comments (2)

  1. Francisco Malpartida repo owner

    Thanks for the update. Would you like to do a pull request?

    I can always add the code in though.

  2. Wesley W.S. reporter

    As I’m short on time, I didn’t write anything to cover all modes, so just patching this from 17us to 100us would slow down the fast displays as well. I doubt I’d have time to do a pull request with sufficient quality right now, so it’s probably better if you handle it.

    Thanks again for the great library and have a good week!

  3. Log in to comment