Rev Author Line No. Line
1661 kaklik 1 /********************************************************************
2 FileName: HardwareProfile - PIC32MX460F512L PIM.h
3 Dependencies: See INCLUDES section
4 Processor: PIC18 or PIC24 USB Microcontrollers
5 Hardware: The code is natively intended to be used on the following
6 hardware platforms: PICDEM™ FS USB Demo Board,
7 PIC18F87J50 FS USB Plug-In Module, or
8 Explorer 16 + PIC24 USB PIM. The firmware may be
9 modified for use on other USB platforms by editing this
10 file (HardwareProfile.h).
11 Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
12 Company: Microchip Technology, Inc.
13  
14 Software License Agreement:
15  
16 The software supplied herewith by Microchip Technology Incorporated
17 (the “Company”) for its PIC® Microcontroller is intended and
18 supplied to you, the Company’s customer, for use solely and
19 exclusively on Microchip PIC Microcontroller products. The
20 software is owned by the Company and/or its supplier, and is
21 protected under applicable copyright laws. All rights are reserved.
22 Any use in violation of the foregoing restrictions may subject the
23 user to criminal sanctions under applicable laws, as well as to
24 civil liability for the breach of the terms and conditions of this
25 license.
26  
27 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
28 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
29 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
30 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
31 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
32 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
33  
34 ********************************************************************
35 File Description:
36  
37 Change History:
38 Rev Date Description
39 1.0 11/19/2004 Initial release
40 2.1 02/26/2007 Updated for simplicity and to use common
41 coding style
42  
43 ********************************************************************/
44  
45 #ifndef HARDWARE_PROFILE_UBW32_H
46 #define HARDWARE_PROFILE_UBW32_H
47  
48 #include "Compiler.h"
49  
50 /*******************************************************************/
51 /*******************************************************************/
52 /*******************************************************************/
53 /******** Application specific definitions *************************/
54 /*******************************************************************/
55 /*******************************************************************/
56 /*******************************************************************/
57  
58 /** Board definition ***********************************************/
59 //These defintions will tell the main() function which board is
60 // currently selected. This will allow the application to add
61 // the correct configuration bits as wells use the correct
62 // initialization functions for the board. These defitions are only
63 // required in the stack provided demos. They are not required in
64 // final application design.
65  
66 /** CPU Clock Speed Assignment *************************************/
67 //#define RUN_AT_48MHZ
68 //#define RUN_AT_24MHZ
69 //#define RUN_AT_60MHZ
70 #define RUN_AT_80MHZ
71  
72 // Various clock values
73 #if defined(RUN_AT_48MHZ)
74 #define GetSystemClock() 48000000UL
75 #define GetPeripheralClock() 48000000UL
76 #define GetInstructionClock() (GetSystemClock())
77 #elif defined(RUN_AT_24MHZ)
78 #define GetSystemClock() 24000000UL
79 #define GetPeripheralClock() 24000000UL
80 #define GetInstructionClock() (GetSystemClock())
81 #elif defined(RUN_AT_60MHZ)
82 #define GetSystemClock() (60000000ul)
83 #define GetPeripheralClock() (GetSystemClock())
84 #define GetInstructionClock() (GetSystemClock())
85 #elif defined(RUN_AT_80MHZ)
86 #define GetSystemClock() (80000000ul)
87 #define GetPeripheralClock() (GetSystemClock())
88 #define GetInstructionClock() (GetSystemClock())
89 #else
90 #error Choose a speed
91 #endif
92  
93 #define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
94  
95 /*******************************************************************/
96 /******** USB stack hardware selection options *********************/
97 /*******************************************************************/
98 //This section is the set of definitions required by the MCHPFSUSB
99 // framework. These definitions tell the firmware what mode it is
100 // running in, and where it can find the results to some information
101 // that the stack needs.
102 //These definitions are required by every application developed with
103 // this revision of the MCHPFSUSB framework. Please review each
104 // option carefully and determine which options are desired/required
105 // for your application.
106  
107 //#define USE_SELF_POWER_SENSE_IO
108 #define tris_self_power TRISAbits.TRISA2 // Input
109 #define self_power 1
110  
111 //#define USE_USB_BUS_SENSE_IO
112 #define tris_usb_bus_sense TRISBbits.TRISB5 // Input
113 #define USB_BUS_SENSE 1
114  
115 /*******************************************************************/
116 /******** Device revision workarounds ******************************/
117 /*******************************************************************/
118 //Uncomment this definition to allow for revision B3 silicon to work
119 // with this firmware.
120 #define PIC32MX460F512L_REV_B3_WORKAROUND
121  
122 /*******************************************************************/
123 /*******************************************************************/
124 /*******************************************************************/
125 /******** Application specific definitions *************************/
126 /*******************************************************************/
127 /*******************************************************************/
128 /*******************************************************************/
129  
130 /** Board definition ***********************************************/
131 //These defintions will tell the main() function which board is
132 // currently selected. This will allow the application to add
133 // the correct configuration bits as wells use the correct
134 // initialization functions for the board. These defitions are only
135 // required in the stack provided demos. They are not required in
136 // final application design.
137 #define DEMO_BOARD UBW32
138 #define UBW32
139  
140 /** LED ************************************************************/
141 #define mInitAllLEDs() LATE |= 0x000F; TRISE &= 0xFFF0;
142  
143 #define mLED_1 LATEbits.LATE3
144 #define mLED_2 LATEbits.LATE2
145 #define mLED_3 LATEbits.LATE1
146 #define mLED_4 LATEbits.LATE0
147  
148 #define mGetLED_1() mLED_1
149 #define mGetLED_USB() mLED_1
150 #define mGetLED_2() mLED_2
151 #define mGetLED_3() mLED_3
152 #define mGetLED_4() mLED_4
153  
154 #define mLED_1_On() mLED_1 = 0;
155 #define mLED_USB_On() mLED_1 = 0;
156 #define mLED_2_On() mLED_2 = 0;
157 #define mLED_3_On() mLED_3 = 0;
158 #define mLED_4_On() mLED_4 = 0;
159  
160 #define mLED_1_Off() mLED_1 = 1;
161 #define mLED_USB_Off() mLED_1 = 1;
162 #define mLED_2_Off() mLED_2 = 1;
163 #define mLED_3_Off() mLED_3 = 1;
164 #define mLED_4_Off() mLED_4 = 1;
165  
166 #define mLED_1_Toggle() mLED_1 = !mLED_1;
167 #define mLED_USB_Toggle() mLED_1 = !mLED_1;
168 #define mLED_2_Toggle() mLED_2 = !mLED_2;
169 #define mLED_3_Toggle() mLED_3 = !mLED_3;
170 #define mLED_4_Toggle() mLED_4 = !mLED_4;
171  
172 #define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
173  
174 /** SWITCH *********************************************************/
175 #define mInitSwitch2() TRISEbits.TRISE7=1;
176 #define mInitSwitch3() TRISEbits.TRISE6=1;
177 #define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
178 #define swProgram PORTEbits.RE7
179 #define swUser PORTEbits.RE6
180  
181 #define UserSW swUser
182 #define sw2 swUser
183  
184 #define RXTX LATAbits.LATA2
185  
186 #define BPF_S0 LATAbits.LATA0
187 #define BPF_S1 LATAbits.LATA1
188 #define BPF_S0_STATE PORTAbits.RA0
189 #define BPF_S1_STATE PORTAbits.RA1
190  
191 #define PADDLE_DIT PORTFbits.RF4
192 #define PADDLE_DAH PORTFbits.RF5
193  
194 #define LPF_0 LATAbits.LATA3
195 #define LPF_1 LATAbits.LATA4
196 #define LPF_2 LATAbits.LATA5
197 #define LPF_3 LATAbits.LATA6
198 #define LPF_4 LATAbits.LATA7
199 #define LPF_5 LATAbits.LATA9
200 #define LPF_6 LATAbits.LATA10
201  
202  
203 #endif