Getting Started: Running the “Elevator Demo”

 

Required Hardware

Configuring the Software. 1

Configuring the Hardware

Calibrating the Touch Screen

Setting up the External Memory Programming Mode

Demo Compatibility Matrix

 

Running the Demo:

 

PIC24FJ256DA210’s built in graphics controller features accelerated rendering modules: Rectangle Copy Graphics Processing Unit (RCCGPU), Inflate Processing Unit (IPU) and Character Processing Unit (CHRGPU). The use of these features can accelerate rendering where the CPU’s job is to start the operation and let the hardware do the rendering. This results in minimal CPU time to do rendering and CPU can tasked to perform other application operations.

 

In this demo, the RCCGPU and CHRGRPU are utilized. The demo is a simple mockup of an elevator monitor showing the floor location of the elevator car and in which direction the car is going. The demo shows how the RCCGPU can be used to render images into the display buffer as well as how CHRGPU can be used to render text.

 

There are two modes in this demo.

1.     Parallel Flash Mode – the WQVGA display is used in its native orientation. The images and the fonts used to display the floor numbers are stored in the parallel flash. The RCCGPU is used to display the images stored in the parallel flash. The CHRGPU is also enabled to transfer the large fonts stored in the parallel flash to the display buffer. The use of these two graphics processing units frees up the CPU to perform other tasks in the application.

2.     SPI Flash Mode – the WQVGA display is used in 90 degree orientation. The images and fonts are stored in the SPI Flash. The CHRGPU in this case is not used. The OutChar() function (that renders characters to the display buffer) is PutPixel() based. This example shows how to implement the same application with the resources stored in the SPI flash. Rendering performance in this mode is slower.

 

Each mode can be manually built by setting the  DISP_ORIENTATION macro in the hardware profile.

DISP_ORIENTATION = 90 – runs the SPI Flash Mode.

DISP_ORIENTATION = 0 – runs the Parallel Flash Mode.

 

The demo works with the use of the S1, S2 and S3 switches.

·         S1 – animate elevator down

·         S2 – used to manually enable the flash programming (checked only at power up) and also displays messages on the screen (for example: “Opening”).

·         S3 – animate elevator up

 

Refer to the Demo Hardware Setup for details.

 

The demo can also be configured to run using Chinese fonts or English fonts. To select between the two modes set the macro in ElevatorDemo.h.

#define LANGUAGEUSED                    ENGLISH           // to use English fonts

#define LANGUAGEUSED                    CHINESE           // to use Chinese fonts

 

The “Resources” folder also contains the xml project used to generate the images stored in the internal flash and external memory. Open the following files in "Graphics Resource Converter" utility to see which files are loaded from internal flash or external memory.

·         InternalResourceElevator.xml – resources loaded to internal flash memory.

·         ExternalResourceElevator_ParallelFlash480x272.xml – resources to be programmed into the parallel flash memory

·         ExternalResourceElevator_SPIFlash272x480.xml – resources to be programmed into the SPI flash memory

 

Refer to the Flash Programming Instructions for instructions on the flash programming.

 

Configuring the Software

The demo can be run using the WQVGA display with the PIC24FJ256DA210 Development Board (DM240312). The external memory used is selectable (SPI Flash or Parallel Flash). To select which external memory to use set the appropriate hardware profile in the HardwareProfile.h:

 

·         For SPI Flash use:’

#include "Configs/HWP_DA210_BRD_16PMP_WQVGAv1.h”

·         For Parallel Flash use:

#include "Configs/HWP_DA210_BRD_16PMP_PFLASH_WQVGAv1.h”

 

The hardware profile file name refers to the combination of Development Boards that are used to run the demo. Refer to the abbreviations summary (link) for details.

 

  

Required Hardware/Configuring the Hardware

 

The table below shows the hardware set up for the selected Development Boards attached to different Display Boards:

 

Selected Development Boards

Screen Rotation

4.3″ WQVGA Powertip TFT Display Board (AC164127-6)

 

PIC24FJ256DA210 Development Board (DM240312)

0 degree

(see note 2)

(see note 1)

 

PIC24FJ256DA210 Development Board (DM240312)

90 degree

(see note 3)

(see note 1)

Note:

1.     When using PIC24FJ256DA210 Development Board set the jumpers to:

-       JP8 – open (color depth is 16BPP, byte access is not performed)

-       JP9 – don’t care

-       JP10 – don’t care

-       JP11 – set to 2-3 (enable PMA17 for the SRAM and parallel flash)

-       JP12 – don’t care

-       JP23 – depending on the demo mode

·          set to 1-2 (use Parallel Flash) – when DISP_ORIENTATION = 0

·          set to 2-3 (use SPI Flash) – when DISP_ORIENTATION = 90

-       JP13 – set to RG8-S1 (use S1 switch)

-       JP14 – set to RE9-S2 (use S2 switch)

-       JP15 – set to RB5-S3 (use S3 switch)

-       JP16 – don’t care (or set to default USART_TX-TX)

-       JP17 – don’t care (or set to default USART_RX-RX)

2.     When the screen is used in its native orientation (i.e. 0 degree rotation (DISP_ORIENTATION = 0)) the parallel flash is used to store the images and the fonts. The use of the parallel flash allows the use of the RCCGPU CHRGPU to transfer images and fonts from the flash directly to the display buffer. The screen in this mode is used in landscape mode.

3.     When the screen is rotated 90 degrees (i.e. DISP_ORIENTATION = 90) the SPI Flash is used to store the images and the fonts. The screen is used in portrait mode.

 

  

Legend:

Supported out of the box

Hardware compatible, will need firmware modification

Supported, see limitations

Not supported, hardware not compatible

 

 Setting up the External Memory Programming Mode

 

This demo uses USB Device Mode when programming the external memory.  Programming the SPI or parallel flash will be through the J2 USB Device port of the development board.

 

The firmware requirements to enable the external memory programming are explained here.

  

If the data in the parallel or SPI flash do not contain the right data for the demo, the programming prompt will show. The programming prompt can also be manually enabled. Refer to the instructions below.

 

External Flash Programming Instructions:

1.     Hold down MCLR and S2 switches on the board

2.     Release MCLR while holding down S2. This will place the board on programming mode. The display will show the user prompted Programming External Memory Message.

3.     Send the hex data from the External Memory Programmer utility.

4.     After the programming, the firmware will automatically reset. If there was an error in the programming the screen will show the invalid data Programming External Memory Message.

 

 

Programming External Memory Messages

User Prompted

 

Program External Data

 

Please send data using

“External Memory

Programmer” utility.

Now waiting for data

via USB… (for USB based projects)

 

Invalid Data Prompted

 

External data invalid

 

Please send data using

“External Memory

Programmer” utility.

Now waiting for data

via USB… (for USB based projects)

 

 

Trademarks:

The Microchip name and logo, the Microchip logo, MPLAB, and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

PICDEM and PICTail are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

SD is a trademark of the SD Association in the U.S.A and other countries

Microsoft, Windows, Excel, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.