PIC24F256DA210 with GOL based graphics and EDS space extensions

This demo shows an example Microchip™ GOL based graphics application for the PIC24FJ256DA210 running the FreeRTOS™ operating system.


It is designed to run on the PIC24FJ256DA210 Development Board with a Truly 320x240 LCD display.


The port of FreeRTOS has been checked for various conditions although it has yet to undergo exhaustive testing. In particular access to the EDS space has been implemented and tested with multiple large data arrays accessed across multiple threads. This has confirmed correct operation but the user should also carry out due diligence when using this port in their own application. The user’s attention is drawn to the standard disclaimers and caveats that accompany both the Microchip and FreeRTOS software.



The application creates four tasks with the following functions:



The main graphics task is primarily responsible for all interaction with the screen. At startup it performs initialization of the GOL library and also the SPI flash device used to store screen calibration data.


Once operating the GOL task enters a loop where it draws the screen and then waits for an incoming message before performing any further action. These messages could be a direct request to redraw, a touch screen message (press/release or movement) or a message requesting a string to be displayed. All of these messages are sent using the same common structure.


When the user presses on one of the two buttons on the display a binary semaphore is used to signal one of two specific instantiations of taskONE.



This task is responsible for starting up the touch screen and implementing a simple conversion scheme based upon that used in the MASTERs 1429 CAR class. It is a slightly older scheme than that used in the current MLA but is perfectly functional. Once created the task sets up a timer interrupt to perform the actual sampling of the resistive touch screen.


The sampling interrupt directly drives the ADC and alternately samples the X and Y axis at 1ms intervals. When a significant PRESS/RELEASE or MOVE is detected by the ISR routine it formats a message and sends it to the graphics task using the queue hQVGAQueue.


The screen also has a calibration function. Whilst a simple addition, there is currently no facility to recalibrate the screen so this should be done carefully (a simple code change to the graphics version number is all that is required to make it calibrate again).


taskOne (instantiated twice)


This simple task blocks on a binary semaphore (released by the graphics task). Once released the

task perform a simple calculation loop and then creates a formatted string containing the task ID and the number of times it has been called. This string is then sent back on the queue to the graphics

task for display at the bottom of the screen.


Two copies of this task are created by main.c. Each has a different priority so demonstrating different effects. The lower priority task will not stop the screen being redrawn as it is working. However the higher priority version will only redraw once it has finished.


The application is based upon the latest (at the time of writing) released version of the Microchip application libraries (MLA) and FreeRTOS. To keep the design simple the standard HardwareProfile.h has been carefully edited to remove many of the unused sections that apply to other hardware types. For custom hardware careful re‐addition of elements may be required.


PIC24FDA210 FreeRTOS Demo.zip


Please sign in to leave a comment.