NHD‐0420CW‐AG3 Contrast question

Comments

2 comments

  • Paul_B

    Morning Richard,

    Glad to hear you have your display up and running! Regarding the Set Contrast command the margin of change is around 30-40%.

    Please see the example code linked below as reference and to verify correct operation:

    void contrast(){ // Adjusted contrast from invisible to full brightness
         
          command(0x02);
          command(0x01);
          disp2();
          for(int i = 127; i>0; i -=32){
         
          command(0x2A);                    //function set (extended command set)
          command(0x79);            //OLED Command set enabled
          command(0x81);          // Contrast
          command(i);
          command(0x78);                    //OLED command set disabled
          command(0x28);                    //function set (fundamental command set)
         
          delay(250);
        }
       
        for(int i = 1; i<256; i +=32){
         
          command(0x2A);                    //function set (extended command set)
          command(0x79);            //OLED Command set enabled
          command(0x81);           // Contrast
          command(i);
          command(0x78);                    //OLED command set disabled
          command(0x28);                    //function set (fundamental command set)
         
          delay(250);
        }
        command(0x2A);             // reset contrast to normal
        command(0x79);
        command(0x7F);
        command(0x78);
        command(0x28);
        disp();
        delay(700);
       
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    // Fades out and in
    void fade(){
      command(0x2A);                     //function set (extended command set)
      command(0x79);                     //OLED command set enabled
      command(0x23);                     // Set Fade out Mode
      command(0x20);                     // Set Fade out Mode (24 frames)
      command(0x78);                     //OLED command set disabled
      command(0x28);                     //function set (fundamental command set)
      command(0x01);
      command(0x02);
      disp1();
      delay(500);
      disp();
      command(0x2A);                     //function set (extended command set)
      command(0x79);                     //OLED command set enabled
      command(0x23);                     // Set Fade out Mode
      command(0x0A);                     // Set Fade out Mode (24 frames)
      command(0x78);                     //OLED command set disabled
      command(0x28);                     //function set (fundamental command set)
      command(0x01);
      command(0x02);
     
      delay(1250);
    }
    0
  • RichardR
    Quote
    Regarding the Set Contrast command the margin of change is around 30-40%
     

    OK, that would explain it. From what I can judge with the naked eye, the difference between minimum and maximum contrast is indeed some 30%. A bit of a shame, really, because that makes the contrast function far less useful, but  then again, it's no big deal for my application. (It would be different if I wanted to have a true 'dim' function for inobtrusive night-time operation.)

    Thanks again, best regards,
    Richard

    0

Please sign in to leave a comment.