Author Topic: Connecting NHD-1.8-128160EF-CSXN#-F to a Uno  (Read 1612 times)

aj

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Connecting NHD-1.8-128160EF-CSXN#-F to a Uno
« on: May 02, 2016, 12:00:44 PM »
Hi
I modified the sample code from app notes to run on a Arduino Uno but the LCD does not work. Can you help me with it?

Here is the code:
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 = 11;      // D/C signal connected to Arduino digital pin 30
int WR = 10;      // /WR signal connected to Arduino digital pin 31
int RD = 9;      // /RD signal connected to Arduino digital pin 32
int RST = 12;     // /RST signal connected to Arduino digital pin 33

// /CS signal tied to ground

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

void data_out(unsigned char d)
{
  digitalWrite(DC, HIGH);
  PORTD = 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;
  DDRD = 0xFF;
  PORTD = 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);
}

 

NHD-1.8-128160EF-CTXI ili9163 & SAM3s driver help needed

Started by JsaggioBoard TFTs

Replies: 0
Views: 1724
Last post February 01, 2016, 01:02:58 AM
by Jsaggio
NHD-1.8-128160EF-CTXI# problem: becomes pale after using it for some time

Started by fvdhoefBoard TFTs

Replies: 1
Views: 2961
Last post July 31, 2014, 08:55:40 AM
by Michael_L
Writing Character strings to NHD-1.8-128160EF-CTXI#

Started by JeffJwayBoard TFTs

Replies: 3
Views: 2642
Last post July 13, 2016, 09:45:21 AM
by Michael_L
NHD-1.8-128160EF-CTXI#-F has a display buffer?

Started by statelogicBoard TFTs

Replies: 2
Views: 2622
Last post January 09, 2015, 07:47:13 PM
by statelogic
NHD-1.8-128160EF-CTXI-FT Wakeup from sleep

Started by JeffJwayBoard TFTs

Replies: 1
Views: 1935
Last post July 07, 2015, 01:57:29 PM
by Michael_L