1661 |
kaklik |
1 |
/******************************************************************** |
|
|
2 |
FileName: HardwareProfile - PIC18F46J50 PIM.h |
|
|
3 |
Dependencies: See INCLUDES section |
|
|
4 |
Processor: PIC18 USB Microcontrollers |
|
|
5 |
Hardware: PIC18F46J50 PIM |
|
|
6 |
Compiler: Microchip C18 |
|
|
7 |
Company: Microchip Technology, Inc. |
|
|
8 |
|
|
|
9 |
Software License Agreement: |
|
|
10 |
|
|
|
11 |
The software supplied herewith by Microchip Technology Incorporated |
|
|
12 |
(the Company) for its PIC® Microcontroller is intended and |
|
|
13 |
supplied to you, the Companys customer, for use solely and |
|
|
14 |
exclusively on Microchip PIC Microcontroller products. The |
|
|
15 |
software is owned by the Company and/or its supplier, and is |
|
|
16 |
protected under applicable copyright laws. All rights are reserved. |
|
|
17 |
Any use in violation of the foregoing restrictions may subject the |
|
|
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 |
|
|
20 |
license. |
|
|
21 |
|
|
|
22 |
THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
|
|
23 |
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
|
|
24 |
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
|
|
25 |
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
|
|
26 |
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
|
|
27 |
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
|
|
28 |
|
|
|
29 |
******************************************************************** |
|
|
30 |
File Description: |
|
|
31 |
|
|
|
32 |
Change History: |
|
|
33 |
Rev Date Description |
|
|
34 |
1.0 11/19/2004 Initial release |
|
|
35 |
2.1 02/26/2007 Updated for simplicity and to use common |
|
|
36 |
coding style |
|
|
37 |
2.3 09/15/2008 Broke out each hardware platform into its own |
|
|
38 |
"HardwareProfile - xxx.h" file |
|
|
39 |
********************************************************************/ |
|
|
40 |
|
|
|
41 |
#ifndef HARDWARE_PROFILE_PIC18F46J50_PIM_H |
|
|
42 |
#define HARDWARE_PROFILE_PIC18F46J50_PIM_H |
|
|
43 |
|
|
|
44 |
/*******************************************************************/ |
|
|
45 |
/******** USB stack hardware selection options *********************/ |
|
|
46 |
/*******************************************************************/ |
|
|
47 |
//This section is the set of definitions required by the MCHPFSUSB |
|
|
48 |
// framework. These definitions tell the firmware what mode it is |
|
|
49 |
// running in, and where it can find the results to some information |
|
|
50 |
// that the stack needs. |
|
|
51 |
//These definitions are required by every application developed with |
|
|
52 |
// this revision of the MCHPFSUSB framework. Please review each |
|
|
53 |
// option carefully and determine which options are desired/required |
|
|
54 |
// for your application. |
|
|
55 |
|
|
|
56 |
//#define USE_SELF_POWER_SENSE_IO |
|
|
57 |
#define tris_self_power TRISCbits.TRISC2 // Input |
|
|
58 |
#define self_power 1 |
|
|
59 |
|
|
|
60 |
//#define USE_USB_BUS_SENSE_IO |
|
|
61 |
#define tris_usb_bus_sense TRISCbits.TRISC2 // Input |
|
|
62 |
#define USB_BUS_SENSE 1 |
|
|
63 |
|
|
|
64 |
//Uncomment this to make the output HEX of this project |
|
|
65 |
// to be able to be bootloaded using the HID bootloader |
|
|
66 |
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER |
|
|
67 |
|
|
|
68 |
/*******************************************************************/ |
|
|
69 |
/*******************************************************************/ |
|
|
70 |
/*******************************************************************/ |
|
|
71 |
/******** Application specific definitions *************************/ |
|
|
72 |
/*******************************************************************/ |
|
|
73 |
/*******************************************************************/ |
|
|
74 |
/*******************************************************************/ |
|
|
75 |
|
|
|
76 |
/** Board definition ***********************************************/ |
|
|
77 |
//These defintions will tell the main() function which board is |
|
|
78 |
// currently selected. This will allow the application to add |
|
|
79 |
// the correct configuration bits as wells use the correct |
|
|
80 |
// initialization functions for the board. These defitions are only |
|
|
81 |
// required in the stack provided demos. They are not required in |
|
|
82 |
// final application design. |
|
|
83 |
#define DEMO_BOARD PIC18F46J50_PIM |
|
|
84 |
#define PIC18F46J50_PIM |
|
|
85 |
#define CLOCK_FREQ 48000000 |
|
|
86 |
#define GetSystemClock() CLOCK_FREQ |
|
|
87 |
#define GetInstructionClock() GetSystemClock() |
|
|
88 |
|
|
|
89 |
/** LED ************************************************************/ |
|
|
90 |
#define mInitAllLEDs() LATE &= 0xFC; TRISE &= 0xFC; |
|
|
91 |
|
|
|
92 |
#define mLED_1 LATEbits.LATE0 |
|
|
93 |
#define mLED_2 LATEbits.LATE1 |
|
|
94 |
#define mLED_3 mLED_1 |
|
|
95 |
#define mLED_4 mLED_2 |
|
|
96 |
|
|
|
97 |
#define mGetLED_1() mLED_1 |
|
|
98 |
#define mGetLED_2() mLED_2 |
|
|
99 |
#define mGetLED_3() mLED_3 |
|
|
100 |
#define mGetLED_4() mLED_4 |
|
|
101 |
|
|
|
102 |
#define mLED_1_On() mLED_1 = 1; |
|
|
103 |
#define mLED_2_On() mLED_2 = 1; |
|
|
104 |
#define mLED_3_On() mLED_3 = 1; |
|
|
105 |
#define mLED_4_On() mLED_4 = 1; |
|
|
106 |
|
|
|
107 |
#define mLED_1_Off() mLED_1 = 0; |
|
|
108 |
#define mLED_2_Off() mLED_2 = 0; |
|
|
109 |
#define mLED_3_Off() mLED_3 = 0; |
|
|
110 |
#define mLED_4_Off() mLED_4 = 0; |
|
|
111 |
|
|
|
112 |
#define mLED_1_Toggle() mLED_1 = !mLED_1; |
|
|
113 |
#define mLED_2_Toggle() mLED_2 = !mLED_2; |
|
|
114 |
#define mLED_3_Toggle() mLED_3 = !mLED_3; |
|
|
115 |
#define mLED_4_Toggle() mLED_4 = !mLED_4; |
|
|
116 |
|
|
|
117 |
/** SWITCH *********************************************************/ |
|
|
118 |
#define mInitSwitch2() TRISBbits.TRISB2=1; |
|
|
119 |
#define mInitSwitch3() mInitSwitch2(); |
|
|
120 |
#define mInitAllSwitches() mInitSwitch2(); |
|
|
121 |
#define sw2 PORTBbits.RB2 |
|
|
122 |
#define sw3 PORTBbits.RB2 |
|
|
123 |
|
|
|
124 |
/** POT ************************************************************/ |
|
|
125 |
#define mInitPOT() {TRISAbits.TRISA0=1; \ |
|
|
126 |
ANCON0bits.PCFG0 = 0; \ |
|
|
127 |
ADCON0=0x01; \ |
|
|
128 |
ADCON1=0xBE;} // POT on HPC Explorer |
|
|
129 |
|
|
|
130 |
#endif //HARDWARE_PROFILE_PIC18F46J50_PIM_H |