Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SkipSky

Pages: [1]
1
OLEDs / Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« 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));
}

2
OLEDs / Re: NHD-042ODZW-AY5 Jumpers for Serial Interface
« 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

Pages: [1]