Author Topic: NHD-1.8-128160EF-CSXN#-F Programming  (Read 2279 times)

Guenther

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
NHD-1.8-128160EF-CSXN#-F Programming
« on: February 03, 2016, 01:03:28 PM »
I recently purchased the above display together with the NHD-COG14-36 adapter, Molex connector and 2x12 pin header. I used the example 'NHD-1.8-128160EF with PIC32' and adapted it to my RC5600WM processor from digi.com. Besides any effort to verify my connection and coding the display plays dead - nothing whatsoever shows up on the display.

I am using 3.3V for VDD and IOVDD which should be the max according to specs. I verified every connection line that when I change it from my program that it reaches the Molex connector. My test program should fill the display with a single color but the display stays black. I turned on the backlight which showed all pixels white.

I would appreciate if someone could check for a mistake I made.

Thanks
Guenther

Code: [Select]
// Test NHD-1.8-128160EF-CSXN#-F display with RC5600WM processor
//
// Port A   - display DB0..DB7
// Port E.0 - !CS
// Port E.1 - !RST
// Port E.2 - D/C
// Port E.3 - !WR
// Port E.5 - !RD

#define TFT_18E_SET_NOT_CS   BitWrPortI(PEDR, &PEDRShadow, 1, 0)
#define TFT_18E_SET_CS       BitWrPortI(PEDR, &PEDRShadow, 0, 0)
#define TFT_18E_SET_NOT_RST  BitWrPortI(PEDR, &PEDRShadow, 1, 1)
#define TFT_18E_SET_RST      BitWrPortI(PEDR, &PEDRShadow, 0, 1)
#define TFT_18E_SET_D        BitWrPortI(PEDR, &PEDRShadow, 1, 2)
#define TFT_18E_SET_C        BitWrPortI(PEDR, &PEDRShadow, 0, 2)
#define TFT_18E_SET_NOT_WR   BitWrPortI(PEDR, &PEDRShadow, 1, 3)
#define TFT_18E_SET_WR       BitWrPortI(PEDR, &PEDRShadow, 0, 3)
#define TFT_18E_SET_NOT_RD   BitWrPortI(PEDR, &PEDRShadow, 1, 5)
#define TFT_18E_SET_RD       BitWrPortI(PEDR, &PEDRShadow, 0, 5)
#define TFT_18E_WRITE(data) WrPortI(PADR, &PADRShadow, data)
#define DELAY_10US(n) for (delay_10us = 0; delay_10us < 3*n; delay_10us++) {}

void TFT_18E_Initialize();
void TFT_18E_Write_Command(unsigned char command);
void TFT_18E_Write_Data(unsigned char data);

unsigned long delay_10us;

main()
{
   int i;
   unsigned long il;
   char data;

   // set port D bit 0 for high/low output for LED

   BitWrPortI(PDDCR, &PDDCRShadow, 0, 0);
   BitWrPortI(PDDDR, &PDDDRShadow, 1, 0);

   // set port A for high/low output

   WrPortI(SPCR, &SPCRShadow, 0x84);

   // set port E bits 0,1,2,3,5 for high/low output

   WrPortI(PEDDR, &PEDDRShadow, 0x2F);
   WrPortI(PEDCR, &PEDCRShadow, ~0x3F); // Keep output enabled for PE.4 which is
                                        // SMODE on the Interface Adapter

   // Hard reset TFT

   TFT_18E_SET_RST;
   DELAY_10US(15000);
   TFT_18E_SET_NOT_RST;
   DELAY_10US(15000);

   TFT_18E_Initialize();
   TFT_18E_SET_CS; // Chip select on for TFT
   TFT_18E_SET_NOT_RD; // TFT read off
   TFT_18E_SET_WR;

   // Fill screen with color

   TFT_18E_Write_Command(0x2A); // set column address 0 to 127
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x7F);
   TFT_18E_Write_Command(0x2B); // set page address 0 to 159
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x9F);
   TFT_18E_Write_Command(0x2C); // write memory start

   for (i = 0; i < 20480; i++)
   {
      // 18-bit pixel format

      TFT_18E_Write_Data(0x00);
      TFT_18E_Write_Data(0x00);
      TFT_18E_Write_Data(0xFF);
   }

   while (1)
   {
   }
}

void TFT_18E_Write_Command(unsigned char command)
{
   TFT_18E_SET_C;
   TFT_18E_WRITE(command);
   TFT_18E_SET_WR;
   DELAY_10US(15);
   TFT_18E_SET_NOT_WR;
}

void TFT_18E_Write_Data(unsigned char data)
{
   TFT_18E_SET_D;
   TFT_18E_WRITE(data);
   TFT_18E_SET_WR;
   TFT_18E_SET_NOT_WR;
}

void TFT_18E_Initialize()
{
   // Initialize TFT

   TFT_18E_Write_Command(0x11); // sleep out
   DELAY_10US(10000);
   TFT_18E_Write_Command(0x28); // display off
   TFT_18E_Write_Command(0x26);TFT_18E_Write_Data(0x04); // select gamma curve 4
   TFT_18E_Write_Command(0xF2);TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Command(0xB1);TFT_18E_Write_Data(0x0A);TFT_18E_Write_Data(0x14);
   TFT_18E_Write_Command(0xC0);TFT_18E_Write_Data(0x0A);TFT_18E_Write_Data(0x00);
   DELAY_10US(1000);
   TFT_18E_Write_Command(0xC1);TFT_18E_Write_Data(0x02);
   DELAY_10US(1000);
   TFT_18E_Write_Command(0xC5);TFT_18E_Write_Data(0x2F);TFT_18E_Write_Data(0x3E);
   TFT_18E_Write_Command(0xC7);TFT_18E_Write_Data(0x40);
   TFT_18E_Write_Command(0x2A); // set column address 0 to 127
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x7F);
   TFT_18E_Write_Command(0x2B); // set page address 0 to 159
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x00);
   TFT_18E_Write_Data(0x9F);
   TFT_18E_Write_Command(0x36);TFT_18E_Write_Data(0xC8); // set address mode
   TFT_18E_Write_Command(0x3A);TFT_18E_Write_Data(0x06); // set 18-bit pixel format
   TFT_18E_Write_Command(0x29); // set display on
   DELAY_10US(1000);
   TFT_18E_Write_Command(0x2C); // write memory start
}
« Last Edit: February 03, 2016, 01:28:52 PM by Guenther »

Guenther

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: NHD-1.8-128160EF-CSXN#-F Programming
« Reply #1 on: February 05, 2016, 04:42:52 PM »
I changed the voltage for Vdd and IOVdd to 2.8V. No difference. I read the datasheet for the  ILI9163 controller up-and-down to check for anything I may have missed. This datasheet looks like a poorly written document to me(!!!). Impossible for me to get all the technical information I need.

Questions:

- How to determine the setting for Power_Control1?
- Ditto for VCOM_Control1?
- Why can VCOML be negative?

Anyway, there's a chance this is a DOA.

/Guenther
« Last Edit: February 06, 2016, 03:06:05 PM by Guenther »

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 355
  • Karma: 10
    • View Profile
Re: NHD-1.8-128160EF-CSXN#-F Programming
« Reply #2 on: February 09, 2016, 09:54:50 AM »
Guenther,

I will look over your code for any mistakes.
All displays are tested before they leave our Facility, chances that it is DOA is fairly low.

You can provide 3.3V to both the VDDIO and VDD pins.

You can use the optimal settings for the VCOM and Power_Control found in our example code here: http://www.newhavendisplay.com/app_notes/Arduino_nhd-1_8-128160EF-CTXI.txt

Is it possible to also share your wiring diagram / Schematic for your connections?

Guenther

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: NHD-1.8-128160EF-CSXN#-F Programming
« Reply #3 on: February 12, 2016, 10:43:29 AM »
The second unit I got showed the same symptom. So I dug deeper into my code. I finally got to the bottom of it. It was the definition of my delay code for 'DELAY_10US'.

For values '3*n'>32767 the generated instructions created a huge number like FFFFxxxx. That kept my 'DELAY_10US(15000) looping for a looooong time. Changing the '3*n' to  '3L*n' created the expected result.

I think this a compiler bug - not promoting the calculation of '3*n' to be done in 'long'.

All is working now as expected.

/Guenther
« Last Edit: February 12, 2016, 10:50:57 AM by Guenther »

Paul_B

  • Administrator
  • Sr. Member
  • *****
  • Posts: 248
  • Karma: 16
    • View Profile
Re: NHD-1.8-128160EF-CSXN#-F Programming
« Reply #4 on: February 12, 2016, 12:21:46 PM »
Thanks for sharing your solution Guenther!

 

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

Started by JsaggioBoard TFTs

Replies: 0
Views: 1717
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: 2942
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: 2627
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: 2609
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: 1926
Last post July 07, 2015, 01:57:29 PM
by Michael_L