Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019  
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00056 
00057 #if !defined(__MTOUCHCVD_HARDWARE_16F91X_H)
00058 #define __MTOUCHCVD_HARDWARE_16F91X_H
00059 
00060 #if !defined(_16F913)
00061 #if !defined(_16F914)
00062 #if !defined(_16F916)
00063 #if !defined(_16F917)
00064 #if !defined(_16F946)
00065     #error The current mTouch hardware include file does not support this PIC microcontroller.
00066 #endif
00067 #endif
00068 #endif
00069 #endif
00070 #endif
00071 
00072 #if defined(_16F913) || defined(_16F916)
00073     #if MTOUCH_NUMBER_SENSORS > 5
00074         #error The current mTouch microcontroller is not able to support more than 5 sensors due to pinout limitations.
00075     #endif
00076     #if MTOUCH_NUMBER_OF_SLEEP_SENSORS > 5
00077         #error The current mTouch microcontroller is not able to support more than 5 sleep-mode sensors due to pinout limitations.
00078     #endif
00079 #endif
00080 #if defined(_16F914) || defined(_16F917) || defined(_16F946)
00081     #if MTOUCH_NUMBER_SENSORS > 8
00082         #error The current mTouch microcontroller is not able to support more than 8 sensors due to pinout limitations.
00083     #endif
00084 #endif
00085 
00086 
00087 
00088 
00089 #define MTOUCH_USE_PORT
00090 
00091 
00092 
00093 
00094 #define PIC_UART_AVAILABLE
00095 #define PIC_UART_BAUD_BITS          8
00096 
00097 #define PIC_TIMER0_AVAILABLE
00098 #define PIC_TIMER1_AVAILABLE
00099 #define PIC_TIMER2_AVAILABLE
00100     
00101 
00102 
00103 
00104 #define PIC_ADC_BITS                10
00105 
00106 #if defined(_16F913) || defined(_16F916)
00107     #define PIC_ADC_UNIMP_AVAILABLE
00108 #endif
00109 
00110 #define PIC_ADC_ADCS                ADCON1bits.ADCS
00111 #define PIC_ADC_ADFM                ADCON0bits.ADFM
00112 #define PIC_ADC_ADON                ADCON0bits.ADON
00113 
00114 #define PIC_ADC_ADCS_FOSC2          0b000
00115 #define PIC_ADC_ADCS_FOSC4          0b100
00116 #define PIC_ADC_ADCS_FOSC8          0b001
00117 #define PIC_ADC_ADCS_FOSC16         0b101
00118 #define PIC_ADC_ADCS_FOSC32         0b010
00119 #define PIC_ADC_ADCS_FOSC64         0b110
00120 #define PIC_ADC_ADCS_FRC            0b111
00121 
00122 #define PIC_ADC_ADFM_RIGHT          1
00123 #define PIC_ADC_ADFM_LEFT           0
00124 
00125 #if     _XTAL_FREQ == 8000000 
00126     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00127     #define PIC_ADC_TAD         2 
00128 #elif   _XTAL_FREQ == 4000000 
00129     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00130     #define PIC_ADC_TAD         2 
00131 #elif   _XTAL_FREQ == 2000000 
00132     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00133     #define PIC_ADC_TAD         2 
00134 #elif   _XTAL_FREQ == 1000000 
00135     #define PIC_ADC_SETCLK()    PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00136     #define PIC_ADC_TAD         2 
00137 #else
00138     #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00139 #endif
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 #define MTOUCH_AD_AN0               0x81
00162 #define MTOUCH_AD_AN1               0x85
00163 #define MTOUCH_AD_AN2               0x89
00164 #define MTOUCH_AD_AN3               0x8D
00165 #define MTOUCH_AD_AN4               0x91
00166 
00167 #if defined(_16F914) || defined(_16F917) || defined(_16F946)
00168     #define MTOUCH_AD_AN5           0x95
00169     #define MTOUCH_AD_AN6           0x99
00170     #define MTOUCH_AD_AN7           0x9D
00171 #endif
00172 #if defined(_16F913) || defined(_16F916)
00173     #define MTOUCH_AD_ISO_AND_GO    0x97
00174     #define MTOUCH_AD_ISO_NOGO      0x95
00175 #endif
00176 
00177 #define MTOUCH_PIN_AN0              0
00178 #define MTOUCH_PIN_AN1              1
00179 #define MTOUCH_PIN_AN2              2
00180 #define MTOUCH_PIN_AN3              3
00181 #define MTOUCH_PIN_AN4              5
00182 #define MTOUCH_PIN_AN5              0
00183 #define MTOUCH_PIN_AN6              1
00184 #define MTOUCH_PIN_AN7              2
00185 
00186 #define MTOUCH_LETTER_AN0           A
00187 #define MTOUCH_LETTER_AN1           A
00188 #define MTOUCH_LETTER_AN2           A
00189 #define MTOUCH_LETTER_AN3           A
00190 #define MTOUCH_LETTER_AN4           A
00191 #define MTOUCH_LETTER_AN5           E
00192 #define MTOUCH_LETTER_AN6           E
00193 #define MTOUCH_LETTER_AN7           E
00194 
00195 #endif
00196