Author Topic: Getting started NHD-1.8-128160EF-CTXI#-FT  (Read 3652 times)

stone

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Getting started NHD-1.8-128160EF-CTXI#-FT
« on: July 13, 2014, 09:24:42 AM »
I have experience with microcontrollers and LCD-Displays.
I want to use the Arduino Mega 2560 via a touch screen.
For example, an LED is to be turned on and turned off via the touchscreen.

I need some information for TFT-Display:
  • I can just connect the display to a microcontroller (for example, Arduino Mega 2560) or needs an additional controller?
  • I see some FFC to Thru-Hole Adapters in your shop. I never found a 24-PIN-Adapter for this display.
  • I see code for the display but not for using the touchscreen. How to control the touchscreen?

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: Getting started NHD-1.8-128160EF-CTXI#-FT
« Reply #1 on: July 14, 2014, 08:29:16 AM »
That display has a built-in TFT controller, so for the display to operate with the Arduino, you would not need an additional controller.  For the touch screen however, there is no built-in controller.  You can use the resistive touch panel by either using an external 4-wire resistive touch controller IC, (such as ones offered by Microchip, TI, etc.), or by using your MCU's ADC pins and manually driving it in software.  There are examples/tutorials available on the internet that explain this with using an Arduino, however we do not have example code for this.  We have example code for the display on our website, and I actually have some Arduino code for it that I have shared below:

Code: [Select]
//---------------------------------------------------------
/*
NHD_1_8_128160EF_CTXI_mega.ino
Program for writing to Newhaven Display 1.8 TFT with ILI9163 controller

(c)2013 Mike LaVine - Newhaven Display International, LLC.

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
*/
//---------------------------------------------------------

// The 8 bit data bus is connected to PORTA of the Arduino Mega2560
// 5V voltage regulator on Arduino Mega has been replaced with a 3.3V regulator to provide 3.3V logic

int DC = 30;      // D/C signal connected to Arduino digital pin 30
int WR = 31;      // /WR signal connected to Arduino digital pin 31
int RD = 32;      // /RD signal connected to Arduino digital pin 32
int RST = 33;     // /RST signal connected to Arduino digital pin 33

// /CS signal tied to ground

void comm_out(unsigned char c)
{
  digitalWrite(DC, LOW);
  PORTA = c;
  digitalWrite(WR, LOW);
  digitalWrite(WR, HIGH);
}

void data_out(unsigned char d)
{
  digitalWrite(DC, HIGH);
  PORTA = d;
  digitalWrite(WR, LOW);
  digitalWrite(WR, HIGH);
}
void disp()
{
unsigned int i;
comm_out(0x2C);              //command to begin writing to frame memory
for(i=0;i<20480;i++)         //fill screen with red pixels
{
    data_out(0xFF);
            data_out(0x00);
            data_out(0x00);
}
        for(i=0;i<20480;i++)         //fill screen with green pixels
{
    data_out(0x00);
            data_out(0xFF);
            data_out(0x00);
        }
        for(i=0;i<20480;i++)         //fill screen with blue pixels
{
    data_out(0x00);
            data_out(0x00);
            data_out(0xFF);
        }
}

void setup()
{
  DDRC = 0xFF;   
  PORTC = 0x00;
  DDRA = 0xFF;
  PORTA = 0x00;
  digitalWrite(RD, HIGH);
  digitalWrite(WR, LOW);
  digitalWrite(RST, LOW);
  delay(150);
  digitalWrite(RST, HIGH);
  delay(150);
 
  comm_out(0x11);              //exit SLEEP mode
 
  delay(100);
 
  comm_out(0x28);              //display off
 
  comm_out(0x26);              //select gamma curve
  data_out(0x04);
 
  comm_out(0xB1);              //frame rate control
  data_out(0x0A);
  data_out(0x14);
 
  comm_out(0xC0);              //power control 1
  data_out(0x0A);
  data_out(0x00);
 
  comm_out(0xC1);              //power control 2
  data_out(0x02);
 
  comm_out(0xC5);              //VCOM control 1
  data_out(0x2F);
  data_out(0x3E);
 
  comm_out(0xC7);              //VCOM control 2
  data_out(0x40);
 
  comm_out(0x2A);              //column address set
  data_out(0x00);                 
  data_out(0x00);                  //start 0x0000
  data_out(0x00);
  data_out(0x7F);                  //end 0x007F
 
  comm_out(0x2B);              //page address set
  data_out(0x00);                 
  data_out(0x00);                  //start 0x0000
  data_out(0x00);
  data_out(0x9F);                  //end 0x009F
 
  comm_out(0x36);              //memory access control
  data_out(0xC8);
 
  comm_out(0x3A);              //pixel format = 18 bit per pixel
  data_out(0x06);                 
 
  comm_out(0x29);              //display ON

  delay(10);
}

void loop()
{
  disp();
  delay(1000);
}

As for the 24-pin adapter, we don't have one pre-made like some of the other sizes you have seen, but if you would like to purchase one from us we can make one with the http://www.newhavendisplay.com/molex524352471-p-7276.html, the http://www.newhavendisplay.com/nhdcog1436-p-1107.html, and http://www.newhavendisplay.com/2x12-pin-header-soldered-onto-your-display-p-6388.html.

stone

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Getting started NHD-1.8-128160EF-CTXI#-FT
« Reply #2 on: July 14, 2014, 02:34:15 PM »
Thank you for the quick reply.  :)

I am looking for a suitable IC for the Touchsceen.
If I found something, I'm going to order a display.

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: Getting started NHD-1.8-128160EF-CTXI#-FT
« Reply #3 on: July 15, 2014, 09:06:22 AM »
You are very welcome.  I have never used them, but you can take a look at the Microchip AR1000/AR1100 series resistive touch controllers.

 

NHD-2.4-240320CF-CTXI#-FT (ST7789S controller) and STM32F4 FSMC LCD Interface

Started by deshayesBoard TFTs

Replies: 1
Views: 2685
Last post March 17, 2016, 06:25:18 PM
by fahad
NHDEV firmware to support NHD-2.4-240320CF-CTXI#-FT (ST7889S controller)

Started by deshayesBoard Evaluation Tools

Replies: 2
Views: 2649
Last post November 23, 2017, 03:56:56 AM
by tolikkk
NHD-2.4-240320CF-CTXI#-FT ribbon cable question

Started by tom66888Board TFTs

Replies: 1
Views: 2196
Last post October 02, 2015, 08:29:03 AM
by Saurabh_B
ATSAM4E -NHD-2.4-240320CF-CTXI#-F - White Screen

Started by gentlemannBoard TFTs

Replies: 2
Views: 2118
Last post February 18, 2016, 01:08:35 PM
by Paul_B
Sample Code for NHD-2.4-240320CF-CTXI with UNO or Metro

Started by fahadBoard TFTs

Replies: 1
Views: 2039
Last post March 18, 2016, 08:42:03 AM
by Paul_B