PIC32 Low-Cost Controllerless Graphics Interface to Newhaven Color LCD

Created by Kevin Culkins, last modified by Robert Nelson on Sep 08, 2017



The Microchip PIC32 has the bandwidth to drive QVGA (320x240) or WQVGA (up to 480x272) color LCD display touch panels that are controllerless - all LCD drive requirements are met by the PIC32. Example hardware and software has been developed by Microchip to demonstrate the PIC32s graphics capability. The PIC32 used in the starter kits have sufficient internal RAM (128Kbytes) to support graphics with 8 BPP (bit per pixel) color depth and with an external RAM device 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 PIC32.


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


The demonstration software shows the capabilities of the PIC32 driving 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 Microchip’s Graphics Library. The LCC (Low-Cost Controllerless) Daughterboard can support QVGA, WQVGA, and VGA (with the addition of larger external SRAM) resolutions and anything lower. 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

Various hardware combinations can be used to drive the LCD display. At minimum, a PIC32USB Starter Kit II or PIC32 Ethernet Starter Kit (note limitations below) is required, along with an LCC Graphics PICtail™ Daughter Board, a Newhaven display, and the custom interface board (figure 1, below). Optionally, for I/O accessibility, a PIC32 I/O Expansion Board can be connected to the Graphics PICtail™ Plus Daughter Board (figure 2, below).

PIC32 USB Starter Kit II, DM320003-2-ND, PIC32MX795F512L (capable of color depth 8 BPP (Bits Per Pixel) internal or 16 BPP external memory with example software).

PIC32 Ethernet Starter Kit, DM320004-ND, PIC32MX795F512L (capable of color depth 8 BPP internal memory with example software, the ethernet starter kit does not support 16 BPP - this is a starter kit limitation, not a device limitation ).

Low-Cost Controllerless (LCC) Graphics PICtail™ Plus Daughter Board, AC164144-ND.

Newhaven NHD-3.5-320240MF-ATXL#-T-1-ND, 320x240 resolution, 24-bit RGB, controllerless, w/touch.

NHD-3.5-320240MF-PICADAPTER-ND, (interface adapter board between Low-Cost Controllerless (LCC) Graphics PICtail™ Plus Daughter Board and the Newhaven display).

:white_check_mark:Now available at Digi-Key

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.

PIC32 I/O Expansion Board, DM320002-ND.


Fig. 1


Fig. 2


The PICtail Plus board provides a row of header pins with jumpers (schematic in AN1387). The jumpers are positioned to use internal memory (memory residing in the PIC32 device) or external memory residing on the PICtail Plus Daughter board, and the color depth 8 BPP or 16 BPP. The desired memory use and color depth in software and hardware must match. If there is a mismatch between the software selection and hardware selection images will not display properly.

To use internal memory and 8 BPP color depth all jumpers on the LCC Graphics PICtail Plus Daughterboard must be installed across rows 1 and 2 (Figure 3) and for external memory and 16 BPP install all jumpers across rows 2 and 3 (Figure 4). Associated code changes (reference Software Requirements, Source file and code changes) are noted next to the jumper settings in Figures 3 and 4.

Fig. 3


#include "Configs/HWP_LCC_PIC_SK_NHD_INT_QVGAv1.h"
// #include "Configs/HWP_LCC_PIC_SK_NHD_EXT_QVGAv1.h"


#define COLOR_DEPTH  8


Fig. 4


// #include "Configs/HWP_LCC_PIC_SK_NHD_INT_QVGAv1.h"
#include "Configs/HWP_LCC_PIC_SK_NHD_EXT_QVGAv1.h"


#define COLOR_DEPTH  16

Software Requirements

By default the Microchip PIC32 LCC - Object Layer Demo software drives the Powertip 4.3" WVGA display and by commenting/uncommenting select lines of source code the software will drive the Truly 3.2" QVGA display. Several new and revised source files are required to successfully drive the Newhaven 3.5" QVGA display. The software is meant to be used with the Microchip Graphics Library version 3.00.

Revised source files supporting Newhaven 3.5" display are: MainDemo.c, HardwareProfile.h, mchpGfxLCC.c, and Pictures C32.c

New source files supporting Newhaven 3.5" display are: HWP_LCC_PIC_SK_NHD_EXT_QVGAv1.h and HWP_LCC_PIC_SK_NHD_INT_QVGAv1.h

Complete project LCC - NHD Object Layer Demo_072211.zip (2.2 MB) includes all revised files (this is an MPLAB X project]. By default, the project files are set for 16 BPP color and hardware jumpers must be set for external memory.

Source file and code changes:


Select hardware header file appropriate for glass and internal or external memory - “…NHD_INT…h” for internal memory, “…NHD_EXT…h” for external memory. The code snippet below will include the header file that defines the use of the Newhaven display and external non-volatile memory.

// #include "Configs/HWP_LCC_PIC_SK_NHD_INT_QVGAv1.h"
   #include "Configs/HWP_LCC_PIC_SK_NHD_EXT_QVGAv1.h"


Define the use of external memory and the Newhaven LCD panel


Code common to both files, HWP_LCC_PIC_SK_NHD_EXT_QVGAv1.h and HWP_LCC_PIC_SK_NHD_INT_QVGAv1.h. Define parameters are described in the source file.

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    10
   #define DISP_VER_FRONT_PORCH    1
   #define GFX_LCD_TYPE         GFX_LCD_TFT
#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 touchscreen characteristics.

#elif defined (GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)
   #if (DISP_ORIENTATION == 0)

MainDemo.c (Logo image available 8BPP or 16 BPP comment/uncomment at build time.

Splash screen image, 8 BPP or 16 BPP.

// internal flash image
extern const IMAGE_FLASH   sunset_all4_w320h240_8bit;
extern const IMAGE_FLASH   sunset_all4_w320h240_16bit;

Select splash screen image to render.

// Original Microchip image, not used in the Newhaven display demo
//    WAIT_UNTIL_FINISH(PutImage(0, 0, (void *) &mchpLogo, IMAGE_NORMAL));
//    WAIT_UNTIL_FINISH(PutImage(SS_ORIGIN_X, SS_ORIGIN_Y, (void *) &intro, IMAGE_X2));
    // Display of 8-bit color depth image is ok in both 8-bit internal memory or 16-bit external memory
    // mode.  Display of 16-bit color depth image is very good in 16-bit external memory mode, very poor in 8-bit mode.
    // NHD - sunset_all4_w320h240_8bit image is 8-bit color depth
    // WAIT_UNTIL_FINISH(PutImage(SS_ORIGIN_X-2, SS_ORIGIN_Y-50, (void *) &sunset_all4_w320h240_8bit, IMAGE_NORMAL));
    // NHD - sunset_all4_w320h240_16bit image is 16-bit color depth
    WAIT_UNTIL_FINISH(PutImage(SS_ORIGIN_X-2, SS_ORIGIN_Y-50, (void *) &sunset_all4_w320h240_16bit, IMAGE_NORMAL));

This variant of the Microchip embedded software doesn’t use the Microchip splash screen image or screen color.

// Original Microchip image, not used in the Newhaven display demo
//            WAIT_UNTIL_FINISH(PutImage(counter, GetMaxY() - 34, (void *) &mchpIcon0, IMAGE_NORMAL));
// Not used in the Newhaven display demo
//    SetColor(BRIGHTRED);
//    SetFont((void *)ptrLargeAsianFont);
// Original Microchip image, not used in the Newhaven display demo
//    MoveTo((GetMaxX() - GetTextWidth((XCHAR *)eTouchScreenStr, (void *)ptrLargeAsianFont)) >> 1, SS_ORIGIN_Y + 120);
//    while(!OutText((XCHAR *)eTouchScreenStr));
//    MoveTo((GetMaxX() - GetTextWidth((XCHAR *)cTouchScreenStr, (void *)ptrLargeAsianFont)) >> 1, SS_ORIGIN_Y + 122 + GetTextHeight((void *)ptrLargeAsianFont));
//    while(!OutText((XCHAR *)cTouchScreenStr));


Revised backlight control for Newhaven LCD.

   // NHD NEWHAVEN Revision, Backlight boost converter PWM input.
   #if defined(GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)
      BACKLIGHT =1; //Turn Backlight on

Support for PutPixel and Line position.

   // NHD proper PutPixel and Line positioning,
   #if defined(GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)
      GraphicsFrame[y][x] = _color;

Support for the Bar function

for(y = top; y <= bottom; y++)
   for(x = left; x <= right; x++)
   // NHD, this fixes ClearDevice(), which uses the Bar function.
   #if defined(GFX_USE_DISPLAY_PANEL_TFT_NHD_320240MF_ATXL_T_1)
      GraphicsFrame[y]\[x] = _color;

Pictures C32.c

Bit map file now includes the new 8 bit and 16 bit splash screen.

 * Bitmap Structure
 * Label: sunset_all4_w320h240_8bit
 * Description:  no description
extern const char __sunset_all4_w320h240_8bit[];
const IMAGE_FLASH sunset_all4_w320h240_8bit =
     (FLASH_BYTE *)__sunset_all4_w320h240_8bit
const char __sunset_all4_w320h240_8bit[] =
 * Bitmap Structure
 * Label: sunset_all4_w320h240_16bit
 * Description:  320x240 pixels, 16-bits per pixel
extern const char __sunset_all4_w320h240_16bit[];
const IMAGE_FLASH sunset_all4_w320h240_16bit =
    (FLASH_BYTE *)__sunset_all4_w320h240_16bit};
const char __sunset_all4_w320h240_16bit[] =

Newhaven_files Folder

For reference, the file folders “…\LCC - NHD Object Layer Demo_072211\Newhaven_files\8_BPP” and “…\LCC - NHD Object Layer Demo_072211\Newhaven_files\16_BPP” is provided with modified source files for 8 BPP or 16 BPP color. Code is uncommented/commented as needed to support 8 or 16BPP color depth.

Project Build and Load

It is left to the reader to install and familiarize themselves with MPLAB X IDE, the XC32 compiler, and hardware connections from/to the PIC32 starter kit of choice.

Expand/copy zip file LCC - NHD Object Layer Demo_072211.zip (2.2 MB) to desired system location. Open MPLAB X IDE, connect the hardware to your computer, and open project “GOLDemo PIC32 NHD”. Open the project properties to verify hardware and software tool selection matches your installation. Make and Program device.

:white_check_mark:Hex files are available in folder “…\LCC - NHD Object Layer Demo_072211\hex_folder” for 8 BPP and 16 BPP color.

Supporting Files


LCC - NHD Object Layer Demo_072211.zip (see above link)


DKSB1014B.pdf (30.3 KB)


DKSB1014B_BOM.xls (29.5 KB)

Gerber Files

DKSB1014B_gerber_drill.zip (36.4 KB)

OrCAD 16.3 Capture and PCB Editor Project Files

DKSB1014B_project_files.zip (244.4 KB)

Application Notes

AN1387 “Using PIC32 MCU’s to Develop Low-Cost Controllerless (LCC) Graphics Solutions”.

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.


Any questions or comments please go to Digi-Key’s TechForum