Author Topic: NHD‐0420CW‐AG3 Contrast question  (Read 2261 times)

RichardR

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
NHD‐0420CW‐AG3 Contrast question
« 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

Paul_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 251
  • Karma: 16
    • View Profile
Re: NHD‐0420CW‐AG3 Contrast question
« Reply #1 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);
}

RichardR

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
Re: NHD‐0420CW‐AG3 Contrast question
« Reply #2 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

 

MOVED: NHD-0420CW-AY3 display, text is mirror image

Started by Saurabh_BBoard Character LCDs

Replies: 0
Views: 2152
Last post March 11, 2016, 07:51:03 AM
by Saurabh_B
0420CW-AB3 I2C Talking, Display is off and low current drawn

Started by AreswayBoard OLEDs

Replies: 3
Views: 2892
Last post February 10, 2015, 07:39:49 AM
by Paul_B
NHD-0420CW-AG3 MPU Interface Pin Selection and Power Supply

Started by blaubaerBoard OLEDs

Replies: 14
Views: 6440
Last post April 20, 2015, 03:51:06 PM
by oldmaker
NHD-0420DZW-AY5 vs 763-NHD-0420CW-AY3 for brightness and power consumption

Started by timmwalkBoard OLEDs

Replies: 1
Views: 1839
Last post December 07, 2015, 08:37:17 AM
by Saurabh_B
NHD-0420CW-AY3 display, text is mirror image

Started by zleozBoard OLEDs

Replies: 1
Views: 2016
Last post March 11, 2016, 07:59:53 AM
by Paul_B