Newhaven Display Forum

Newhaven Products => OLEDs => Topic started by: RichardR on December 28, 2015, 01:57:48 PM

Title: NHD‐0420CW‐AG3 Contrast question
Post by: RichardR on December 28, 2015, 01:57:48 PM
Hello,

Thanks to Saurabh's good advice, I managed to get the NHD‐0420CW OLED display working properly. I have however a question about the contrast function. I'm using the following commands to set the contrast:

Code: [Select]
command(0x2A); //function set (extended command set)
command(0x79); //OLED command set enabled
command(0x81); //set contrast control
command(0x7F); //set contrast value
command(0x78); //OLED command set disabled
command(0x28); //function set (fundamental command set)

And yes, this seems to work, but while the contrast value can be set between 0x00 and 0xFF (with 0x7F as the default value), the effect is tiny -- the difference between 0x00 and 0xFF is perhaps a 30% change in visible brightness (at first, I thought that it didn't work at all).

The same goes for the fade function:

Code: [Select]
command(0x2A); //function set (extended command set)
command(0x79); //OLED command set enabled
command(0x23); //fade/blink function
command(0x30); //blink, with step every 8 frames
command(0x78); //OLED command set disabled
command(0x28); //function set (fundamental command set)

The display brightness only changes marginally (hardly visible), and only at the lowest point it goes completely black for a moment.

Did I perhaps do something wrong with setting up registers? Or is the actual contrast range indeed very small? Or could I have damaged the display? (I think I once set the display for 2.8V I/O instead of 5V while testing, but that doesn't appear to have damaged anything else).

Thanks once again!

Best regards,

Richard
Title: Re: NHD‐0420CW‐AG3 Contrast question
Post by: Paul_B on January 12, 2016, 10:09:22 AM
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:

Code: [Select]
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);
}
Title: Re: NHD‐0420CW‐AG3 Contrast question
Post by: RichardR on January 16, 2016, 09:52:02 AM
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