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

Pages: [1]
1
Accessories / Re: Bezel for 4.3" display
« on: July 03, 2017, 11:32:40 AM »
Please check http://www.elwoodcontrols.com as they will offer pre-made front bezels for our 4.3" TFT and many other sizes of our displays.

2
Here is some example Arduino code for a 2x16 display using I2C that may help to get you started.

/******************************************************
 * Using i2c on NHD 0216KZ3
 * ARDUINO MEGA
 */

#define SCLK 21
#define SDO 20



const char Slave    = 0x50;

const char t1[]=("Newhaven Display");
const char t2[]=("    LINE  2     ");

void I2C_out(unsigned char j){
  int n;
  unsigned char d;
  d=j;
  for(n = 0; n<8; n++){
    if((d&0x80) == 0x80)
      digitalWrite(SDO, HIGH);
    else
      digitalWrite(SDO, LOW);
    d = (d<<1);
    digitalWrite(SCLK, LOW);
    delay(10);
    digitalWrite(SCLK, HIGH);
    delay(5);
    digitalWrite(SCLK, LOW);
    delay(10);
  }
  digitalWrite(SCLK, HIGH);
  delay(1);
  while(SDO ==1){
   
    digitalWrite(SCLK, LOW);
    //delay(1);
    digitalWrite(SCLK, HIGH);
    //delay(1);
   
  }
  digitalWrite(SCLK, LOW);
}
void I2C_Start(){
  digitalWrite(SCLK, HIGH);
  digitalWrite(SDO, HIGH);
  digitalWrite(SDO, LOW);
  digitalWrite(SCLK, LOW);
}

void I2C_Stop(){
  digitalWrite(SDO, LOW);
  digitalWrite(SCLK, LOW);
  digitalWrite(SCLK, HIGH);
  digitalWrite(SDO, HIGH);
}
void disp(const char *text)
{
  int n;
  for(n=0;n<16;n++)
  {
    I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(*text);
    text++;
    I2C_Stop();
    delay(10);
  }
}

void setup() {
  // put your setup code here, to run once:
  pinMode(SDO, OUTPUT);
  pinMode(SCLK, OUTPUT);
  digitalWrite(SCLK, LOW);
  digitalWrite(SDO, LOW);
 
  I2C_Start();
  delay(1);
  I2C_out(0x50);
  delay(1);
 
  delay(10);
  I2C_out(0xFE);
  I2C_out(0x51);
  I2C_Stop();
  delay(100);
  I2C_Start();
  delay(5);
  I2C_out(Slave);
  delay(5);
  I2C_out(0xFE);
  I2C_out(0x46);
  delay(10);
  I2C_Stop();
  delay(100);
  I2C_Start();
  delay(5);
  I2C_out(Slave);
  delay(5);
  I2C_out(0xFE);
  I2C_out(0x47);
 

  delay(100);
  I2C_Stop();
  delay(10);
  I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(0xFE);
    I2C_out(0x52);
    delay(5);
    I2C_out(40);
    delay(5);
    I2C_Stop();
    delay(250);
 
 
}

void loop() {
  unsigned char x = 0x21;
  int i;
  I2C_Start();
  delay(5);
  I2C_out(Slave);
  delay(5);
  I2C_out(0xFE);
  I2C_out(0x51);
  I2C_Stop();
  double a;
  char buff[10];
  a = 2.523;

  sprintf(buff, "%g" , a);
  int n = 0;
  /*
    for (n = 0; n < 8 ; n ++){
      I2C_Start();
  delay(1);
  I2C_out(Slave);
  delay(1);
    I2C_out(buff[n]);
    delay(1);
    I2C_Stop();
    delay(1);
  }
 
  delay (2500);*/
  disp(t1);
  delay(100);

  delay(100);
  I2C_Start();
  delay(5);
  I2C_out(Slave);
  delay(5);
  I2C_out(0xFE);
  I2C_out(0x45);
  //delay(10);
  I2C_out(0x40);
  delay(10);
  I2C_Stop();
  delay(10);
  disp(t2);
  I2C_Stop();
  delay(1000);
  do{
   delay(10);
  for( i = 0 ; i < 50 ; i++){
    I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(0xFE);
    I2C_out(0x52);
    delay(5);
    I2C_out(i);
    delay(5);
    I2C_Stop();
    delay(5);
  }
  int b;
  for( i = 0 ; i < 51 ; i++){
    I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(0xFE);
    I2C_out(0x52);
    delay(5);
    b = 50 - i;
    I2C_out(b);
    delay(5);
    I2C_Stop();
    delay(25);
  }
  }while(1);
  /*for(i = 0; i < 57; i++){
    I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(x);
    x++;
    I2C_Stop();
    delay(10);
  }
// delay(5000);
 
  I2C_Start();
  delay(5);
  I2C_out(Slave);
  delay(5);
  I2C_out(0xFE);
 
  I2C_out(0x51);
  delay(10);

    I2C_out(0xFE);
  I2C_out(0x4B);
  delay(10);
  I2C_out(0xFE);
  I2C_out(0x46);
  delay(10);
  I2C_Stop();
  disp(t1);
  delay(1000);
  for( i = 0 ; i < 50 ; i++){
    I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(0xFE);
    I2C_out(0x52);
    delay(5);
    I2C_out(i);
    delay(5);
    I2C_Stop();
    delay(250);
  }
   I2C_Start();
    delay(5);
    I2C_out(Slave);
    delay(5);
    I2C_out(0xFE);
    I2C_out(0x52);
    delay(5);
    I2C_out(40);
    delay(5);
    I2C_Stop();
    delay(250);
 
  while(1);*/
 
}

3
We recommend using a level shifter to transition up to 5v logic levels to drive the display.
If 5v is not available in your design to power the display, then adding a 5v step-up DC to DC converter will be necessary.

4
OLEDs / Re: NHD-0420CW I2C interface
« on: February 02, 2017, 02:26:43 PM »
The Co bit can be kept low.  The data being sent will then be interpreted as Data or Command based on the  D/C# selection bit for the remainder of the write.  The I2C sequence will function as the standard protocol with the Co bit always low, beginning with the Start byte and using  D/C# and Ack/Nack bits until the last data byte ending with the stop.  If the Co bit is ever set High, then the display will ignore any data being sent to it during that time.

5
Character LCDs / Re: Skipping a line
« on: December 07, 2016, 08:34:58 AM »
Writing a string of characters to this display will first fill line 1, then move to line 3, followed by line 2 and lastly fill line 4.

To set the cursor at line 2 after you fill line 1 with characters, use the Set Cursor Command "0xFE 0x45" with "0x40" to position the cursor at the beginning of line 2.

See the Command description on page 9 in the datasheet for further details:

http://www.newhavendisplay.com/specs/NHD-0420D3Z-FL-GBW-V3.pdf

6
Character LCDs / Re: LED+ and VDD pins from different LCD character models.
« on: September 02, 2016, 12:25:33 PM »
The NHD-0216K1Z-NSB-FBW-L display already includes a current limiting resistor on it's PCB and therefore will run off the same +5v supply.

The difference with the LED voltage requirements of the NHD-02161Z-FSY-YBW-C display is that it does not include a current limiting resistor on it's PCB for the backlight.
To supply 5V to the backlight you could use a series current limiting resistor instead of a buck circuit. This display typically uses 20mA at 4.0V and to supply this I would recommend using a 50Ω resistor.

7
The ST7066U controller and the HD44780 controller are very similar. The instruction sets are the same and in this respect they are compatible. Be aware that there may be some timing differences that could need to be adjusted if you run into any issues.   

8
Hi Pradeep,

The DDRAM or (Display data RAM) contains the character data that is displayed on the screen. It stores the 8-bit standard characters preset for the display in 80x8 bits for up to 80 characters. Their address locations can be found on page 5 of the display specification: http://www.newhavendisplay.com/specs/NHD-0216K1Z-FSW-FBW-L.pdf

The CGRAM or (Character Generator RAM) is customizable, and can be used to write custom character patterns in a 5x8 dot format. Users can program this area to create and display up to 8 custom characters.
Details on how to program the CGRAM can be found on page 16 of the controller specification: http://www.newhavendisplay.com/app_notes/ST7066U.pdf

-Ted

Pages: [1]