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

mTouchCVD_HardwareProfile_12F61x.h

Go to the documentation of this file.
00001 /*************************************************************************
00002  *  © 2011 Microchip Technology Inc.                                       
00003  *  
00004  *  Project Name:    mTouch CVD Framework v1.1
00005  *  FileName:        mTouchCVD_HardwareProfile_12F61x.h
00006  *  Dependencies:    mTouchCVD.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 CVD 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(__MTOUCHCVD_HARDWARE_12F61X_H)
00060 #define __MTOUCHCVD_HARDWARE_12F61X_H
00061 
00062 #if !defined(_12F615) && !defined(_12HV615)
00063 #if !defined(_12F617) 
00064     #error The current mTouch hardware include file does not support this PIC microcontroller.
00065 #endif
00066 #endif
00067 
00068 #if defined(_12F615) || defined(_12HV615)
00069     #if CVD_NUMBER_SENSORS > 2
00070         #error The PIC12F/HV615 is not able to support more than 2 sensors on the mTouch Framework due to memory limitations.
00071     #endif
00072     #if defined(CVD_DEBUG) && (CVD_DEBUG == 1)
00073         #error The PIC12F/HV615 is not able to support debug communications at this time. 
00074     #endif
00075 #endif
00076 #if defined(_12F617)
00077     #if CVD_NUMBER_SENSORS > 4
00078         #error The PIC12F617 is not able to support more than 4 sensors due to pinout limitations.
00079     #endif
00080 #endif
00081 
00082 // No UART
00083 //#define CVD_DEBUG_UART_ENABLED
00084 
00085 #define CVD_DEBUG_COMM_INIT()                                       \
00086     do {                                                            \
00087     } while (0)
00088 
00089 #define CVD_DEBUG_COMM_TXIF             TXIF
00090 #define CVD_DEBUG_COMM_TXREG            TXREG
00091 
00092 #define CVD_SET_TMR0IE()                TMR0IE = 1
00093 #define CVD_SET_GIE()                   GIE    = 1
00094     
00095 #define CVD_SET_ADC_CLK_8MHZ()          ANSEL = 0b01010000 // 16
00096 #define CVD_SET_ADC_CLK_4MHZ()          ANSEL = 0b00010000 // 8
00097 #define CVD_SET_ADC_CLK_1MHZ()          ANSEL = 0b00000000 // 2
00098 
00099 #if defined(CVD_DEBUG) && (CVD_DEBUG == 1)
00100 #if !(CVD_DEBUG_SPEED == 9600 || CVD_DEBUG_SPEED == 115200)
00101     #error CVD_DEBUG_SPEED must be set to either 9600 or 115200 in the configuration file.
00102 #endif
00103 #endif
00104 
00105 #if     _XTAL_FREQ == 8000000 
00106     #define CVD_SET_ADC_CLK()   CVD_SET_ADC_CLK_8MHZ()   
00107     #define CVD_TAD             2 
00108 #elif   _XTAL_FREQ == 4000000 
00109     #define CVD_SET_ADC_CLK()   CVD_SET_ADC_CLK_4MHZ()    
00110     #define CVD_TAD             2
00111 #elif   _XTAL_FREQ == 1000000 
00112     #define CVD_SET_ADC_CLK()   CVD_SET_ADC_CLK_1MHZ()    
00113     #define CVD_TAD             2
00114 #else
00115     #error Chosen Fosc frequency is not supported by the mTouch framework on this device.
00116 #endif
00117 
00118 #define CVD_ADCON0_BANK     0
00119 #define CVD_VRCON_BANK      0
00120 #define CVD_UNIMPLEMENTED_AVAILABLE     1
00121 #define CVD_VRCON_MAX       0x8F
00122 #define CVD_VRCON_MIN       0xB0
00123     
00124 // A/D MUX selection for each A/D button, do not change this, refer to datasheet if curious how these are derived
00125 // Right Justified, Vdd as reference, A/D on, Go/Done  asserted, do not change this, refer to datasheet if curious how these are derived 
00126 #define CVD_AD_AN0              0x81    
00127 #define CVD_AD_AN1              0x85
00128 #define CVD_AD_AN2              0x89
00129 #define CVD_AD_AN3              0x8D
00130 
00131 #define CVD_AD_CVREF_NOGO   0x91
00132 #define CVD_AD_CVREF_AND_GO 0x93
00133 #define CVD_AD_ISO_AND_GO   0x9F // Selects an unimplemented, isolated ADC mux option and sets the GO/DONE bit.
00134 #define CVD_AD_ISO_NOGO     0x9D // Selects an unimplemented, isolated ADC mux option w/o setting the GO/DONE bit.
00135 
00136 #define CVD_SELECT_SENSOR0          __paste(CVD_AD_, CVD_SENSOR0)
00137 #define CVD_SELECT_SENSOR1          __paste(CVD_AD_, CVD_SENSOR1)
00138 #define CVD_SELECT_SENSOR2          __paste(CVD_AD_, CVD_SENSOR2)
00139 #define CVD_SELECT_SENSOR3          __paste(CVD_AD_, CVD_SENSOR3)
00140 #define CVD_SELECT_CVREF_AND_GO __paste(CVD_AD_, CVREF_AND_GO)
00141 #define CVD_SELECT_CVREF_NOGO   __paste(CVD_AD_, CVREF_NOGO)
00142 #define CVD_SELECT_ISO_AND_GO   __paste(CVD_AD_, ISO_AND_GO) 
00143 #define CVD_SELECT_ISO_NOGO     __paste(CVD_AD_, ISO_NOGO) 
00144 #define CVD_SELECT_REFERENCE    __paste(CVD_AD_, CVD_REFERENCE)
00145         
00146 #define CVD_PIN_AN0             0
00147 #define CVD_PIN_AN1             1
00148 #define CVD_PIN_AN2             2
00149 #define CVD_PIN_AN3             4
00150 
00151 #define CVD_PIN_SENSOR0     __paste(CVD_PIN_,CVD_SENSOR0)
00152 #define CVD_PIN_SENSOR1     __paste(CVD_PIN_,CVD_SENSOR1)
00153 #define CVD_PIN_SENSOR2     __paste(CVD_PIN_,CVD_SENSOR2)
00154 #define CVD_PIN_SENSOR3     __paste(CVD_PIN_,CVD_SENSOR3)
00155 #define CVD_PIN_REFERENCE   __paste(CVD_PIN_,CVD_REFERENCE)
00156 
00157 #define CVD_PORT_AN0    _GPIO
00158 #define CVD_PORT_AN1    _GPIO
00159 #define CVD_PORT_AN2    _GPIO   
00160 #define CVD_PORT_AN3    _GPIO
00161 
00162 #define CVD_PORT_SENSOR0    __paste(CVD_PORT_,CVD_SENSOR0)
00163 #define CVD_PORT_SENSOR1    __paste(CVD_PORT_,CVD_SENSOR1)
00164 #define CVD_PORT_SENSOR2    __paste(CVD_PORT_,CVD_SENSOR2)
00165 #define CVD_PORT_SENSOR3    __paste(CVD_PORT_,CVD_SENSOR3)
00166 #define CVD_PORT_REFERENCE  __paste(CVD_PORT_,CVD_REFERENCE)
00167 
00168 #endif
00169 

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