Inexpensive Graphic Interface




This page is still under construction, but I am updating it regularly. SWR 5inch with 800x480 TFT Display Here I will gradually consolidate information related to programming TFT graphic interface with touchscreen function. The project based on free Graphic Libraries developed by Microchip. The libraries are updated on regular basis which brings some new functionality, but also creates some issues related to compatibility with previous releases. I have also realized that it would be a good idea to document most critical stages of the project since details and findings witch seemed to be quite clear in the past, have a tendency to fade away and when creating new project you may spend a lot of time re-inventing the wheel.


The device you see on the picture is my latest project. This Hand-held Vector Network Analyzer I built based on UBW32 USB Bit Whacker and five inch TFT Display with SSD1963 controller with Touchscreen pad, see pictures below. The displays are easily available on e-Bay for $40-50. I use ICD3 programmer/debugger from Microchip and my first project based on Mikroe Multimedia board. The board had integrated controller PIC32 MX460F512L and a lot of features including M25P80 8MBit flash memory chip. Other features, like MP3 Codec chip I do not use. The main disadvantage is relatively small (3″) display and its price which, including shipping from Europe to Canada, amounting $130.TFT rear Microchip development tools work well with their Graphic Libraries, but to obtain decent image quality a graphic controller required. I did not manage to achieve acceptable image quality with Low Cost Controllerless board (LCC) which is actually not too cheap – $90. Beside of that, Microchip does not produce graphic boards with integrated micro controller. It has to be combined with separate board such as a Starter Kit or Explorer or similar. In any case, the project will cost you around $300. I also considered the fact that displays and graphic controllers used in Microchip Development Tools are NOT easily available. Though, the software is virtually free if you use evaluation version of C compiler. That is why I decided to stick to PIC controllers. TechToys offer TFT displays and boards with SSD1963 display controller. I tested EVK for Solomon SSD1963 Ultima R4.1 and EVK for Solomon SSD1963 Display Controller R4A They work quite well, but a cost of Ultima board with 5″ display is $129 plus a Start kit with controller required. The total would be $180. R4A board and 5″ display cost $79 + plus controller ~$40. And it would be not too easy to fit the bundle into box since display flat cable well offset from the centre.Five inch with TT Eval Board and UBW32 Since I plan to produce small series of instruments with graphic interfaces, I decided to research for inexpensive off the shelf solutions. Currently I use a hardware which consists of 4.3″, 5″ and 7″ TFT displays with SSD1963 controller which are cheap and easily available. Five inch display cost on eBay $40-50, seven inch – $50-70. They all mounted on a board with 40 pin connector, touchscreen and display controllers. I tried all available sizes from 4.3″ to 7″ and found them fit my needs. Currently I work with 5″ display iwth 480 x 800 resolution.


A driver for SSD1963 controller not included in Microchip Libraries for Applications (MLA) but it is available on TechToys site. I use Object Layer project for Ultima board: GOLDemo PIC32MX795F512L SSD1963 Ultima R4. In HardwareProfile I also uncommented #define EXPLORER_16, #define ULTIMA_R4_BOARD and #define USE_TY500TFT800480. The display boards are equipped with XPT2046 touchscreen controller chip which is neither supported by TechToys nor by Microchip. So I had to write my own routines to handle the controller. The routines are added to Main file instead of TouchScreen and TouchScreenResistive, which were removed from the project. Actually, at the beginning I attempted to modify the touchscreen driver files in order to adapt them to XPT2046, but I found the code is so complicated and unfriendly (may be to me only), so finally I gave it up and wrote my own. After adding 40ms delay after EVENT MOVE line in TouchGetMsg(), the touchscreen works very smoothly. The display board provides a landing print for Flash memory chip. I solder M25P80 there since I already have driver files for the chip. I use bit-bang technique to control the memory chip, therefore it is quite important not to overclock it. To slow down the bus following line was added to Main: mOSCSetPBDIV(OSC_PB_DIV_2); Currently the hardware with 5″ touchscreen display cost me $80 ($40 – display and $40 the UBW32 board).

Note that the display coming without Serial Flash memory chip (U1 on the top left, next to SD bay). Eight Mb M25P80 was installed there to store touchscreen and VNA calibration data as well as frequency ranges. Recently I developed and manufactured an adapter board allowing connecting a flat cable between display and a UBW32, see pictures below.

Project files and adapter boards are available upon request.

Connections between the Display and UBW32 shown on this file.

Assembly with Display 2 (Large) Assembly (Large)Adapter Bottom (Large)

This graphic interface is used in my N2PK Hand-Held VNA.

A touchscreen driver code snippet is HERE.

Here is a link to the fully functional project . This is just an example of 7 inch display application.  You need to adjust project “Include Search Pass” according to actual pass of your project.

Do not try to use it directly as an interface to N2PK VNA since some VNA control files are not included.

My next project is to develop a USB communications between the VNA and the interface.

Evgeny Lavrentiev, VE3SSR

Free Counter Free Counter


29 Responses to Inexpensive Graphic Interface

  1. Guillermo Russo says:

    Hello, it would be so kind as to share with me the code on the screen with the CI XPT2046 touch screen.

  2. Evgeny says:

    Hello Guillermo,
    I will post the project shortly.
    Just need to extract relevant files from MLA library.

  3. Forgofe says:

    Hello, Can I kindly ask you to share with me your XPT2046 drivers, becouse I use the same LCD modul with PIC32MX795F512L, and I cant made it works. Thank you.

  4. Igor says:

    Hello, can you post me yours Project with XPT2046 for 7? TFT display with SSD1963 ?

  5. Pippo from Italy says:

    First: Sorry for my bad english…

    Ok, my Objective Layer Project work fine, this after making the changes on HradwareProfile.h.
    I also had to change (based on SSD1963 DataSheet, Command Section) some lines in SSD1963.c driver because my 7″ chinese display work “conversely”, or like on the mirror.

    My canges at the bottom of the file:

    // Further adjust for avoid reverse mirroring…
    CS_LAT_BIT = 0;
    CS_LAT_BIT = 1;

    Some question:

    1) I would make a completly clear Main file (or Project) for use the Graphic Dysplay Designer, embedded on MPLAB 8.93, and start “virgin raw” project, however, with all files for working with SSD1963. What do i take away from the Object Layer Project.

    2) How Do i for integrate your TouchScreen xpt2046 file, on my project? (Please explanation step by step)

    3) Is the mandatory use of memory chip on the Display Board?

    4) I understand that hardware configuration for Explorer16 make the connection to the Display controller on 8bit mode (half PMP). Can i change something for use 16 bit mode (whole PMP)?


    Pippo from Italy

  6. Evgeny says:

    Hello Pippo, below is my attempt to answer your questions:

    1) To start with, do not take away anything from the Object layer. Just adapt its frames and widgets to your needs. After that remove frames which are not used. Do not trust too much to Display Designer. This tool may help you to allocate widgets on the working area of the display, but the code it generates may need to be adjusted and you may experience difficulties integrating it into your project.

    2) Above I placed a link to my project. Unzip and run it and see how the driver and touchscreen calibration are integrated. To calibrate the touchscreen touch it during power up.

    3) The memory chip is needed to store Touchscreen calibration constants. Without it you’ll have to do touchscreen calibration every time you power it on. I also use it to store VNA calibration.

    4) It is actually whole 16 bit PMP, follow a link to display connections

  7. Pippo from Italy says:

    Hi, i tried to use you complete 7 inc. example Project, but I have many compilation errors.

    This for missing dependencies and – i think – for wrong MLA version.

    1) What dependencies for include files you use? (Build options –> Directories and search Paths)
    2) What MLA Library version you used?


  8. Evgeny says:

    Hello Pippo,
    You right, there were some dependencies in the include search pass. I put the files into the project. Please re-download zip file from the site and adjust the “include search pass” according to your actual project pass.


  9. Diego says:

    First of all I have to say thank you for share your project, it´s amazing.
    I was looking the code because i´m doing a similar project (PIC32MX795F512L+7″ SSD1963+XPT2046) but i don´t know where i have to connect the pin TP_IRQ from the XTP2046 to the PIC32.
    Thank you in advance.

  10. Diego says:

    Ok, I asked it because i don´t understand how is possible that the pic detects that the touchs creen was touched if the TP_IRQ pin is not connected. For this reason i was searching inside the code some function that returns the TP_IRQ value when the touch screen is touched. i would be grateful if you could explain how you achieve this.
    Thanks a lot.

    • Evgeny says:

      Diego, look at TouchGetMsg() function in Main.
      PIC running in loops waiting for x or y value become not equal to -1.
      -1 means no touch. If the value is different to -1 it means that the touchscreen has been touched.

  11. Diego says:

    oh, thank you very much, i didn´t have realized of it. Now i´m changing the code to adapt it to my project. these days i´m going to do some tests and then i tell to you about the progress of the project.

  12. Silvio ik1bqd says:

    Beautifull job congrats !

  13. KansaiRobot says:

    Hello. Very nice site.
    I am just starting to do something similar but still in the very early stages. I would appreciate if you can help me with some questions:
    A)I understand that to control a display like this you need two controllers:
    1) A LCD controller to display your GUI (in your case SSD1963)
    2) A Touch panel controller, (in your case XPT2046)

    Am I understanding things correctly??

    B)I have already understood the mechanisms of controlling a 4-wire touch panel. I read you don’t necessarily need a controller, since it is quite simple to manipulate the 4 wires. Is it recommended?

    C) For the LCD displaying of your GUI, I suppose you do necessarily need the controller, is that correct?

    D) Also I am having great trouble in getting one suitable LCD model. I was thinking of the 4.3 inch resistive A of this link×272-Touch-LCD-A.htm
    but reading it, nowhere I can see which LCD controller they use. Any comment on this?

    I am sorry for the super beginner questions, but I would be very grateful if you can share some knowledge with me

    Thanks in advance

  14. KansaiRobot says:

    Hello again.
    I am using a LCD with the same controller as yours XPT2046 but with a PIC18
    I understand that you need SPI for this but looking at your code, I cant find where you set up the clock rate of SPI.
    Right now my LCD is not responding to touch and I suspect is a matter of clock…
    I will appreciate your insights thanks

  15. Darrin L. Johnson KD4VGA says:

    please tell me how much for kit or for ready built minus N2PK dual det board.

  16. PIDOU says:


    I have the same display that you and I have a hard time using it,
    what software do you create the screens ?
    Have you an example of code to display a screen ?
    Best regards,
    Sébastien (France)

  17. PIDOU says:

    I fail to compile the project, there are mistakes, you have an update ?

  18. SEBASTIEN says:

    I have the same 800×480 display for use with a pic32mx460f512l for the soft, while compiling there are errors, you have an update and explanation of the program because it is very complicated
    Best regards

  19. afolabi says:

    please is this site useful for beginner at all

Leave a Reply

Your email address will not be published. Required fields are marked *