HardwareProfile.h Example

Microchip Graphics Library

Microchip Graphics Library
HardwareProfile.h Example

This is an example of the HardwareProfile.h file implementation: 

 

/*********************************************************************
* GetSystemClock() returns system clock frequency.
* GetPeripheralClock() returns peripheral clock frequency.
* GetInstructionClock() returns instruction clock frequency.
********************************************************************/

/*********************************************************************
* Macro: #define    GetSystemClock()
* Overview: This macro returns the system clock frequency in Hertz.
*            * value is 8 MHz x 4 PLL for PIC24
*            * value is 8 MHz/2 x 18 PLL for PIC32
********************************************************************/
    #if defined(__PIC24F__)
        #define GetSystemClock()    (32000000ul)
    #elif defined(__PIC32MX__)
        #define GetSystemClock()    (72000000ul)
    #elif defined(__dsPIC33F__) || defined(__PIC24H__)
        #define GetSystemClock()    (80000000ul)
    #endif

/*********************************************************************
* Macro: #define    GetPeripheralClock()
* Overview: This macro returns the peripheral clock frequency
*            used in Hertz.
*            * value for PIC24 is <PRE>(GetSystemClock()/2) </PRE>
*            * value for PIC32 is <PRE>(GetSystemClock()/(1<<OSCCONbits.PBDIV)) </PRE>
********************************************************************/
    #if defined(__PIC24F__) || defined(__PIC24H__) || defined(__dsPIC33F__)
        #define GetPeripheralClock()    (GetSystemClock() / 2)
    #elif defined(__PIC32MX__)
        #define GetPeripheralClock()    (GetSystemClock() / (1 << OSCCONbits.PBDIV))
    #endif

/*********************************************************************
* Macro: #define    GetInstructionClock()
* Overview: This macro returns instruction clock frequency
*            used in Hertz.
*            * value for PIC24 is <PRE>(GetSystemClock()/2) </PRE>
*            * value for PIC32 is (GetSystemClock()/PFMWSbits.CHECON) </PRE>
********************************************************************/
    #if defined(__PIC24F__) || defined(__PIC24H__) || defined(__dsPIC33F__)
        #define GetInstructionClock()   (GetSystemClock() / 2)
    #elif defined(__PIC32MX__)
        #define GetInstructionClock()   (GetSystemClock() / PFMWSbits.CHECON)
    #endif


//Auto Generated Code
#define PIC24FJ256DA210_DEV_BOARD
#define USE_16BIT_PMP
#define GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210
#define GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E
#define GFX_GCLK_DIVIDER 61
#define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00020000ul
#define GFX_DISPLAY_BUFFER_LENGTH 0x00025800ul
#define GFX_EPMP_CS1_BASE_ADDRESS 0x00020000ul
#define GFX_EPMP_CS1_MEMORY_SIZE 0x40000ul
//End Auto Generated Code

/*********************************************************************
* External Memory Programmer Settings
*********************************************************************/
#if defined (EXPLORER_16)
    #define USE_COMM_PKT_MEDIA_SERIAL_PORT
    #define BAUDRATE2               115200UL
    #define BRG_DIV2                4
    #define BRGH2                   1
#else
    #define USE_COMM_PKT_MEDIA_USB

    //#define USE_SELF_POWER_SENSE_IO
    #define tris_self_power     TRISAbits.TRISA2    // Input
    #define self_power          1

    //#define USE_USB_BUS_SENSE_IO
    #define tris_usb_bus_sense  TRISBbits.TRISB5    // Input
    #define USB_BUS_SENSE       U1OTGSTATbits.SESVD // Special considerations required if using SESVD for this purpose.  See documentation.

#endif

#define COMM_PKT_RX_MAX_SIZE    (1024)

.....
Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved