• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

mTouch_hardwareProfile_16F182x.h

Go to the documentation of this file.
00001 /*************************************************************************
00002  *  © 2012 Microchip Technology Inc.                                       
00003  *  
00004  *  Project Name:    mTouch Framework v2.1
00005  *  FileName:        mTouch_HardwareProfile_16F182x.h
00006  *  Dependencies:    mTouch.h
00007  *  Processor:       See documentation for supported PIC® microcontrollers 
00008  *  Compiler:        HI-TECH Ver. 9.81 or later
00009  *  IDE:             MPLAB® IDE v8.50 (or later) or MPLAB® X                        
00010  *  Hardware:         
00011  *  Company:         
00012  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00013  *  Description:     mTouch Framework Hardware Profile Header File
00014  *                   - Provides information about correct SFR addresses,
00015  *                     pin assignments, module availability, and any other
00016  *                     part-specific data.
00017  *                   - See the documentation for more information.
00018  *************************************************************************/
00019  /**************************************************************************
00020  * MICROCHIP SOFTWARE NOTICE AND DISCLAIMER: You may use this software, and 
00021  * any derivatives created by any person or entity by or on your behalf, 
00022  * exclusively with Microchip's products in accordance with applicable
00023  * software license terms and conditions, a copy of which is provided for
00024  * your referencein accompanying documentation. Microchip and its licensors 
00025  * retain all ownership and intellectual property rights in the 
00026  * accompanying software and in all derivatives hereto. 
00027  * 
00028  * This software and any accompanying information is for suggestion only. 
00029  * It does not modify Microchip's standard warranty for its products. You 
00030  * agree that you are solely responsible for testing the software and 
00031  * determining its suitability. Microchip has no obligation to modify, 
00032  * test, certify, or support the software. 
00033  * 
00034  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER 
00035  * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 
00036  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A 
00037  * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE, ITS INTERACTION WITH 
00038  * MICROCHIP'S PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY 
00039  * APPLICATION. 
00040  * 
00041  * IN NO EVENT, WILL MICROCHIP BE LIABLE, WHETHER IN CONTRACT, WARRANTY, 
00042  * TORT (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY), STRICT 
00043  * LIABILITY, INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, 
00044  * SPECIAL, PUNITIVE, EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, 
00045  * FOR COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, 
00046  * HOWSOEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY 
00047  * OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWABLE BY LAW, 
00048  * MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS 
00049  * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID 
00050  * DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. 
00051  * 
00052  * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF 
00053  * THESE TERMS. 
00054  *************************************************************************/
00058 
00059 #if !defined(__MTOUCH_HARDWARE_16F182X_H)
00060 #define __MTOUCH_HARDWARE_16F182X_H
00061 
00062 #if !defined(_16F1829) && !defined(_16LF1829)
00063 #if !defined(_16F1828) && !defined(_16LF1828)
00064 #if !defined(_16F1827) && !defined(_16LF1827)
00065 #if !defined(_16F1826) && !defined(_16LF1826)
00066 #if !defined(_16F1825) && !defined(_16LF1825)
00067 #if !defined(_16F1824) && !defined(_16LF1824)
00068 #if !defined(_16F1823) && !defined(_16LF1823)
00069 #if !defined(_12F1822) && !defined(_12LF1822)
00070     #error The current mTouch hardware include file does not support this PIC microcontroller.
00071 #endif
00072 #endif
00073 #endif
00074 #endif
00075 #endif
00076 #endif
00077 #endif
00078 #endif
00079 
00080 #if defined(_12F1822) || defined(_12LF1822)
00081     #if MTOUCH_NUMBER_SENSORS > 4
00082         #error The PIC12F/LF1822 is not able to support more than 4 sensors due to pinout limitations.
00083     #endif
00084 #endif
00085 #if defined(_16F1823) || defined(_16LF1823)
00086     #if MTOUCH_NUMBER_SENSORS > 9
00087         #error The PIC16F/LF1823 is not able to support more than 7 sensors due to memory constraints.
00088     #endif
00089 #endif
00090 #if defined(_16F1823) || defined(_16LF1823)
00091     #if MTOUCH_NUMBER_SENSORS > 8
00092         #error The PIC16F/LF1823 is not able to support more than 8 sensors due to pinout limitations.
00093     #endif
00094 #endif
00095 #if defined(_16F1824) || defined(_16LF1824)
00096     #if MTOUCH_NUMBER_SENSORS > 8
00097         #error The PIC16F/LF1824 is not able to support more than 8 sensors due to pinout limitations.
00098     #endif
00099 #endif
00100 #if defined(_16F1825) || defined(_16LF1825)
00101     #if MTOUCH_NUMBER_SENSORS > 8
00102         #error The PIC16F/LF1825 is not able to support more than 8 sensors due to pinout limitations.
00103     #endif
00104 #endif
00105 #if defined(_16F1826) || defined(_16LF1826)
00106     #if MTOUCH_NUMBER_SENSORS > 12
00107         #error The PIC16F/LF1826 is not able to support more than 12 sensors due to pinout limitations.
00108     #endif
00109 #endif
00110 #if defined(_16F1827) || defined(_16LF1827)
00111     #if MTOUCH_NUMBER_SENSORS > 12
00112         #error The PIC16F/LF1827 is not able to support more than 12 sensors due to pinout limitations.
00113     #endif
00114 #endif
00115 #if defined(_16F1828) || defined(_16LF1828)
00116     #if MTOUCH_NUMBER_SENSORS > 12
00117         #error The PIC16F/LF1828 is not able to support more than 12 sensors due to pinout limitations.
00118     #endif
00119 #endif
00120 #if defined(_16F1829) || defined(_16LF1829)
00121     #if MTOUCH_NUMBER_SENSORS > 12
00122         #error The PIC16F/LF1829 is not able to support more than 12 sensors due to pinout limitations.
00123     #endif
00124 #endif
00125 
00126 #if ((MTOUCH_COMM_TYPE == MTOUCH_COMM_RS232_1WAY_ASCII) && !defined(MTOUCH_COMM_ASCII_SOFT_ENABLED)) || (MTOUCH_COMM_TYPE == MTOUCH_COMM_RS232_2WAY_BINARY)
00127 #if !defined(APFCON_INITIALIZED)
00128     #warning The mTouch comm module does not automatically set the APFCON# register. The TX pin may be selectable. This warning can be removed by defining the precompiler variable 'APFCON_INITIALIZED' in the mTouch_config.h file - verifying that you've initialized this register.
00129 #endif
00130 #endif
00131 
00132 //===========================================================
00133 //  Device Configuration
00134 //===========================================================
00135 
00136 
00137 //===========================================================
00138 //  Communications Configuration
00139 //===========================================================
00140 #define PIC_UART_AVAILABLE
00141 #define PIC_UART_BAUD_BITS                  16
00142 
00143 #define PIC_TIMER0_AVAILABLE
00144 #define PIC_TIMER1_AVAILABLE
00145 #define PIC_TIMER2_AVAILABLE
00146 #if !defined(_16F1823) && !defined(_16LF1823) && !defined(_12F1822) && !defined(_12LF1822)      
00147     #define PIC_TIMER4_AVAILABLE
00148     #define PIC_TIMER6_AVAILABLE
00149 #endif
00150 
00151 //===========================================================
00152 //  ADC Configuration
00153 //===========================================================
00154 #define PIC_ADC_BITS                10
00155 #define PIC_ADC_UNIMP_AVAILABLE
00156 
00157 #define PIC_ADC_ADCS                ADCON1bits.ADCS
00158 #define PIC_ADC_ADFM                ADCON1bits.ADFM
00159 #define PIC_ADC_ADON                ADCON0bits.ADON
00160 
00161 #define PIC_ADC_ADCS_FOSC2          0b000
00162 #define PIC_ADC_ADCS_FOSC4          0b100
00163 #define PIC_ADC_ADCS_FOSC8          0b001
00164 #define PIC_ADC_ADCS_FOSC16         0b101
00165 #define PIC_ADC_ADCS_FOSC32         0b010
00166 #define PIC_ADC_ADCS_FOSC64         0b110
00167 #define PIC_ADC_ADCS_FRC            0b111
00168 
00169 #define PIC_ADC_ADFM_RIGHT          1
00170 #define PIC_ADC_ADFM_LEFT           0
00171 
00172 #if     _XTAL_FREQ == 32000000 
00173     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC32
00174     #define PIC_ADC_TAD         1
00175 #elif   _XTAL_FREQ == 16000000 
00176     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00177     #define PIC_ADC_TAD         1 
00178 #elif   _XTAL_FREQ ==  8000000 
00179     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00180     #define PIC_ADC_TAD         1  
00181 #elif   _XTAL_FREQ ==  4000000 
00182     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00183     #define PIC_ADC_TAD         1 
00184 #elif   _XTAL_FREQ ==  2000000 
00185     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00186     #define PIC_ADC_TAD         1
00187 #elif   _XTAL_FREQ ==  1000000 
00188     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00189     #define PIC_ADC_TAD         2
00190 #else
00191     #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00192 #endif
00193 
00194 
00195 //===========================================================
00196 //  DAC Configuration
00197 //===========================================================
00198 #define PIC_DAC_AVAILABLE
00199 #define PIC_DACOUT_AVAILABLE
00200 
00201 #if defined(_16F1827) || defined(_16LF1827) || defined(_16F1826) || defined(_16LF1826)
00202     #define PIC_DACOUT_TRIS_C               TRISA2
00203     #define PIC_DACOUT_LAT_C                LATA2
00204     #define PIC_DACOUT_LAT_ASM              _LATA
00205     #define PIC_DACOUT_PIN                  2
00206 #else
00207     #define PIC_DACOUT_TRIS_C               TRISA0
00208     #define PIC_DACOUT_LAT_C                LATA0
00209     #define PIC_DACOUT_LAT_ASM              _LATA
00210     #define PIC_DACOUT_PIN                  0
00211 #endif
00212 
00213 #define PIC_DACCON0_VDD                 0xC0
00214 #define PIC_DACCON1_VDD                 0x1F
00215 #define PIC_DACCON0_VSS                 0x80
00216 #define PIC_DACCON1_VSS                 0x00
00217 
00218 #define PIC_DACOUT_DACCON0_VSS          0xA0
00219 #define PIC_DACOUT_DACCON0_1_3RD_VDD    0xA0
00220 #define PIC_DACOUT_DACCON0_HALF_VDD     0xA0
00221 #define PIC_DACOUT_DACCON0_2_3RD_VDD    0xE0
00222 #define PIC_DACOUT_DACCON0_VDD          0xE0
00223 
00224 #define PIC_DACOUT_DACCON1_VSS          0x00
00225 #define PIC_DACOUT_DACCON1_1_3RD_VDD    0x0B
00226 #define PIC_DACOUT_DACCON1_HALF_VDD     0x10
00227 #define PIC_DACOUT_DACCON1_2_3RD_VDD    0x16
00228 #define PIC_DACOUT_DACCON1_VDD          0x1F
00229 
00230 //===========================================================
00231 //  Software-enabled Watchdog Timer Configuration
00232 //===========================================================
00233 #define PIC_SWDTEN_AVAILABLE
00234 #define PIC_SWDTEN_OFF()                WDTCONbits.SWDTEN = 0
00235 #define PIC_SWDTEN_ON()                 WDTCONbits.SWDTEN = 1
00236 
00237 
00238 //===========================================================
00239 //  Analog Port Mapping
00240 //  - Right Justification
00241 //  - VDD/VSS Reference
00242 //  - GO/DONE cleared
00243 //  - ADON enabled
00244 //===========================================================
00245 #define MTOUCH_AD_AN0                   0x01
00246 #define MTOUCH_AD_AN1                   0x05
00247 #define MTOUCH_AD_AN2                   0x09
00248 #define MTOUCH_AD_AN3                   0x0D
00249 
00250 #if !defined(_12F1822) && !defined(_12LF1822)
00251     #define MTOUCH_AD_AN4               0x11
00252     #define MTOUCH_AD_AN5               0x15
00253     #define MTOUCH_AD_AN6               0x19
00254     #define MTOUCH_AD_AN7               0x1D
00255 #endif
00256 
00257 #if defined(_16F1826) || defined(_16LF1826) || \
00258     defined(_16F1827) || defined(_16LF1827) || \
00259     defined(_16F1828) || defined(_16LF1828) || \
00260     defined(_16F1829) || defined(_16LF1829)
00261     
00262     #define MTOUCH_AD_AN8               0x21
00263     #define MTOUCH_AD_AN9               0x25
00264     #define MTOUCH_AD_AN10              0x29
00265     #define MTOUCH_AD_AN11              0x2D
00266 #endif
00267 
00268 #define MTOUCH_AD_FVR_AND_GO            0x7F 
00269 #define MTOUCH_AD_DAC_AND_GO            0x7B 
00270 #define MTOUCH_AD_DAC_NOGO              0x79 
00271 #define MTOUCH_AD_ISO_AND_GO            0x43 
00272 #define MTOUCH_AD_ISO_NOGO              0x41
00273 
00274 
00275 
00276 #if defined(_16F1826) || defined(_16LF1826) || \
00277     defined(_16F1827) || defined(_16LF1827)
00278     
00279     #define MTOUCH_PIN_AN0              0
00280     #define MTOUCH_PIN_AN1              1
00281     #define MTOUCH_PIN_AN2              2
00282     #define MTOUCH_PIN_AN3              3
00283     #define MTOUCH_PIN_AN4              4
00284     #define MTOUCH_PIN_AN5              6
00285     #define MTOUCH_PIN_AN6              7
00286     #define MTOUCH_PIN_AN7              5
00287     #define MTOUCH_PIN_AN8              4
00288     #define MTOUCH_PIN_AN9              3
00289     #define MTOUCH_PIN_AN10             2
00290     #define MTOUCH_PIN_AN11             1
00291 #else
00292     #define MTOUCH_PIN_AN0              0
00293     #define MTOUCH_PIN_AN1              1
00294     #define MTOUCH_PIN_AN2              2
00295     #define MTOUCH_PIN_AN3              4
00296     #define MTOUCH_PIN_AN4              0
00297     #define MTOUCH_PIN_AN5              1
00298     #define MTOUCH_PIN_AN6              2
00299     #define MTOUCH_PIN_AN7              3
00300     #define MTOUCH_PIN_AN8              6
00301     #define MTOUCH_PIN_AN9              7
00302     #define MTOUCH_PIN_AN10             4
00303     #define MTOUCH_PIN_AN11             5
00304 #endif
00305 
00306 
00307 #if defined(_16F1826) || defined(_16LF1826) || \
00308     defined(_16F1827) || defined(_16LF1827)
00309     
00310     #define MTOUCH_LETTER_AN0           A
00311     #define MTOUCH_LETTER_AN1           A
00312     #define MTOUCH_LETTER_AN2           A
00313     #define MTOUCH_LETTER_AN3           A
00314     #define MTOUCH_LETTER_AN4           A
00315     #define MTOUCH_LETTER_AN5           B
00316     #define MTOUCH_LETTER_AN6           B
00317     #define MTOUCH_LETTER_AN7           B
00318     #define MTOUCH_LETTER_AN8           B
00319     #define MTOUCH_LETTER_AN9           B
00320     #define MTOUCH_LETTER_AN10          B
00321     #define MTOUCH_LETTER_AN11          B
00322 #else
00323     #define MTOUCH_LETTER_AN0           A
00324     #define MTOUCH_LETTER_AN1           A
00325     #define MTOUCH_LETTER_AN2           A
00326     #define MTOUCH_LETTER_AN3           A
00327     #define MTOUCH_LETTER_AN4           C
00328     #define MTOUCH_LETTER_AN5           C
00329     #define MTOUCH_LETTER_AN6           C
00330     #define MTOUCH_LETTER_AN7           C
00331     #define MTOUCH_LETTER_AN8           C
00332     #define MTOUCH_LETTER_AN9           C
00333     #define MTOUCH_LETTER_AN10          B
00334     #define MTOUCH_LETTER_AN11          B
00335 #endif
00336 
00337 
00338 #endif
00339 
00340 

mTouch Framework v2.1 documentation by  Click here to visit our website at www.microchip.com