Rev Author Line No. Line
1661 kaklik 1 /********************************************************************
2 FileName: HardwareProfile - PIC24F Starter Kit.h
3 Dependencies: See INCLUDES section
4 Processor: PIC24FJ256GB106
5 Hardware: PIC24F Starter Kit
6 Compiler: Microchip C30
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 Company’s 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_PIC24F_STARTER_KIT_H
42 #define HARDWARE_PROFILE_PIC24F_STARTER_KIT_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 TRISAbits.TRISA2 // Input
58 #define self_power 1
59  
60 //#define USE_USB_BUS_SENSE_IO
61 #define tris_usb_bus_sense U1OTGSTATbits.SESVD //TRISBbits.TRISB5 // Input
62 #define USB_BUS_SENSE U1OTGSTATbits.SESVD
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 //If the application is going to be used with the HID bootloader
69 // then this will provide a function for the application to
70 // enter the bootloader from the application (optional)
71 #if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
72 #define EnterBootloader() __asm__("goto 0x400")
73 #endif
74  
75  
76  
77 /*******************************************************************/
78 /*******************************************************************/
79 /*******************************************************************/
80 /******** Application specific definitions *************************/
81 /*******************************************************************/
82 /*******************************************************************/
83 /*******************************************************************/
84  
85 /** Board definition ***********************************************/
86 //These defintions will tell the main() function which board is
87 // currently selected. This will allow the application to add
88 // the correct configuration bits as wells use the correct
89 // initialization functions for the board. These defitions are only
90 // required in the stack provided demos. They are not required in
91 // final application design.
92 #define DEMO_BOARD PIC24F_STARTER_KIT
93 #define PIC24F_STARTER_KIT
94 #define CLOCK_FREQ 32000000
95  
96 /** LED ************************************************************/
97 #define mInitAllLEDs() LATG &= 0xFE1F; TRISG &= 0xFE1F; LATF &= 0xFFCF; TRISF &= 0xFFCF; //G6,7,8,9 and F4,5
98  
99 #define mGetLED_1() (TRISG & ~0x0180?1:0)
100 #define mGetLED_2() (TRISG & ~0x0060?1:0)
101 #define mGetLED_3() (TRISF & ~0x0030?1:0)
102 #define mGetLED_4()
103  
104 #define mLED_1_On() TRISG |= 0x0180;
105 #define mLED_2_On() TRISG |= 0x0060;
106 #define mLED_3_On() TRISF |= 0x0030;
107 #define mLED_4_On()
108  
109 #define mLED_1_Off() TRISG &= ~0x0180;
110 #define mLED_2_Off() TRISG &= ~0x0060;
111 #define mLED_3_Off() TRISF &= ~0x0030;
112 #define mLED_4_Off()
113  
114 #define mLED_1_Toggle() TRISG ^= 0x0180;
115 #define mLED_2_Toggle() TRISG ^= 0x0060;
116 #define mLED_3_Toggle() TRISF ^= 0x0030;
117 #define mLED_4_Toggle()
118  
119 /** SWITCH *********************************************************/
120 #define mInitSwitch2() TRISDbits.TRISD6=1;
121 #define mInitSwitch3() TRISDbits.TRISD7=1;
122 #define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
123 #define sw2 PORTDbits.RD6
124 #define sw3 PORTDbits.RD7
125  
126 /** POT ************************************************************/
127 #define mInitPOT() {AD1PCFGLbits.PCFG0 = 0; AD1CON2bits.VCFG = 0x0; AD1CON3bits.ADCS = 0xFF; AD1CON1bits.SSRC = 0x0; AD1CON3bits.SAMC = 0b00001; AD1CON1bits.FORM = 0b00; AD1CON2bits.SMPI = 0x0; AD1CON1bits.ADON = 1;}
128  
129 #endif //HARDWARE_PROFILE_PIC24F_STARTER_KIT_H