HardwareProfile - PIC24FJ64GB004 PIM.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /********************************************************************
  2. FileName: HardwareProfile - PIC24FJ64GB004 PIM.h
  3. Dependencies: See INCLUDES section
  4. Processor: PIC24FJ64GB004
  5. Hardware: PIC24FJ64GB004 PIM
  6. Compiler: Microchip C30
  7. Company: Microchip Technology, Inc.
  8. Software License Agreement:
  9. The software supplied herewith by Microchip Technology Incorporated
  10. (the “Company”) for its PIC® Microcontroller is intended and
  11. supplied to you, the Company’s customer, for use solely and
  12. exclusively on Microchip PIC Microcontroller products. The
  13. software is owned by the Company and/or its supplier, and is
  14. protected under applicable copyright laws. All rights are reserved.
  15. Any use in violation of the foregoing restrictions may subject the
  16. user to criminal sanctions under applicable laws, as well as to
  17. civil liability for the breach of the terms and conditions of this
  18. license.
  19. THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
  20. WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
  21. TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  22. PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
  23. IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
  24. CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  25. ********************************************************************
  26. File Description:
  27. Change History:
  28. Rev Date Description
  29. 1.0 11/19/2004 Initial release
  30. 2.1 02/26/2007 Updated for simplicity and to use common
  31. coding style
  32. 2.3 09/15/2008 Broke out each hardware platform into its own
  33. "HardwareProfile - xxx.h" file
  34. 2.4b 04/08/2009 Initial support for PIC24FJ64GB004 family
  35. ********************************************************************/
  36. #ifndef HARDWARE_PROFILE_PIC24FJ64GB004_PIM_H
  37. #define HARDWARE_PROFILE_PIC24FJ64GB004_PIM_H
  38. /*******************************************************************/
  39. /******** USB stack hardware selection options *********************/
  40. /*******************************************************************/
  41. //This section is the set of definitions required by the MCHPFSUSB
  42. // framework. These definitions tell the firmware what mode it is
  43. // running in, and where it can find the results to some information
  44. // that the stack needs.
  45. //These definitions are required by every application developed with
  46. // this revision of the MCHPFSUSB framework. Please review each
  47. // option carefully and determine which options are desired/required
  48. // for your application.
  49. //#define USE_SELF_POWER_SENSE_IO
  50. #define tris_self_power TRISAbits.TRISA2 // Input
  51. #define self_power 1
  52. //#define USE_USB_BUS_SENSE_IO
  53. #define tris_usb_bus_sense TRISBbits.TRISB5 // Input
  54. #define USB_BUS_SENSE 1
  55. //Uncomment this to make the output HEX of this project
  56. // to be able to be bootloaded using the HID bootloader
  57. #define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
  58. //If the application is going to be used with the HID bootloader
  59. // then this will provide a function for the application to
  60. // enter the bootloader from the application (optional)
  61. #if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
  62. #define EnterBootloader() __asm__("goto 0x400")
  63. #endif
  64. /*******************************************************************/
  65. /*******************************************************************/
  66. /*******************************************************************/
  67. /******** Application specific definitions *************************/
  68. /*******************************************************************/
  69. /*******************************************************************/
  70. /*******************************************************************/
  71. /** Board definition ***********************************************/
  72. //These defintions will tell the main() function which board is
  73. // currently selected. This will allow the application to add
  74. // the correct configuration bits as wells use the correct
  75. // initialization functions for the board. These defitions are only
  76. // required in the stack provided demos. They are not required in
  77. // final application design.
  78. #define DEMO_BOARD PIC24FJ64GB004_PIM
  79. #define EXPLORER_16
  80. #define PIC24FJ64GB004_PIM
  81. #define CLOCK_FREQ 32000000
  82. #define GetSystemClock() CLOCK_FREQ
  83. #define GetInstructionClock() GetSystemClock()
  84. /** LED ************************************************************/
  85. #define mInitAllLEDs() LATA &= 0xFD7F; TRISA &= 0xFD7F; LATB &= 0xFFF3; TRISB &= 0xFFF3;
  86. #define mLED_1 LATAbits.LATA7
  87. #define mLED_2 LATBbits.LATB3
  88. #define mLED_3 LATBbits.LATB2
  89. #define mLED_4 LATAbits.LATA9
  90. #define mGetLED_1() mLED_1
  91. #define mGetLED_2() mLED_2
  92. #define mGetLED_3() mLED_3
  93. #define mGetLED_4() mLED_4
  94. #define mLED_1_On() mLED_1 = 1;
  95. #define mLED_2_On() mLED_2 = 1;
  96. #define mLED_3_On() mLED_3 = 1;
  97. #define mLED_4_On() mLED_4 = 1;
  98. #define mLED_1_Off() mLED_1 = 0;
  99. #define mLED_2_Off() mLED_2 = 0;
  100. #define mLED_3_Off() mLED_3 = 0;
  101. #define mLED_4_Off() mLED_4 = 0;
  102. #define mLED_1_Toggle() mLED_1 = !mLED_1;
  103. #define mLED_2_Toggle() mLED_2 = !mLED_2;
  104. #define mLED_3_Toggle() mLED_3 = !mLED_3;
  105. #define mLED_4_Toggle() mLED_4 = !mLED_4;
  106. /** SWITCH *********************************************************/
  107. #define mInitSwitch2() TRISAbits.TRISA10=1;
  108. #define mInitSwitch3() TRISAbits.TRISA9=1;
  109. #define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
  110. #define sw2 PORTAbits.RA10
  111. #define sw3 PORTAbits.RA9
  112. /** I/O pin definitions ********************************************/
  113. #define INPUT_PIN 1
  114. #define OUTPUT_PIN 0
  115. #endif //HARDWARE_PROFILE_PIC24FJ64GB004_PIM_H