Rev 1661 Rev 1711
1 /******************************************************************** 1 /********************************************************************
2 FileName: HardwareProfile - PIC32MX460F512L PIM.h 2 FileName: HardwareProfile - PIC32MX460F512L PIM.h
3 Dependencies: See INCLUDES section 3 Dependencies: See INCLUDES section
4 Processor: PIC32 USB Microcontrollers 4 Processor: PIC32 USB Microcontrollers
5 Hardware: PIC32MX460F512L PIM 5 Hardware: PIC32MX460F512L PIM
6 Compiler: Microchip C32 (for PIC32) 6 Compiler: Microchip C32 (for PIC32)
7 Company: Microchip Technology, Inc. 7 Company: Microchip Technology, Inc.
8   8  
9 Software License Agreement: 9 Software License Agreement:
10   10  
11 The software supplied herewith by Microchip Technology Incorporated 11 The software supplied herewith by Microchip Technology Incorporated
12 (the “Company”) for its PIC® Microcontroller is intended and 12 (the “Company”) for its PIC® Microcontroller is intended and
13 supplied to you, the Company’s customer, for use solely and 13 supplied to you, the Company’s customer, for use solely and
14 exclusively on Microchip PIC Microcontroller products. The 14 exclusively on Microchip PIC Microcontroller products. The
15 software is owned by the Company and/or its supplier, and is 15 software is owned by the Company and/or its supplier, and is
16 protected under applicable copyright laws. All rights are reserved. 16 protected under applicable copyright laws. All rights are reserved.
17 Any use in violation of the foregoing restrictions may subject the 17 Any use in violation of the foregoing restrictions may subject the
18 user to criminal sanctions under applicable laws, as well as to 18 user to criminal sanctions under applicable laws, as well as to
19 civil liability for the breach of the terms and conditions of this 19 civil liability for the breach of the terms and conditions of this
20 license. 20 license.
21   21  
22 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, 22 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
23 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 23 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
24 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 24 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, 25 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
26 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 26 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
27 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 27 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
28   28  
29 ******************************************************************** 29 ********************************************************************
30 File Description: 30 File Description:
31   31  
32 Change History: 32 Change History:
33 Rev Date Description 33 Rev Date Description
34 1.0 11/19/2004 Initial release 34 1.0 11/19/2004 Initial release
35 2.1 02/26/2007 Updated for simplicity and to use common 35 2.1 02/26/2007 Updated for simplicity and to use common
36 coding style 36 coding style
37 2.3 09/15/2008 Broke out each hardware platform into its own 37 2.3 09/15/2008 Broke out each hardware platform into its own
38 "HardwareProfile - xxx.h" file 38 "HardwareProfile - xxx.h" file
39 ********************************************************************/ 39 ********************************************************************/
40   40  
41 #ifndef HARDWARE_PROFILE_PIC32MX460F512L_PIM_H 41 #ifndef HARDWARE_PROFILE_PIC32MX460F512L_PIM_H
42 #define HARDWARE_PROFILE_PIC32MX460F512L_PIM_H 42 #define HARDWARE_PROFILE_PIC32MX460F512L_PIM_H
43   43  
44 /*******************************************************************/ 44 /*******************************************************************/
45 /******** USB stack hardware selection options *********************/ 45 /******** USB stack hardware selection options *********************/
46 /*******************************************************************/ 46 /*******************************************************************/
47 //This section is the set of definitions required by the MCHPFSUSB 47 //This section is the set of definitions required by the MCHPFSUSB
48 // framework. These definitions tell the firmware what mode it is 48 // framework. These definitions tell the firmware what mode it is
49 // running in, and where it can find the results to some information 49 // running in, and where it can find the results to some information
50 // that the stack needs. 50 // that the stack needs.
51 //These definitions are required by every application developed with 51 //These definitions are required by every application developed with
52 // this revision of the MCHPFSUSB framework. Please review each 52 // this revision of the MCHPFSUSB framework. Please review each
53 // option carefully and determine which options are desired/required 53 // option carefully and determine which options are desired/required
54 // for your application. 54 // for your application.
55   55  
56 //#define USE_SELF_POWER_SENSE_IO 56 //#define USE_SELF_POWER_SENSE_IO
57 #define tris_self_power TRISAbits.TRISA2 // Input 57 #define tris_self_power TRISAbits.TRISA2 // Input
58 #define self_power 1 58 #define self_power 1
59   59  
60 //#define USE_USB_BUS_SENSE_IO 60 //#define USE_USB_BUS_SENSE_IO
61 #define tris_usb_bus_sense TRISBbits.TRISB5 // Input 61 #define tris_usb_bus_sense TRISBbits.TRISB5 // Input
62 #define USB_BUS_SENSE 1 62 #define USB_BUS_SENSE 1
63   63  
64 /*******************************************************************/ 64 /*******************************************************************/
65 /*******************************************************************/ 65 /*******************************************************************/
66 /*******************************************************************/ 66 /*******************************************************************/
67 /******** Application specific definitions *************************/ 67 /******** Application specific definitions *************************/
68 /*******************************************************************/ 68 /*******************************************************************/
69 /*******************************************************************/ 69 /*******************************************************************/
70 /*******************************************************************/ 70 /*******************************************************************/
71   71  
72 /** Board definition ***********************************************/ 72 /** Board definition ***********************************************/
73 //These defintions will tell the main() function which board is 73 //These defintions will tell the main() function which board is
74 // currently selected. This will allow the application to add 74 // currently selected. This will allow the application to add
75 // the correct configuration bits as wells use the correct 75 // the correct configuration bits as wells use the correct
76 // initialization functions for the board. These defitions are only 76 // initialization functions for the board. These defitions are only
77 // required in the stack provided demos. They are not required in 77 // required in the stack provided demos. They are not required in
78 // final application design. 78 // final application design.
79 #define DEMO_BOARD PIC32MX460F512L_PIM 79 #define DEMO_BOARD PIC32MX460F512L_PIM
80 #define EXPLORER_16 80 #define EXPLORER_16
81 #define PIC32MX460F512L_PIM 81 #define PIC32MX460F512L_PIM
82   82  
83 /** LED ************************************************************/ 83 /** LED ************************************************************/
84 #define mInitAllLEDs() LATA &= 0xFF03; TRISA &= 0xFF03; 84 #define mInitAllLEDs() LATA &= 0xFF03; TRISA &= 0xFF03;
85 85
86 #define mLED_1 LATAbits.LATA2 86 #define mLED_1 LATAbits.LATA2
87 #define mLED_2 LATAbits.LATA3 87 #define mLED_2 LATAbits.LATA3
88 #define mLED_3 LATAbits.LATA6 88 #define mLED_3 LATAbits.LATA6
89 #define mLED_4 LATAbits.LATA7 89 #define mLED_4 LATAbits.LATA7
90 90
91 #define mGetLED_1() mLED_1 91 #define mGetLED_1() mLED_1
92 #define mGetLED_2() mLED_2 92 #define mGetLED_2() mLED_2
93 #define mGetLED_3() mLED_3 93 #define mGetLED_3() mLED_3
94 #define mGetLED_4() mLED_4 94 #define mGetLED_4() mLED_4
95   95  
96 #define mLED_1_On() mLED_1 = 1; 96 #define mLED_1_On() mLED_1 = 1;
97 #define mLED_2_On() mLED_2 = 1; 97 #define mLED_2_On() mLED_2 = 1;
98 #define mLED_3_On() mLED_3 = 1; 98 #define mLED_3_On() mLED_3 = 1;
99 #define mLED_4_On() mLED_4 = 1; 99 #define mLED_4_On() mLED_4 = 1;
100 100
101 #define mLED_1_Off() mLED_1 = 0; 101 #define mLED_1_Off() mLED_1 = 0;
102 #define mLED_2_Off() mLED_2 = 0; 102 #define mLED_2_Off() mLED_2 = 0;
103 #define mLED_3_Off() mLED_3 = 0; 103 #define mLED_3_Off() mLED_3 = 0;
104 #define mLED_4_Off() mLED_4 = 0; 104 #define mLED_4_Off() mLED_4 = 0;
105 105
106 #define mLED_1_Toggle() mLED_1 = !mLED_1; 106 #define mLED_1_Toggle() mLED_1 = !mLED_1;
107 #define mLED_2_Toggle() mLED_2 = !mLED_2; 107 #define mLED_2_Toggle() mLED_2 = !mLED_2;
108 #define mLED_3_Toggle() mLED_3 = !mLED_3; 108 #define mLED_3_Toggle() mLED_3 = !mLED_3;
109 #define mLED_4_Toggle() mLED_4 = !mLED_4; 109 #define mLED_4_Toggle() mLED_4 = !mLED_4;
110 110
111 /** SWITCH *********************************************************/ 111 /** SWITCH *********************************************************/
112 #define mInitSwitch2() TRISDbits.TRISD6=1; 112 #define mInitSwitch2() TRISDbits.TRISD6=1;
113 #define mInitSwitch3() TRISDbits.TRISD7=1; 113 #define mInitSwitch3() TRISDbits.TRISD7=1;
114 #define mInitAllSwitches() mInitSwitch2();mInitSwitch3(); 114 #define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
115 #define sw2 PORTDbits.RD6 115 #define sw2 PORTDbits.RD6
116 #define sw3 PORTDbits.RD7 116 #define sw3 PORTDbits.RD7
117   117  
118 /** POT ************************************************************/ 118 /** POT ************************************************************/
119 #define mInitPOT() {AD1PCFGbits.PCFG5 = 0; AD1CON2bits.VCFG = 0x0; AD1CON3bits.ADCS = 0xFF; AD1CON1bits.SSRC = 0x0; AD1CON3bits.SAMC = 0x10; AD1CON1bits.FORM = 0x0; AD1CON2bits.SMPI = 0x0; AD1CON1bits.ADON = 1;} 119 #define mInitPOT() {AD1PCFGbits.PCFG5 = 0; AD1CON2bits.VCFG = 0x0; AD1CON3bits.ADCS = 0xFF; AD1CON1bits.SSRC = 0x0; AD1CON3bits.SAMC = 0x10; AD1CON1bits.FORM = 0x0; AD1CON2bits.SMPI = 0x0; AD1CON1bits.ADON = 1;}
120   120  
121 #endif //HARDWARE_PROFILE_PIC32MX460F512L_PIM_H 121 #endif //HARDWARE_PROFILE_PIC32MX460F512L_PIM_H