Newhaven Display Forum

Newhaven Products => OLEDs => Topic started by: awbrownCGNX on January 28, 2016, 03:36:04 PM

Title: Scrolling on NHD-0420CW-AY3(US2066)
Post by: awbrownCGNX on January 28, 2016, 03:36:04 PM
Hello all,

I have a NHD-0420CW-AY3 and I am trying to enable scrolling on line 1.
(page 27 on http://www.newhavendisplay.com/app_notes/US2066.pdf (http://www.newhavendisplay.com/app_notes/US2066.pdf))

I am not having much luck which I think is due to a misunderstanding of how the IS,RE, and SD logic bits are set.
After the OLED is initialized, and text is sent to the screen I am sending the following:

Code: [Select]
command(0x28)  //Set Fundamental Command Set
command(0x2B)  //Set IS, RE to 1
command(0x11)  //Enable scrolling on line 1

Any Thoughts?

Thanks!
Andrew
Title: Re: Scrolling on NHD-0420CW-AY3(US2066)
Post by: Chris O. on January 29, 2016, 04:14:50 PM
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:

Code: [Select]
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)
}
Title: Re: Scrolling on NHD-0420CW-AY3(US2066)
Post by: Chris O. on January 29, 2016, 04:25:27 PM
How about Double Height (4-line) / Display-dot shift.
 
Code: [Select]
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;
  }
}
Title: Re: Scrolling on NHD-0420CW-AY3(US2066)
Post by: Chris O. on January 29, 2016, 05:16:32 PM
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.
Title: Re: Scrolling on NHD-0420CW-AY3(US2066)
Post by: Paul_B on February 05, 2016, 08:12:10 AM
Thanks for sharing your solution Chris!