Getting started NHD-1.8-128160EF-CTXI#-FT
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?
-
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:
//---------------------------------------------------------
/*
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 https://newhavendisplay.com/molex-surface-mount-ffc-fpc-connector-0.5-mm-pitch-52435-2471/, the https://newhavendisplay.com/2x20-thru-hole-various-pitch-smd-cog-breakout-board/, and https://newhavendisplay.com/2x12-dual-row-pin-header-connector/
0 -
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.0 -
You are very welcome. I have never used them, but you can take a look at the Microchip AR1000/AR1100 series resistive touch controllers.
0
Please sign in to leave a comment.
Comments
3 comments