Author Topic: NHD-042ODZW-AY5 Jumpers for Serial Interface  (Read 2627 times)

PCook

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
NHD-042ODZW-AY5 Jumpers for Serial Interface
« on: December 18, 2014, 01:29:09 PM »
I recently purchased a 4x20 character display (NHD-042ODZW-AY5). I would like to run this OLED from a Netduino Plus 2 using the SPI interface. However, I am not clear of the OLED unit's jumpers to get a "Serial MPU" interface configuration. I am following the OLED's spec document. My specific questions are:

1. When the spec sheet calls for an "OPEN" jumper, do I need to unsolder the factory installed surface mount resister and remove it from the board entirely?

2. When the spec sheet calls for an "L" jumper, do I need to unsolder the factory installed surface mount resister and resolder it in a new position?

3. Or, should I not have to unsolder anything and ignore the spec sheet implying that the pull-up / pull-down resisters need to be altered on the board and just solder a bridge between jumper pads for JCS1 and JCS2?

Any help would be appreciated because I can't get the OLED display to do anything at the moment. I'll take even little clues as to how to change the jumpers for a"Serial MPU" interface.

Thanks
Pat

Paul_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 250
  • Karma: 16
    • View Profile
Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« Reply #1 on: December 18, 2014, 02:01:21 PM »
Hello,

Question:

1. When the spec sheet calls for an "OPEN" jumper, do I need to unsolder the factory installed surface mount resister and remove it from the board entirely?

Answer: Yes, you will need to unsolder the surface mount resister and remove it from the board entirely.



Question:

2. When the spec sheet calls for an "L" jumper, do I need to unsolder the factory installed surface mount resister and resolder it in a new position?

Answer: Yes, you will need to unsolder the surface mount resistor and shift it over. You will see 3 pads labeled H_PS_L.
H = High
L = Low

In your case position the resistor across PS and L.

Hope this helps!


P.S. Don't forget to check out the image I attached.

PCook

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« Reply #2 on: December 19, 2014, 08:41:44 AM »
Thank you Paul_B! I appreciate your thorough reply. It was very helpful.
I would like encourage the folks at Newhaven Display to edit their spec document to provide better written guidance about jumper alterations.
Pat

SkipSky

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« Reply #3 on: February 21, 2017, 07:05:45 PM »
Dear Paul_B and all,

I too was very confused by the data-sheet specifications about jumpers and what was supposed to be done by the user. Your post solved that confusion at lest for me. It seems to me that your post or some slight rewriting of it should be included in Newhaven's data-sheet for the 0420DZW-AY5, and probably other display data-sheets as well. It would certainly help to avoid a lot of head scratching.

I would suppose that some, if not many, brand new displays have been ruined by customers misunderstanding what is supposed to be done. I am also certain that many customers don't have the capability to desolder and resolder surface mount resistors in a clean acceptable manner. It's certainly not for the novice. Fortunately I have that capability.

Well, on to writing some code and seeing if I can get the other parts working. Is there some simple test just to see if the display is in operable condition? Mine is brand new just out of the box from Mouser. Thanks in advance.

Sincerely,
Skip Dykema

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 362
  • Karma: 10
    • View Profile
Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« Reply #4 on: February 23, 2017, 11:31:46 AM »
Hello,

Unfortunately for OLEDs there is no simple way to test the display unless you start writing characters onto the display.

I do have example serial code available here:
Code: [Select]
sbit SCL = P3^4;
sbit SDOUT = P1^0;
sbit SDIN = P1^1;
sbit C_S = P3^3;

void delay(unsigned int n) //Delay subroutine
{
unsigned int i,j;
for (i=0;i<n;i++)
  for (j=0;j<250;j++)
  {;}
}
 

void WriteCommand(unsigned char ins)
{
unsigned char i;
C_S=0;
SCL = 0;
SDOUT = 0; //RS = 0 (Command)
SCL = 1; //RS registered
SCL = 0;
SDOUT = 0; //RW = 0
SCL = 1; //RW registered
SCL = 0;

for (i=0x80;i;i>>=1)
{
if((ins&0x80)==0x80)
SDOUT = 1;
else
SDOUT = 0;
ins=(ins<<1);
SCL = 0;
SCL = 1;
SCL = 0;
}

    C_S=1;
}

void WriteDataInit()
{

C_S=0;
SCL = 0;
SDOUT = 1; //RS = 1 (Data)
SCL = 0; //RS registered
SCL = 1;
SCL = 0;
SDOUT = 0; //RW = 0
SCL = 1; //RS registered
SCL = 0;

}
void WriteData(unsigned char dat)
{
unsigned char i;
for (i=0x80;i;i>>=1)
{
if((dat&0x80)==0x80)
SDOUT = 1;
else
SDOUT = 0;
dat=(dat<<1);
SCL = 0;
SCL = 1;
SCL = 0;
}

}

void init()
{
WriteCommand(0x38);//function set
delay(30);
WriteCommand(0x06);//entry mode set
delay(30);
WriteCommand(0x02);//return home
delay(30);
WriteCommand(0x01);//clear display
delay(30);
WriteCommand(0x0c);//display on
delay(30);
WriteCommand(0x80);//line 1 character 1
delay(30);
}

void main()
{
char i=0x21, j;



init();

while(1)
{
C_S = 1;
WriteCommand(0x80); //Line 1

WriteDataInit();
//WriteDataInit() must only be executed once before starting to write data
//if WriteDataInit() is executed between writes, the display will recognize the two bits as data bits and not RS/RW bits. 
for(j=0; j<20; j++)
{
WriteData(i++);
delay(10);
}

C_S = 1;
//Pulling C_S High means write data is completed
//if next instruction to the display is data, must use WriteDataInit() first
//if write command is executed without pulling C_S high, it will recognize the following instruction on the bus as data regardless
WriteCommand(0xC0); //Line 2

WriteDataInit();
for(j=0; j<20; j++)
{
WriteData(i++);
delay(10);
}

C_S = 1;
WriteCommand(0x94); //Line 3

WriteDataInit();
for(j=0; j<20; j++)
{
WriteData(i++);
delay(10);
}


C_S = 1;
WriteCommand(0xD4); //Line 4

WriteDataInit();
for(j=0; j<20; j++)
{
WriteData(i++);
delay(10);
}

}
}

SkipSky

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« Reply #5 on: February 24, 2017, 02:31:01 AM »
Dear Saurabh_B,

Thanks for that code and the response. Since my original message a couple of days ago, I have made much progress with the 0420DZW-AY5 4x20 display. I like the display, low operating temp., the presentation, brightness, clarity, and low power consumption. BBBBuuuutttt...........your data sheet is very SKIMPY!!!!!

I was able, fortunately, to work through most of the initial problems thanks to NewbieHack.com. This fellow that posts the tutorials there had exactly what I needed to get up and running with your display. There are about 4 videos listed under "Micro Controller Tutorials" about getting an LCD/LED connected and programmed using a micro controller that are "must know" information on this subject. Left with only your data-sheet, I never would have got this display up and running. I used a USBtiny to flash programming from my computer via AVRDUDE to an AVR ATmega 168a to run the display. 

The numbering system (to direct to display presentation locations) used for his example display (he was using a 4 x 20 LCD display) was somewhat different than the 420DZW numbering system, so I had to tweak the programming to reflect that. It was a good exercise to help understand why my first few attempts were coming out on different lines and locations for my characters.

Find attached the  C code that I tweaked to run the 420DZW with a moving "X" that migrates every position on the display. It also displays a counter to show the current location of the X. It works on my set-up, don't know about others. I think most of the headers are readily available. The credit for the basic program goes to NewbieHack.com.

Sincerely,
Skip Dykema

Ps: well, I thought I attached the code, but I guess your site won't allow attaching C code, Oh well.  Ok-I copied and pasted below:


#include <avr/io.h>
#include <util/delay_basic.h>
#include <myTimer.h>
#include <stdlib.h>
#ifdef __avr__
  #include <util/delay.h>
#endif


#define MrLCDsCrib PORTB
#define DataDir_MrLCDsCrib DDRB
#define MrLCDsControl PORTD
#define DataDir_MrLCDsControl DDRD
#define LightSwitch 5
#define ReadWrite 7
#define BiPolarMood 2

char firstColumnPositionsForMrLCD[4] = {64, 00, 84, 20};
void Check_IF_MrLCD_isBusy(void);
void Peek_A_Boo(void);
void Send_A_Command(unsigned char command);
void Send_A_Character(unsigned char character);
void Send_A_String(char *StringOfCharacters);
void GotoMrLCDsLocation(uint8_t x, uint8_t y);
char positionString[2];



int main(void)
{
    DataDir_MrLCDsControl |= 1<<LightSwitch | 1<<ReadWrite | 1<<BiPolarMood;
_delay_ms(200);

Send_A_Command(0x01); //Clear Screen 0x01 = 00000001
_delay_ms(200);
Send_A_Command(0x38);
_delay_ms(500);
Send_A_Command(0b00001100);
_delay_ms(500);




    while(1)
    {
        int x,y;
        for (y = 1; y <= 4; y++)
            {
                Send_A_Command(0x01);
                _delay_ms(200);
                        for(x =0;x <=19; x++)
                        {
                            char positionString[1];
                            itoa(x + 1, positionString, 10);
                            GotoMrLCDsLocation(12, 3);
                            Send_A_String("X = ");
                            Send_A_String(positionString);


                            itoa(y, positionString, 10);
                            GotoMrLCDsLocation(12, 4);
                            Send_A_String("Y = ");
                            Send_A_String(positionString);

                            GotoMrLCDsLocation(x, y);
                            Send_A_String("x");

                            _delay_ms(10000);

                            GotoMrLCDsLocation(x, y);
                            Send_A_String(" ");

                            itoa(x, positionString, 10);
                            GotoMrLCDsLocation(12, 3);
                            Send_A_String(" ");
                            itoa(y, positionString, 10);
                            GotoMrLCDsLocation(12, 4);
                            Send_A_String(" ");

                        }


            }
    }
    return(0);

}

void Check_IF_MrLCD_isBusy()
{
DataDir_MrLCDsCrib = 0;
MrLCDsControl |= 1<<ReadWrite;
MrLCDsControl &= ~1<<BiPolarMood;

while (MrLCDsCrib >= 0x80)
{
Peek_A_Boo();
}

DataDir_MrLCDsCrib = 0xFF; //0xFF means 0b11111111
}

void Peek_A_Boo()
{
MrLCDsControl |= 1<<LightSwitch;
asm volatile ("nop");
asm volatile ("nop");
MrLCDsControl &= ~1<<LightSwitch;
}

void Send_A_Command(unsigned char command)
{
Check_IF_MrLCD_isBusy();
MrLCDsCrib = command;
MrLCDsControl &= ~ ((1<<ReadWrite)|(1<<BiPolarMood));
Peek_A_Boo();
MrLCDsCrib = 0;
}

void Send_A_Character(unsigned char character)
{
Check_IF_MrLCD_isBusy();
MrLCDsCrib = character;
MrLCDsControl &= ~ (1<<ReadWrite);
MrLCDsControl |= 1<<BiPolarMood;
Peek_A_Boo();
MrLCDsCrib = 0;
}

void Send_A_String(char *StringOfCharacters)
{
while(*StringOfCharacters > 0)
{
Send_A_Character(*StringOfCharacters++);
}
}

void GotoMrLCDsLocation(uint8_t x, uint8_t y)
{
Send_A_Command(0x80 + firstColumnPositionsForMrLCD[y-1] + (x));
}

 

NHD‐0420CW‐AB3 I2C Interface

Started by andersonpdBoard OLEDs

Replies: 1
Views: 2721
Last post January 23, 2015, 10:00:06 AM
by Michael_L
NHD‐0420DZW‐AY5 SPI Interface

Started by vinaykBoard OLEDs

Replies: 0
Views: 2112
Last post October 26, 2015, 05:13:10 AM
by vinayk
NHD‐3.12‐25664UMB3 3 or 4 wire interface

Started by cliffgBoard OLEDs

Replies: 1
Views: 2551
Last post February 13, 2015, 04:43:21 PM
by Michael_L
NHD-2.4-240320CF-CTXI#-FT (ST7789S controller) and STM32F4 FSMC LCD Interface

Started by deshayesBoard TFTs

Replies: 1
Views: 2747
Last post March 17, 2016, 06:25:18 PM
by fahad
7.0" TFTs with capacitive Touch and 8080 interface availability?

Started by gdoraisaBoard TFTs

Replies: 1
Views: 1325
Last post June 30, 2016, 07:54:11 AM
by Saurabh_B