External or Internal Memory and Palettes

Microchip Graphics Library

Microchip Graphics Library
External or Internal Memory and Palettes

Applications can run in in PIC24FJ256DA210 Device Family using internal memory or external memory with palette enabled or disabled. The table below summarizes the allowed color depth when combining palette with the use of internal or external memory.

Memory Location 
Palette Mode 
Color Depth (BPP) 
Notes 
Internal 
enabled 
1, 2, 4, 8 
When using internal memory and running TFT display, palette mode must be enabled. 
External 
enabled 
8, 16 
Palette mode can only be used for 8BPP color depth when using external memory. 
External 
disabled 
16 
When using external memory and palette is disabled and running TFT display, 16 BPP color depth must be used. 

 

Applications Using Palettes  

Settings in Graphics Configuration (GraphicsConfig.h)

#define USE_PALETTE                                     // to include code for palette 
#define USE_PALETTE_EXTERNAL                            // define this if palette data 
                                                        // will be in the external memory

// (note: PIC24FJ256DA210 Device Family color palette has a maximum of 256 
// entries, therefore the maximum color depth that can be used for applications 
// using palette is 8 BPP) 
#define COLOR_DEPTH   8                                 // define the color depth to use 

 

Settings in Hardware Profile (HardwareProfile.h)

/////////////////////////////////////////////////////
// Microchip Specific Development Tools
/////////////////////////////////////////////////////
#define PIC24FJ256DA210_DEV_BOARD                       // to use PIC24FJ256DA210 Development Board
#define GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E    // to use the Truly 3.2" display panel

/////////////////////////////////////////////////////
// PIC24FJ256DA210 Graphics Module required settings
/////////////////////////////////////////////////////
#define GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210           // to use the mchpGfxDrv.c and mchpGfxDrv.h driver

#define GFX_GCLK_DIVIDER 38                             // set divider to generate required GCLK pin 
                                                        // frequency (check display panel data sheet)
#define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00004B00ul   // set the display buffer starting address 
                                                        // (address can be located in internal or 
                                                        // external memory) 
#define GFX_DISPLAY_BUFFER_LENGTH 0x0004B000ul          // set the display buffer length in bytes (value 
                                                        // is derived from width, height and color depth 
                                                        // (COLOR_DEPTH)). If using external memory, 
                                                        // size must fit into the external memory size.

// If using external memory add macros to enable EPMP CS1 or CS2 here and adjust
// location of  GFX_DISPLAY_BUFFER_START_ADDRESS (see Application Using External Memory)                                
                    

 

In application code initialize and enable palette before initializing the Graphics Library

// set the palette color depth 
SetPaletteBpp(8);
// initialize the palette
SetPalette((void*)&MainPalette, 0, 256);

// enable the use of the palette
EnablePalette();    
    

 

Applications Using Internal Memory  

Settings in Graphics Configuration (GraphicsConfig.h)

// define the color depth to use (1, 2, 4, or 8BPP)
#define COLOR_DEPTH   8                                 

 

Settings in Graphics Configuration (GraphicsConfig.h) Settings in Hardware Profile (HardwareProfile.h)

/////////////////////////////////////////////////////
// Microchip Specific Development Tools
/////////////////////////////////////////////////////
#define PIC24FJ256DA210_DEV_BOARD                       // to use PIC24FJ256DA210 Development Board
#define GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E    // to use the Truly 3.2" display panel

/////////////////////////////////////////////////////
// PIC24FJ256DA210 Graphics Module required settings
/////////////////////////////////////////////////////
#define GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210           // to use the mchpGfxDrv.c and mchpGfxDrv.h driver

#define GFX_GCLK_DIVIDER 38                             // set divider to generate required GCLK pin 
                                                        // frequency (check display panel data sheet)
#define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00004B00ul   // set the display buffer starting address 
                                                        // (address must be located in internal memory)

#define GFX_DISPLAY_BUFFER_LENGTH 0x0004B000ul          // set the display buffer length in bytes (value 
                                                        // is derived from width, height and color depth 
                                                        // (COLOR_DEPTH)). Size must fit into internal memory

 

Applications Using External Memory  

Settings in Graphics Configuration (GraphicsConfig.h)

// define the color depth to use (8 or 16BPP)
#define COLOR_DEPTH   16                                    

 

Settings in Hardware Profile (HardwareProfile.h)

/////////////////////////////////////////////////////
// Microchip Specific Development Tools
/////////////////////////////////////////////////////
#define PIC24FJ256DA210_DEV_BOARD                       // to use PIC24FJ256DA210 Development Board
#define GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E    // to use the Truly 3.2" display panel

/////////////////////////////////////////////////////
// PIC24FJ256DA210 Graphics Module required settings
/////////////////////////////////////////////////////
#define GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210           // to use the mchpGfxDrv.c and mchpGfxDrv.h driver

#define GFX_GCLK_DIVIDER 61                             // set divider to generate required GCLK pin 
                                                        // frequency (check display panel data sheet)
#define USE_16BIT_PMP                                   // enable the use of EPMP 
#define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00020000ul   // set the display buffer starting address 
                                                        // (address will be located in external memory)

#define GFX_DISPLAY_BUFFER_LENGTH 0x00025800ul          // set the display buffer length in bytes (value 
                                                        // is derived from width, height and color depth 
                                                        // (COLOR_DEPTH)). Size must fit into external 
                                                        // memory region                                                        
                                                        
#define GFX_EPMP_CS1_BASE_ADDRESS 0x00020000ul          // if using EPMP CS1 set the starting address  
                                                        // of EPMP CS1 region                                                       
#define GFX_EPMP_CS1_MEMORY_SIZE 0x80000ul              // set the EPMP CS1 region size (in bytes)
                                                        // size defines the number of EPMP Address lines to use
                                                        
#define GFX_EPMP_CS2_BASE_ADDRESS 0x000A0000ul          // if using EPMP CS2 set the starting address  
                                                        // of EPMP CS2 region
#define GFX_EPMP_CS2_MEMORY_SIZE 0x80000ul              // set the EPMP CS2 region size (in bytes)
                                                        // size defines the number of EPMP Address lines to use
Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved