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 - Paul_B

Pages: 1 ... 17 18 [19] 20
271
Character LCDs / Re: Need some help with NHD-0216WZ-RN-YBW-2
« on: February 17, 2015, 10:37:10 AM »
Hello,

This is an older model display made several years ago and we no longer support it. I'm sorry, unfortunately we do not have a datasheet available.


272
OLEDs / Re: Need help/wisdom using the new NHD-0420CW-xxx
« on: February 17, 2015, 07:51:19 AM »
Hey George,

Do you have pull-up resistors on SDA and SCL (10k) when using I2C?

Also please try the code below in SPI, I have made some modifications (see comments):

Code: [Select]
#include <Wire.h>
//#include <SPI.h>

int RS = 30;
int  E = 31;
int RES = 32;
int CS = 33;

int ASDA = 20;
int ASCL = 21;

int SCLK = 52;
int SDIN = 51;
int SDOUT = 50;

// R/W signal tied LOW (always write)

unsigned char tx_packet[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const char slave2w = 0x3C;  //3C or 78

unsigned char mode = 0; // 0 = 8-bit parallel 6800 mode; 1 = i2c mode; 2 = SPI mode;

unsigned char text1[] = {"Newhaven Display----"};
unsigned char text2[] = {"Test----------------"};
unsigned char text3[] = {"16/20 Characters----"};
unsigned char text4[] = {"!@#$%^&*()_+{}[]<>?~"};

void command(unsigned char c)
{
  unsigned char i, temp;
  switch(mode)
  {
    case 0:   digitalWrite(CS, LOW);
              PORTA = c;
              digitalWrite(RS, LOW);
              digitalWrite(E, HIGH);
              delay(1);
              digitalWrite(E, LOW);
              digitalWrite(CS, HIGH);
              break;
   case 1:    tx_packet[0] = 0x00;
              tx_packet[1] = c;
              send_packet(2);
              break;
   case 2:   
              temp = 0xF8;
              for(i=0;i<8;i++)
              {
                digitalWrite(SCLK, LOW);
                if((temp&0x80)>>7==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                temp = temp << 1;
                digitalWrite(SCLK, HIGH);
              }
 
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((c&0x01)==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                c = c >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((c&0x1)==0x1) // <------- Change
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                c = c >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              break;
  }
 
}
void data(unsigned char d)
{
  unsigned char i, temp;
  switch(mode)
  {
    case 0:   digitalWrite(CS, LOW);
              PORTA = d;
              digitalWrite(RS, HIGH);
              digitalWrite(E, HIGH);
              delay(1);
              digitalWrite(E, LOW);
              digitalWrite(CS, HIGH);
              break;
   case 1:    tx_packet[0] = 0x40;
              tx_packet[1] = d;
              send_packet(2);
              break;
   case 2:   
              temp = 0xFA;
              for(i=0;i<8;i++)
              {
                digitalWrite(SCLK, LOW);
                if((temp&0x80)>>7==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                temp = temp << 1;
                digitalWrite(SCLK, HIGH);
              }
 
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((d&0x01)==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                d = d >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((d&0x1)==0x1) // <------- Change
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                d = d >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              break;
  }
 
}

void send_packet(unsigned char x)
{
  unsigned char ix;
 
  Wire.beginTransmission(slave2w);
  for(ix=0;ix<x;ix++)
  {
    Wire.write(tx_packet[ix]);
  }
  Wire.endTransmission();
}


void output()
{
int i;

        command(0x01);
        delay(2);
        for(i=0;i<20;i++){
          data(text1[i]);
        }
       
        command(0xA0);
        for(i=0;i<20;i++){
          data(text2[i]);
        }
       
        command(0xC0);
        for(i=0;i<20;i++){
          data(text3[i]);
        }
        command(0xE0);
        for(i=0;i<20;i++){
          data(text4[i]);
        }
        delay(2000);

command(0x01);
        delay(2);
for (i=0;i<20;i++){
data(text3[i]);
}

command(0xA0);
for (i=0;i<20;i++){
data(text4[i]);
}

command(0xC0);
for (i=0;i<20;i++){
data(text1[i]);
}

command(0xE0);
for (i=0;i<20;i++){
data(text2[i]);
}
}

void outputTest()
{
int i;

        command(0x01);
        delay(2);
        data('N');
        while(1);
       
        for(i=0;i<20;i++){
          data(text1[i]);
        }
       
        command(0xA0);
        for(i=0;i<20;i++){
          data(text2[i]);
        }
       
        command(0xC0);
        for(i=0;i<20;i++){
          data(text3[i]);
        }
        command(0xE0);
        for(i=0;i<20;i++){
          data(text4[i]);
        }
        delay(2000);

command(0x01);
        delay(2);
for (i=0;i<20;i++){
data(text3[i]);
}

command(0xA0);
for (i=0;i<20;i++){
data(text4[i]);
}

command(0xC0);
for (i=0;i<20;i++){
data(text1[i]);
}

command(0xE0);
for (i=0;i<20;i++){
data(text2[i]);
}
}

void blocks()
{
int i;

        command(0x01);
        delay(2);

        for(i=0;i<20;i++){
          data(0x1F);
        }

        command(0xA0);
        for(i=0;i<20;i++){
          data(0x1F);
        }
}

void setup()
{
  pinMode(ASCL, OUTPUT);      //set Arduino I2C lines as outputs
  pinMode(ASDA, OUTPUT);      //
  digitalWrite(ASCL, LOW);    //
  digitalWrite(ASDA, LOW);    //
  pinMode(SCLK, OUTPUT);
  pinMode(SDIN, OUTPUT);
  pinMode(SDOUT, INPUT);
  digitalWrite(SCLK, HIGH);
  digitalWrite(SDIN, HIGH);
  DDRA = 0xFF;
  PORTA = 0x00;
  DDRC = 0xFF;
  PORTC = 0x00;
  digitalWrite(RES, HIGH);
  delay(10);
  Wire.begin();
  delay(10);
  //SPI.begin();
command(0x2A);  //function set (extended command set)
command(0x71);  //function selection A, disable internal Vdd regualtor
data(0x00);
command(0x28);  //function set (fundamental command set)
command(0x08);  //display off, cursor off, blink off
command(0x2A);  //function set (extended command set)
command(0x79);  //OLED command set enabled
command(0xD5);  //set display clock divide ratio/oscillator frequency
command(0x70);  //set display clock divide ratio/oscillator frequency
command(0x78);  //OLED command set disabled
command(0x09);  //extended function set (4-lines)
    command(0x06);  //COM SEG direction
command(0x72);  //function selection B, disable internal Vdd regualtor
data(0x00);     //ROM CGRAM selection
command(0x2A);  //function set (extended command set)
command(0x79);  //OLED command set enabled
command(0xDA);  //set SEG pins hardware configuration
command(0x10);  //set SEG pins hardware configuration   // <--------- Change
command(0xDC);  //function selection C
command(0x00);  //function selection C
command(0x81);  //set contrast control
command(0x7F);  //set contrast control
command(0xD9);  //set phase length
command(0xF1);  //set phase length
command(0xDB);  //set VCOMH deselect level
command(0x40);  //set VCOMH deselect level
command(0x78);  //OLED command set disabled
command(0x28);  //function set (fundamental command set)
command(0x01);  //clear display
command(0x80);  //set DDRAM address to 0x00
command(0x0C);  //display ON
  delay(100);
  //Wire.begin();
  //delay(10);
}

void loop()

  while(1)
  {
    output();
    //blocks();
    while(1);
    //outputTest();
    delay(2000);
  }
}

Thanks!

273
OLEDs / Re: Need help/wisdom using the new NHD-0420CW-xxx
« on: February 16, 2015, 12:36:16 PM »
Correct, give the new code a try and keep me posted  :D

274
OLEDs / Re: Need help/wisdom using the new NHD-0420CW-xxx
« on: February 16, 2015, 09:08:47 AM »
Hello,

void output()  //This function is used to display an Array of text on the screen.
{
   int i;

        command(0x01); //This is clearing the display
        delay(2);
        for(i=0;i<20;i++){ // loops through Array text1
          data(text1);
        }
       
        command(0xa0); // Send cursor to line 2
        for(i=0;i<20;i++){
          data(text2);
        }
......

void outputTest() // You can ignore this function, it isn't actually called.   This function was written to test the output.
{
   int i;

        command(0x01);
        delay(2);
        data('N');
        while(1);
       
        for(i=0;i<20;i++){
          data(text1);
        }
       
        command(0xA0);
        for(i=0;i<20;i++){
          data(text2);
        }
        delay(2000);

   command(0x01);
        delay(2);
   for (i=0;i<20;i++){
      data(text3);
   }
   
   command(0xA0);
   for (i=0;i<20;i++){
      data(text4);
   }
}


Please try the code below (I have modified it for the 4x20 instead of 2x16):

Code: [Select]
#include <Wire.h>
//#include <SPI.h>

int RS = 30;
int  E = 31;
int RES = 32;
int CS = 33;

int ASDA = 20;
int ASCL = 21;

int SCLK = 52;
int SDIN = 51;
int SDOUT = 50;

// R/W signal tied LOW (always write)

unsigned char tx_packet[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const char slave2w = 0x3C;  //3C or 78

unsigned char mode = 0; // 0 = 8-bit parallel 6800 mode; 1 = i2c mode; 2 = SPI mode;

unsigned char text1[] = {"Newhaven Display----"};
unsigned char text2[] = {"Test----------------"};
unsigned char text3[] = {"16/20 Characters----"};
unsigned char text4[] = {"!@#$%^&*()_+{}[]<>?~"};

void command(unsigned char c)
{
  unsigned char i, temp;
  switch(mode)
  {
    case 0:   digitalWrite(CS, LOW);
              PORTA = c;
              digitalWrite(RS, LOW);
              digitalWrite(E, HIGH);
              delay(1);
              digitalWrite(E, LOW);
              digitalWrite(CS, HIGH);
              break;
   case 1:    tx_packet[0] = 0x00;
              tx_packet[1] = c;
              send_packet(2);
              break;
   case 2:   
              temp = 0xF8;
              for(i=0;i<8;i++)
              {
                digitalWrite(SCLK, LOW);
                if((temp&0x80)>>7==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                temp = temp << 1;
                digitalWrite(SCLK, HIGH);
              }
 
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((c&0x01)==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                c = c >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((c&0x10)==0x10)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                c = c >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              break;
  }
 
}
void data(unsigned char d)
{
  unsigned char i, temp;
  switch(mode)
  {
    case 0:   digitalWrite(CS, LOW);
              PORTA = d;
              digitalWrite(RS, HIGH);
              digitalWrite(E, HIGH);
              delay(1);
              digitalWrite(E, LOW);
              digitalWrite(CS, HIGH);
              break;
   case 1:    tx_packet[0] = 0x40;
              tx_packet[1] = d;
              send_packet(2);
              break;
   case 2:   
              temp = 0xFA;
              for(i=0;i<8;i++)
              {
                digitalWrite(SCLK, LOW);
                if((temp&0x80)>>7==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                temp = temp << 1;
                digitalWrite(SCLK, HIGH);
              }
 
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((d&0x01)==1)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                d = d >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                if((d&0x10)==0x10)
                {
                  digitalWrite(SDIN, HIGH);
                }
                else
                {
                  digitalWrite(SDIN, LOW);
                }
                d = d >> 1;
                digitalWrite(SCLK, HIGH);
              }
              for(i=0;i<4;i++)
              {
                digitalWrite(SCLK, LOW);
                digitalWrite(SDIN, LOW);
                digitalWrite(SCLK, HIGH);
              }
              break;
  }
 
}

void send_packet(unsigned char x)
{
  unsigned char ix;
 
  Wire.beginTransmission(slave2w);
  for(ix=0;ix<x;ix++)
  {
    Wire.write(tx_packet[ix]);
  }
  Wire.endTransmission();
}


void output()
{
int i;

        command(0x01);
        delay(2);
        for(i=0;i<20;i++){
          data(text1[i]);
        }
       
        command(0xA0);
        for(i=0;i<20;i++){
          data(text2[i]);
        }
       
        command(0xC0);
        for(i=0;i<20;i++){
          data(text3[i]);
        }
        command(0xE0);
        for(i=0;i<20;i++){
          data(text4[i]);
        }
        delay(2000);

command(0x01);
        delay(2);
for (i=0;i<20;i++){
data(text3[i]);
}

command(0xA0);
for (i=0;i<20;i++){
data(text4[i]);
}

command(0xC0);
for (i=0;i<20;i++){
data(text1[i]);
}

command(0xE0);
for (i=0;i<20;i++){
data(text2[i]);
}
}

void outputTest()
{
int i;

        command(0x01);
        delay(2);
        data('N');
        while(1);
       
        for(i=0;i<20;i++){
          data(text1[i]);
        }
       
        command(0xA0);
        for(i=0;i<20;i++){
          data(text2[i]);
        }
       
        command(0xC0);
        for(i=0;i<20;i++){
          data(text3[i]);
        }
        command(0xE0);
        for(i=0;i<20;i++){
          data(text4[i]);
        }
        delay(2000);

command(0x01);
        delay(2);
for (i=0;i<20;i++){
data(text3[i]);
}

command(0xA0);
for (i=0;i<20;i++){
data(text4[i]);
}

command(0xC0);
for (i=0;i<20;i++){
data(text1[i]);
}

command(0xE0);
for (i=0;i<20;i++){
data(text2[i]);
}
}

void blocks()
{
int i;

        command(0x01);
        delay(2);

        for(i=0;i<20;i++){
          data(0x1F);
        }

        command(0xA0);
        for(i=0;i<20;i++){
          data(0x1F);
        }
}

void setup()
{
  pinMode(ASCL, OUTPUT);      //set Arduino I2C lines as outputs
  pinMode(ASDA, OUTPUT);      //
  digitalWrite(ASCL, LOW);    //
  digitalWrite(ASDA, LOW);    //
  pinMode(SCLK, OUTPUT);
  pinMode(SDIN, OUTPUT);
  pinMode(SDOUT, INPUT);
  digitalWrite(SCLK, HIGH);
  digitalWrite(SDIN, HIGH);
  DDRA = 0xFF;
  PORTA = 0x00;
  DDRC = 0xFF;
  PORTC = 0x00;
  digitalWrite(RES, HIGH);
  delay(10);
  Wire.begin();
  delay(10);
  //SPI.begin();
  command(0x2A);  //function set (extended command set)
    command(0x71);  //function selection A, disable internal Vdd regualtor
    data(0x00);
command(0x28);  //function set (fundamental command set)
command(0x08);  //display off, cursor off, blink off
command(0x2A);  //function set (extended command set)
command(0x79);  //OLED command set enabled
command(0xD5);  //set display clock divide ratio/oscillator frequency
command(0x70);  //set display clock divide ratio/oscillator frequency
command(0x78);  //OLED command set disabled
command(0x09);  //extended function set (4-lines)
        command(0x06);  //COM SEG direction
command(0x72);  //function selection B, disable internal Vdd regualtor
data(0x00);     //ROM CGRAM selection
command(0x2A);  //function set (extended command set)
command(0x79);  //OLED command set enabled
command(0xDA);  //set SEG pins hardware configuration
command(0x00);  //set SEG pins hardware configuration   ////////////////////////////////////0x10 on other slim char OLEDs
command(0xDC);  //function selection C
command(0x00);  //function selection C
command(0x81);  //set contrast control
command(0x7F);  //set contrast control
command(0xD9);  //set phase length
command(0xF1);  //set phase length
command(0xDB);  //set VCOMH deselect level
command(0x40);  //set VCOMH deselect level
command(0x78);  //OLED command set disabled
command(0x28);  //function set (fundamental command set)
command(0x01);  //clear display
command(0x80);  //set DDRAM address to 0x00
command(0x0C);  //display ON
  delay(100);
  //Wire.begin();
  //delay(10);
}

void loop()

  while(1)
  {
    output();
    //blocks();
    while(1);
    //outputTest();
    delay(2000);
  }
}

275
OLEDs / Re: Driving Slim OLED from 3.3V system
« on: February 16, 2015, 08:13:26 AM »
Hello,

Page 4 in the displays datasheet will list the pin description, it will be sorted by interface e.g SPI, I2c ..etc In your case please follow the SPI pin description as-well as the Serial MPU Interface Pin Selections (when using SPI BS0 - BS1- BS2 must be tied to ground).

http://www.newhavendisplay.com/specs/NHD-0420CW-AY3.pdf


We also have some example Arduino code available, please see the link below:

https://github.com/NewhavenDisplay/NHD_US2066-Arduino-Mega

Hope this helps!

276
OLEDs / Re: interface voltage levels for NHD-0420CW
« on: February 12, 2015, 01:56:20 PM »
No problem, have a good one!  :)

277
OLEDs / Re: interface voltage levels for NHD-0420CW
« on: February 12, 2015, 08:23:58 AM »
Hello Pasquale,

The logic voltage levels will be based on the supply.

With a 2.8V supply, H Level input = 0,8*2.8; and L Level input = 0,2*2.8
With a 5.0V supply, H Level input = 0,8*5.0; and L Level input = 0,2*5.0

Hope this helps!

278
OLEDs / Re: Driving Slim OLED from 3.3V system
« on: February 12, 2015, 08:08:07 AM »
Hello,

Question 1: Confirm that the logic lines can just be connected directly to the PIC

Answer:

Yes, I can confirm that the logic lines can be connected directly to the PIC.


Question 2: Clarify what should be connected to VDD and REGVDD to run at 3.3 volts

Answer:

VDD will be connected to 3.3 volts and REGVDD must be connected to GND.

Hope this helps!

279
No problem John, enjoy the LCD's!

280
Hello John,

The best contrast would be black text with a white background  8)

Please see the link below:
http://www.newhavendisplay.com/nhd0216k1zfswfbwl-p-296.html

281
Hello,

Transmissive:

An LCD screen that uses a backlight. Transmissive LCDs are widely used in portable computers and provide excellent viewing indoors. They must be used outdoors in the shade because direct sunlight overwhelms the backlight, making viewing difficult, if not impossible.

Reflective:

A reflective LCD uses the ambient light in the vicinity. The light passes through the LCD layer to a mirror, which reflects it back to the viewer. Reflective LCDs are the least costly, but require bright light. Viewing is difficult in dark rooms or outside at night. Reflective LCDs can also be built with frontlights, which significantly improve the viewing in dimly lit environments.

Transflective:

A transflective LCD uses both transmissive and reflective methods. It uses a backlight as does transmissive, but also adds a reflective mirror that lets light pass through from the back.

Transflective LCDs are a compromise that allows users to obtain better viewing under both lighting conditions. However, because the mirror is built to let through backlight as well as reflect frontlight, it cannot do both equally as well as mirrors dedicated to one purpose. As a result, transflective LCDs are typically not quite as bright indoors as transmissive units and not as bright outdoors as reflective ones.


Even though transflective appears to be the best method, it may not be the best for you. You need to consider your applications specific needs. For your application you can use either a reflective or a transflective LCD.

Hope this helps!

282
TFTs / Re: NHD-5.0-800480TF-ATXL#-CTP backlight Driver
« on: February 11, 2015, 07:49:17 AM »
Hello,

We do not have a specific part number for driving the backlight, if you search on Mouser for "LED Lighting Drivers" you will find what you are looking for.

Please see the link below:

http://www.mouser.com/ProductDetail/Fairchild-Semiconductor/FAN5333BSX/?qs=7b5JlGc8jUgG8nkhKPwSvQ%3D%3D

Hope this helps!

283
OLEDs / Re: 0420CW-AB3 I2C Talking, Display is off and low current drawn
« on: February 10, 2015, 07:39:49 AM »
No problem, enjoy your display!

284
OLEDs / Re: Need help/wisdom using the new NHD-0420CW-xxx
« on: February 10, 2015, 07:38:06 AM »
No problem George, happy coding!

285
OLEDs / Re: 0420CW-AB3 I2C Talking, Display is off and low current drawn
« on: February 09, 2015, 02:05:33 PM »
Hello,

It is definitely possible that you may have damaged the display, however lets first rule out user error.


Can you please answer the following questions:

What value pull-up resistors are you using?

When using VDD is REGVDD grounded?

Does your initialization sequence match with what is listed in the datasheet.

Finally, if possible can you please upload your code.

Thanks!


Pages: 1 ... 17 18 [19] 20