00001 /********************************************************************* 00002 * 00003 * Microchip USB C18 Firmware Version 1.0 00004 * 00005 ********************************************************************* 00006 * FileName: io_cfg.h 00007 * Dependencies: See INCLUDES section below 00008 * Processor: PIC18 00009 * Compiler: C18 2.30.01+ 00010 * Company: Microchip Technology, Inc. 00011 * 00012 * Software License Agreement 00013 * 00014 * The software supplied herewith by Microchip Technology Incorporated 00015 * (the “Company”) for its PICmicro® Microcontroller is intended and 00016 * supplied to you, the Company’s customer, for use solely and 00017 * exclusively on Microchip PICmicro Microcontroller products. The 00018 * software is owned by the Company and/or its supplier, and is 00019 * protected under applicable copyright laws. All rights are reserved. 00020 * Any use in violation of the foregoing restrictions may subject the 00021 * user to criminal sanctions under applicable laws, as well as to 00022 * civil liability for the breach of the terms and conditions of this 00023 * license. 00024 * 00025 * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, 00026 * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 00027 * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00028 * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, 00029 * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR 00030 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 00031 * 00032 * Author Date Comment 00033 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00034 * Rawin Rojvanit 7/21/04 Original. 00035 ********************************************************************/ 00036 00037 #ifndef IO_CFG_H 00038 #define IO_CFG_H 00039 00040 /** I N C L U D E S *************************************************/ 00041 #include "autofiles\usbcfg.h" 00042 00043 /** T R I S *********************************************************/ 00044 #define INPUT_PIN 1 00045 #define OUTPUT_PIN 0 00046 00047 /** U S B ***********************************************************/ 00048 #define tris_usb_bus_sense TRISAbits.TRISA1 // Input 00049 00050 #if defined(USE_USB_BUS_SENSE_IO) 00051 #define usb_bus_sense PORTAbits.RA1 00052 #else 00053 #define usb_bus_sense 1 00054 #endif 00055 00056 #define tris_self_power TRISAbits.TRISA2 // Input 00057 00058 #if defined(USE_SELF_POWER_SENSE_IO) 00059 #define self_power PORTAbits.RA2 00060 #else 00061 #define self_power 1 00062 #endif 00063 00064 /** L E D ***********************************************************/ 00065 #define mInitAllLEDs() LATB &= 0xF8; TRISB &= 0xF8; 00066 00067 #define mLED_1 LATBbits.LATB0 00068 #define mLED_2 LATBbits.LATB1 00069 #define mLED_3 LATBbits.LATB2 00070 00071 #define mLED_1_On() mLED_1 = 1; 00072 #define mLED_2_On() mLED_2 = 1; 00073 #define mLED_3_On() mLED_3 = 1; 00074 00075 #define mLED_1_Off() mLED_1 = 0; 00076 #define mLED_2_Off() mLED_2 = 0; 00077 #define mLED_3_Off() mLED_3 = 0; 00078 00079 #define mLED_1_Toggle() mLED_1 = !mLED_1; 00080 #define mLED_2_Toggle() mLED_2 = !mLED_2; 00081 #define mLED_3_Toggle() mLED_3 = !mLED_3; 00082 00083 /** S W I T C H *****************************************************/ 00084 //#define mInitAllSwitches() TRISBbits.TRISB4=1;TRISBbits.TRISB5=1; 00085 //#define mInitSwitch2() TRISBbits.TRISB4=1; 00086 //#define mInitSwitch3() TRISBbits.TRISB5=1; 00087 //#define sw2 PORTBbits.RB4 00088 //#define sw3 PORTBbits.RB5 00089 00090 /** P O T ***********************************************************/ 00091 //#define mInitPOT() TRISAbits.TRISA0=1;ADCON0=0x01;ADCON2=0x3C; 00092 00093 /** S P I : Chip Select Lines ***************************************/ 00094 //#define tris_cs_temp_sensor TRISBbits.TRISB2 // Output 00095 //#define cs_temp_sensor LATBbits.LATB2 00096 00097 //#define tris_cs_sdmmc TRISBbits.TRISB3 // Output 00098 //#define cs_sdmmc LATBbits.LATB3 00099 00100 /** S D M M C *******************************************************/ 00101 //#define TRIS_CARD_DETECT TRISBbits.TRISB4 // Input 00102 //#define CARD_DETECT PORTBbits.RB4 00103 00104 //#define TRIS_WRITE_DETECT TRISAbits.TRISA4 // Input 00105 //#define WRITE_DETECT PORTAbits.RA4 00106 00107 #endif //IO_CFG_H