Scrolling on NHD-0420CW-AY3(US2066)

Comments

4 comments

  • Chris O.

    Let's start with an easy one.  ;P
    SD logic bits are set by Extension register in OLED Characterization p.29 hex 0x78 b1111000 / 0x79 b1111001

    example Set Contrast Control:

    void OLedI2C::setContrast(unsigned char contrast) // contrast as 0x00 to 0xFF
    {
      //Set OLED Command set
      sendCommand(0x2A);        //Function Set  N = 1, BE = 0, RE = 1 Set, REV = "0": normal display (POR)  B00101010
      sendCommand(0x79);        //OLED Characterization / 0x79 B1111001 =  OLED command set is enabled
      sendCommand(0x81);   // Set Contrast
      sendCommand(contrast); // send contrast value
      sendCommand(0x78);   // OLED Characterization / 0x78 B1111000 =Exiting Set OLED Command set disabled (POR)
      sendCommand(0x28);       // Function Set / B101000 (Go Back to Fundamental Command Set)
    }
    0
  • Chris O.

    How about Double Height (4-line) / Display-dot shift.

    void OLedI2C::setDoubleH(uint8_t MODE) // 09-19-2015 Chris O. / Double Height Display MODE 0~4
    /*---- MODE: "0"=Normal 4-line, "1"=Bottom half Double Height, "2"=Middle Double Height, "3"=Top/Bottom Double Height, "4"=Top Double Height ----*/
    {
      sendCommand(0x2A); // Function Set  (extended command set / Extension register, RE ("1")set) B00101010
     //  i'm not sure if needed / Extended Function Set
      sendCommand(B00001001); //Extended Function Set (FW = "0": 5-dot font width, black/white invert cursor DIS,NW = "1": 3-line or 4-line display mode)
      switch (MODE) {
      case 0:    //MODE 0 4x20-line / MODE: "0"=Normal 4-line
        sendCommand(0x28);// Function Set (Go Back to Fundamental Command Set)//101000
        break;
      case 1:    //MODE 1 0x10 / Double Height (4-line)/Display-dot shift
        sendCommand(B00010000); //MODE 1
        sendCommand(0x2C);//101100 Function Set ( when (N=1 :4-line )and(NW=1), Double height =1 Enable, Extension register, RE"0", Extension register, IS"0" )
        break;
      case 2:    //MODE 2 0x14 / Double Height (4-line)/Display-dot shift
        sendCommand(B00010100);   //MODE 2 0x14 / Double Height (4-line)/Display-dot shift
        sendCommand(0x2C);//101100 Function Set ( when (N=1 :4-line )and(NW=1), Double height =1 Enable, Extension register, RE"0", Extension register, IS"0" )
        break;
      case 3:    //MODE 3 0x18 / Double Height (4-line)/Display-dot shift (DH’ = "0": dot scroll enable (POWER UP))
        sendCommand(B00011000);
        //sendCommand(B00011001); //MODE 3 0x19 / Double Height (4-line)/Display-dot shift (DH’ = "1": display shift enable)
        sendCommand(0x2C);//101100 Function Set ( when (N=1 :4-line )and(NW=1), Double height =1 Enable, Extension register, RE"0", Extension register, IS"0" )
        break;
      case 4:
        sendCommand(B00011100);  //MODE 4 0x1C / Double Height (4-line)/Display-dot shift(DH’ = "0": display shift DIS)
        sendCommand(0x2C);//101100 Function Set ( when (N=1 :4-line )and(NW=1), Double height =1 Enable, Extension register, RE"0", Extension register, IS"0" )
        break;
      }
    }
    « Last Edit: January 29, 2016, 04:28:55 PM by Chris O. »
    0
  • Chris O.

    The IS logic bits are set by Function Set, p27(Bottom of the Page)
    Please Note the continuation of Function Set is on the next page 28 (Top of the Page)
    The RE logic bits are set on page 28.
    Now comes the tricky part, as soon as you set the RE logic bit to 1, you're in control of the bits on page 28.

    Hope this helps.

    0
  • Paul_B

    Thanks for sharing your solution Chris!

    0

Please sign in to leave a comment.