Child pages
  • Interface PIC24 to Newhaven QVGA Color LCD Touch Display
Skip to end of metadata
Go to start of metadata

This page is about interfacing a Newhaven Display International QVGA 3.5" color LCD display touch panel to a Microchip Technology PIC24 with integrated graphics controller.


The Microchip PIC24 is a 16-bit microcontroller that integrates a high-performance graphics controller capable of driving QVGA (320x240) or WQVGA (up to 480x272) color LCD display touch panels that are controllerless, USB OTG modules, as well as a broad range of peripherals.  Example hardware and software has been developed by Microchip to demonstrate the PIC24s graphics capability.  The PIC24 used in the PIC24FJ256DA210 Development Board have sufficient internal RAM (96Kbytes) to support graphics with 8 BPP (bit per pixel) color depth and with an external RAM device up to 16 BPP is possible. With relatively minor source code revisions and a custom interface board, this project leverages the Microchip developed hardware and software to interface a Newhaven Display International 3.5" QVGA color LCD display touch panel to a PIC24.


Newhaven Display International offers a readily available 3.5" color LCD with touch screen, sans controller.  A combination of a Microchip demonstration board, the Newhaven LCD, and a custom interface board constitute a complete display demonstration project.


The demonstration software shows the capabilities of the PIC24 driving (16 BPP color depth) a Newhaven Display International controllerless LCD graphics board.  The start up splash screen is a bitmap image.  The subsequent screens demonstrate the widgets of the Microchip Graphics Library to show various application screens that can be easily made with the library.  Also, Microchip makes available a visual design tool to create your own graphical user interface screens for Microchip microcontrollers, the Graphics Display Designer (GDD).

Hardware Requirements

A PIC24FJ256DA210 Development Board, ICD3 (or REAL ICE or PICkit3), Newhaven display and custom interface board (figure 1, below) is required.

PIC24FJ256DA210 Development Board, DM240312.

MPLAB® ICD3 In-Circuit Debugger, or REAL ICE, or PICkit 3

DKSB1014B-ND is now available from Digi-Key, uniting display NHD-3.5-320240MF-ATXL#-T-1-ND with interface adapter board NHD-3.5-320240MF-PICADAPTER-ND


Fig. 1


The PIC24FJ256DA210 Development Board provides numerous jumpers for various board configurations.  For this demonstration, the jumpers are positioned per Table 1.  Additional information is available in the   PIC24FJ256DA210 Development Board User’s Guide.

JumperFunctionJumper Setting
JP5Enables USB OTGRemove jumper
JP6Enables USB Embedded Host modeInstall jumper
JP7Enables USB Device modeRemove jumper
JP8Sets Byte Enable mode for on-board parallel memoryRemove jumper

Configures RA1 and RC4 for resistive touch screen or SPI-based touch controller

Jumper 1 - 2

Configures RA1 and RC4 for resistive touch screen or SPI-based touch controller

Jumper 1 - 2
JP11Selects RA7 for LED D4 or PMA17Jumper 1 - 2
JP12Configures RD0 for LCD backlight control or serial RXJumper 1 - 2
JP13Configures RG8 as S1 input or CTMU1 input/LED outputJumper RG8 - S1
JP14Configures RE9 as S2 input or CTMU2 input/LED outputJumper RE9 - S2
JP15Configures RB5 as S3 input, R3 input, or CTMU3 input/LED outputJumper RB5 - S3
JP16Selects serial TX channel connectionJumper USART_TX - TX
JP17Selects serial RX channel connectionJumper USART_RX – RX
JP23Selects serial (default) or parallel Flash memoryJumper 2 - 3

Table 1.  Jumper Settings and Configuration Options

Software Requirements

The Microchip Libraries for Applications (MLA) includes a broad range of software libraries.  Projects are provided that support many Microchip development and evaluation boards.  The demonstration software referenced in this eewiki article leverages the “Multi-App” project files to drive the display and also support the USB Mass Storage Device class, allowing the viewing of stored graphic files from a Flash stick.   Only one new and one revised file are required to successfully drive the Newhaven 3.5” QVGA display.

New source file supporting Newhaven 3.5" display is:  HWP_DA210_BRD_16PMP_USBMSD_NHD_QVGAv1.h

Revised source file supporting Newhaven 3.5" display is:  HardwareProfile.h

Complete project “Multi-App_NHD_QVGA" includes a single project configuration and relevant source files that were provided in the original “Multi-App” folder (note: this is an MPLAB X project).  The multiple project configurations and configuration files not necessary in this build have been removed to reduce the zip file size.  Of course, these omitted files are available in the “Multi-App” folder that is included in the MLA download.

Source file and code changes:


Several lines of code are added to the HardwareProfile.h file to support the Newhaven display.  The code snippet below will include the header file that defines the use of the Newhaven display.

 * Hardware Configuration for
 * DA210 Developement board
 * 16-bit PMP
 * QVGA, Newhaven 3.5" display
    #include "Configs/HWP_DA210_BRD_16PMP_USBMSD_NHD_QVGAv1.h"
//#elif defined(CFG_INCLUDE_DA210_BRD_16PMP_USBMSD_WQVGAv1)


Define the use of Newhaven LCD panel


Define the LCD glass characteristics.

   #define DISP_ORIENTATION        0
   #define DISP_HOR_RESOLUTION   320
   #define DISP_VER_RESOLUTION   240
   #define DISP_DATA_WIDTH        24
   #define DISP_INV_LSHIFT
   #define DISP_HOR_PULSE_WIDTH   30
   #define DISP_HOR_BACK_PORCH    40
   #define DISP_HOR_FRONT_PORCH   20
   #define DISP_VER_PULSE_WIDTH    4
   #define DISP_VER_BACK_PORCH     9
   #define DISP_VER_FRONT_PORCH    1
   #define GFX_LCD_TYPE         GFX_LCD_TFT

          #define GFX_HSYNC_ENABLE
          #define GFX_VSYNC_ENABLE
          // #define GFX_DISPLAYPOWER_ENABLE
          #define GFX_CLOCK_POLARITY                  GFX_ACTIVE_HIGH
          #define GFX_HSYNC_POLARITY                  GFX_ACTIVE_LOW
          #define GFX_VSYNC_POLARITY                  GFX_ACTIVE_LOW
#endif // #if defined (GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)

Define the backlight control logic.

#elif defined (GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)

Define the backlight control port poins.

#elif defined (PIC24FJ256DA210_DEV_BOARD)
    // Definitions for POWER ON pin
        // Revised to support NHD display
        #if defined(GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)
           #define DisplayPowerConfig()            TRISDbits.TRISD0 = 0
           #define DisplayPowerOn()                LATDbits.LATD0 = 1
           #define DisplayPowerOff()               LATDbits.LATD0 = 0

Project Build and Load

It is left to the reader to install and familiarize themselves with MPLAB X IDE, the XC16 compiler, and hardware connections from/to the PIC24 development kit. 

The project requires supporting files that are included in the “Microchip Libraries for Applications v2013-06-15” (MLA). 

Microchip does revise and release updated versions of the MLA.  If the aforementioned MLA is no longer found check the MLA archive, or follow this link to the archive.

Download and install the MLA files.  After download and installation of the MLA files download the project zip file  Expand the zip file and copy the folder “Multi-App_NHD_QVGA” to the “Microchip_solutions_v2013-06-15\Graphics” folder.

Open MPLAB X IDE, connect the hardware to your computer, select “Open Project”.  Assuming that the MLA is installed in its default location, navigate to folder “Microchip_solutions_v2013-06-15\Graphics\Multi-App_NHD_QVGA” and select project “MPLAB.X”.  Open the project properties to verify hardware and software tool selection matches your installation.  Make and Program device.

Hex file is available in folder "..\Multi-App_NHD_QVGA\Precompiled Hex”, title “Graphics – Multi-App PIC24_DA210_DEV_16PMP_QVGAv1_USBMSD_NHD.hex.

Supporting Files






Gerber Files

OrCAD 16.3 Capture and PCB Editor Project Files

Application Notes

PIC24FJ256DA210 Development Board User’s Guide. The document provides an introduction to the development board, development board hardware description, and schematics.

AN1368  "Developing Embedded Graphics Applications using PIC(r) Microcontrollers with Integrated Graphics Controller".  This application note delves into using PIC devices with an integrated graphics controller, but it also provides background information on basic color science, display terminology, display power sequencing, and resistive touch screens.

Authors Note:

This webpage is a project started and maintained by the applications engineering staff at Digi-Key.  It is one way we provide complementary support to engineers, hobbyists, entrepreneurs, and other tech minded folks to assist you with your work. In many ways adding content to this website is the best part of our job, but it isn't our only job. We want to continue to develop and expand the eewiki, and you can help us justify our efforts by letting us know if you have used any of our content to help you use or select Digi-Key products.  Additionally, we welcome comments, feedback, suggestions, and questions.  Just send an email to  To address any questions or comments to a specific author, mention the author in the subject line.

Also, if the product you are designing meets certain criteria, we may be able to send you engineering samples.




  • No labels