Facebook Pixel

AN-00138 Picadillo MPLABX Initializing the Screen

Description This application note shows how to program the Picadillo-35T in the MPLABX IDE using the XC32++ compiler and the PICkit 3 programmer. The application demonstrates the system configuration initialization of the Picadillo-35T.
Supported Processor Others...
Supported Environment Others...
Difficulty Easy

File Downloads


The coverage of this application note demonstrates the system configuration initialization of the Picadillo-35T.


Before getting started, the following are required:

When downloading an application note, a list of recommended application notes is shown. It is assumed that the user has read or has a working knowledge of the topics presented in these recommended application notes.

  Application Overview

The Picadillo-35T is a PIC32MX795F512L based 3.5” display module with Resistive Touch. In this application note, the initial system configuration will be presented but only limited to initializing the display related peripheral and the display screen. At the end of this application note the Picadillo-35T will have an initialized screen display with a background of colour BLUE.


Setup Procedure

For instructions on how to install the related software development tools, compiler and device drivers  please proceed to WWW.MICROCHIP.COM or click the link below for a more detailed information.

MPLAB X Reference Materials


Open the Project in MPLABX

Download the project zip file of this application note Picadillo MPLABX Initializing the Screen.  After completing the download extract the files to the preferred location.

Afterwards, the IDE will prompt the user to locate the files to be opened.

Select the target project file named – PROJECT1.X. Also, open the project library file – pic35DT. Further details about the project files will be presented in the succeeding parts of this application note.

The library project – pic35DT

Description of content

The Header file -  pic35DT.h

The header file in this library project is uses the C++ programming language. This necessitates the use of the XC32++ for pic32 microcontrollers.  This header files has all the prototype functions needed to initialize the Picadillo-35T screen display.  It also contains several other commands that will simplify drawing of primitive shapes that are to be displayed on the TFT screen.


This header file also includes another header file that contains the RGB-565 colours that are precisely toned to bring about the colour vividly. Looking inside the library project the user will find the colourPalette.h file. In here the list of colour definitions.


The Source file – pic35DT.cpp

The command prototypes listed in the header files have all their declaration inside this file. This is important and must always be together with the header files mentioned above.

This file contains the most important function for this project, the init_lcd(). This function initially setup the PMP port of the PIC32MX795F512L and also the GPIO that controls the BACKLIGHT. For this library project, no PWM is applied to the backlight GPIO to simplify the process of learning.


How the pic35T library was added to PROJECT1

This section explains how the project was added to the primary project file – PROJECT1.X. On the MPLABX projects window, right click on the folder PROJECT1. A pop-up window will appear and then select the PROPERTIES.

Selecting the PROJECT PROPERTIES option on the pop-up menu will open another window. This window contains settings that can be categorized into two parts- the main configuration setup and the General setup options.

Under the libraries options, the project was added through the ‘ADD LIBRARY PROJECT…’ option. The folder was then located and added.



The application project - PROJECT1.X

This application starts with the setup of device configuration. The device configuration can be varied according to the line of application intended for the display. The device configuration is shown below.


#pragma config FSRSSEL = PRIORITY_7    

#pragma config FMIIEN = OFF            

#pragma config FETHIO = OFF            

#pragma config FCANIO = OFF            

#pragma config FUSBIDIO = OFF          

#pragma config FVBUSONIO = OFF         


#pragma config FPLLIDIV = DIV_3

#pragma config FPLLMUL = MUL_20

#pragma config UPLLIDIV = DIV_4       

#pragma config UPLLEN = OFF           

#pragma config FPLLODIV = DIV_1      


#pragma config FNOSC = PRIPLL

#pragma config FSOSCEN = OFF

#pragma config IESO = OFF

#pragma config POSCMOD = XT  

#pragma config OSCIOFNC = OFF

#pragma config FPBDIV = DIV_8

#pragma config FCKSM = CSECMD

#pragma config WDTPS = PS1048576

#pragma config FWDTEN = OFF   



#pragma config DEBUG = OFF             

#pragma config ICESEL = ICS_PGx2       

#pragma config PWP = OFF               

#pragma config BWP = OFF               

#pragma config CP = OFF

Following the device configuration, pre-processors were added to the application. Among these is the pid35DT.h file


** For this section the user will have to relocate the directory location of the file. NOT DOING SO WILL CAUSE ERROR DURING BUILDING/COMPILING.

The main body of PROJECT1, is composed of simple commands that are enlisted in the pic35DT library project. The init_lcd() function contains the setup for the TFT initialization commands. These commands in the form of HEX values are passed to the screen over at the PMP of the device controller more information on this peripheral please refer the PIC32MX Family reference manual.


If desired the user can uncomment the function in the while() loop to see the resulting display on the screen.


Programming the Picadillo-35T

Setting up the PICkit3 ICD

After successfully re-building the project, the project is now ready to be downloaded to the display module using a PICkit3 In-Circuit Debugger. First, we need to make sure that our PICkit3 is setup properly. The PICkit power should be enabled to power the target circuit. This can be done by following the steps below.


Having done the aforementioned we can now proceed to connecting the PICkit3 to the Picadillo-35DT

Connecting the PICkit3 ICD and Picadillo-35DT

Follow the image below as a reference for the connection between the two devices.


After all the setup and connections are made, the last thing to do is to download the project.


Click the icon in the red box to start the program download. MPLAB will first make sure that everything in the code is correct by doing a compile process and then proceeds to downloading.


If the image above is shown in the MPLABX IDE then this means that everything finished without any problems.