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
00053
00054
00058
00059 #if !defined(__MTOUCH_HARDWARE_16F193X_H)
00060 #define __MTOUCH_HARDWARE_16F193X_H
00061
00062 #if !defined(_16F1933) && !defined(_16LF1933)
00063 #if !defined(_16F1934) && !defined(_16LF1934)
00064 #if !defined(_16F1936) && !defined(_16LF1936)
00065 #if !defined(_16F1937) && !defined(_16LF1937)
00066 #if !defined(_16F1938) && !defined(_16LF1938)
00067 #if !defined(_16F1939) && !defined(_16LF1939)
00068 #error The current mTouch hardware include file does not support this PIC microcontroller.
00069 #endif
00070 #endif
00071 #endif
00072 #endif
00073 #endif
00074 #endif
00075
00076 #if defined(_16F1933) || defined(_16LF1933)
00077 #if MTOUCH_NUMBER_SENSORS > 11
00078 #error The PIC16F/LF1933 is not able to support more than 11 sensors due to pinout limitations.
00079 #endif
00080 #endif
00081 #if defined(_16F1936) || defined(_16LF1936)
00082 #if MTOUCH_NUMBER_SENSORS > 11
00083 #error The PIC16F/LF1936 is not able to support more than 11 sensors due to pinout limitations.
00084 #endif
00085 #endif
00086 #if defined(_16F1938) || defined(_16LF1938)
00087 #if MTOUCH_NUMBER_SENSORS > 11
00088 #error The PIC16F/LF1938 is not able to support more than 11 sensors due to pinout limitations.
00089 #endif
00090 #endif
00091 #if defined(_16F1934) || defined(_16LF1934)
00092 #if MTOUCH_NUMBER_SENSORS > 14
00093 #error The PIC16F/LF1934 is not able to support more than 14 sensors due to pinout limitations.
00094 #endif
00095 #endif
00096 #if defined(_16F1937) || defined(_16LF1937)
00097 #if MTOUCH_NUMBER_SENSORS > 14
00098 #error The PIC16F/LF1937 is not able to support more than 14 sensors due to pinout limitations.
00099 #endif
00100 #endif
00101 #if defined(_16F1939) || defined(_16LF1939)
00102 #if MTOUCH_NUMBER_SENSORS > 14
00103 #error The PIC16F/LF1939 is not able to support more than 14 sensors due to pinout limitations.
00104 #endif
00105 #endif
00106
00107
00108
00109
00110 #define PIC_UART_AVAILABLE
00111 #define PIC_UART_BAUD_BITS 16
00112
00113 #define PIC_SSP_AVAILABLE
00114
00115
00116
00117
00118 #define PIC_TIMER0_AVAILABLE
00119 #define PIC_TIMER1_AVAILABLE
00120 #define PIC_TIMER2_AVAILABLE
00121 #define PIC_TIMER4_AVAILABLE
00122 #define PIC_TIMER6_AVAILABLE
00123
00124
00125
00126
00127
00128 #define PIC_ADC_BITS 10
00129 #define PIC_ADC_UNIMP_AVAILABLE
00130
00131 #define PIC_ADC_ADCS ADCON1bits.ADCS
00132 #define PIC_ADC_ADFM ADCON1bits.ADFM
00133 #define PIC_ADC_ADON ADCON0bits.ADON
00134
00135 #define PIC_ADC_ADCS_FOSC2 0b000
00136 #define PIC_ADC_ADCS_FOSC4 0b100
00137 #define PIC_ADC_ADCS_FOSC8 0b001
00138 #define PIC_ADC_ADCS_FOSC16 0b101
00139 #define PIC_ADC_ADCS_FOSC32 0b010
00140 #define PIC_ADC_ADCS_FOSC64 0b110
00141 #define PIC_ADC_ADCS_FRC 0b111
00142
00143 #define PIC_ADC_ADFM_RIGHT 1
00144 #define PIC_ADC_ADFM_LEFT 0
00145
00146 #if _XTAL_FREQ == 32000000
00147 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC32
00148 #define PIC_ADC_TAD 1
00149 #elif _XTAL_FREQ == 16000000
00150 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00151 #define PIC_ADC_TAD 1
00152 #elif _XTAL_FREQ == 8000000
00153 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00154 #define PIC_ADC_TAD 1
00155 #elif _XTAL_FREQ == 4000000
00156 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00157 #define PIC_ADC_TAD 1
00158 #elif _XTAL_FREQ == 2000000
00159 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00160 #define PIC_ADC_TAD 1
00161 #elif _XTAL_FREQ == 1000000
00162 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00163 #define PIC_ADC_TAD 2
00164 #else
00165 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00166 #endif
00167
00168
00169
00170
00171
00172
00173 #define PIC_DAC_AVAILABLE
00174 #define PIC_DACOUT_AVAILABLE
00175
00176 #define PIC_DACOUT_TRIS_C TRISA2
00177 #define PIC_DACOUT_TRIS_ASM _TRISA
00178 #define PIC_DACOUT_LAT_C LATA2
00179 #define PIC_DACOUT_LAT_ASM _LATA
00180 #define PIC_DACOUT_PIN 2
00181
00182 #define PIC_DACCON0_VDD 0xC0
00183 #define PIC_DACCON1_VDD 0x1F
00184 #define PIC_DACCON0_VSS 0x80
00185 #define PIC_DACCON1_VSS 0x00
00186
00187 #define PIC_DACOUT_DACCON0_VSS 0xA0
00188 #define PIC_DACOUT_DACCON0_1_3RD_VDD 0xA0
00189 #define PIC_DACOUT_DACCON0_HALF_VDD 0xA0
00190 #define PIC_DACOUT_DACCON0_2_3RD_VDD 0xE0
00191 #define PIC_DACOUT_DACCON0_VDD 0xE0
00192
00193 #define PIC_DACOUT_DACCON1_VSS 0x00
00194 #define PIC_DACOUT_DACCON1_1_3RD_VDD 0x0B
00195 #define PIC_DACOUT_DACCON1_HALF_VDD 0x10
00196 #define PIC_DACOUT_DACCON1_2_3RD_VDD 0x16
00197 #define PIC_DACOUT_DACCON1_VDD 0x1F
00198
00199
00200
00201
00202 #define PIC_SWDTEN_AVAILABLE
00203 #define PIC_SWDTEN_OFF() WDTCONbits.SWDTEN = 0
00204 #define PIC_SWDTEN_ON() WDTCONbits.SWDTEN = 1
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 #define MTOUCH_AD_AN0 0x01
00215 #define MTOUCH_AD_AN1 0x05
00216 #define MTOUCH_AD_AN2 0x09
00217 #define MTOUCH_AD_AN3 0x0D
00218 #define MTOUCH_AD_AN4 0x11
00219
00220 #if !defined(_16F1933) && !defined(_16LF1933)
00221 #if !defined(_16F1936) && !defined(_16LF1936)
00222 #if !defined(_16F1938) && !defined(_16LF1938)
00223 #define MTOUCH_AD_AN5 0x15
00224 #define MTOUCH_AD_AN6 0x19
00225 #define MTOUCH_AD_AN7 0x1D
00226 #endif
00227 #endif
00228 #endif
00229
00230 #define MTOUCH_AD_AN8 0x21
00231 #define MTOUCH_AD_AN9 0x25
00232 #define MTOUCH_AD_AN10 0x29
00233 #define MTOUCH_AD_AN11 0x2D
00234 #define MTOUCH_AD_AN12 0x31
00235 #define MTOUCH_AD_AN13 0x35
00236 #define MTOUCH_AD_FVR_AND_GO 0x7F
00237 #define MTOUCH_AD_DAC_NOGO 0x79
00238 #define MTOUCH_AD_DAC_AND_GO 0x7B
00239 #define MTOUCH_AD_ISO_AND_GO 0x43
00240 #define MTOUCH_AD_ISO_NOGO 0x41
00241
00242 #define MTOUCH_PIN_AN0 0
00243 #define MTOUCH_PIN_AN1 1
00244 #define MTOUCH_PIN_AN2 2
00245 #define MTOUCH_PIN_AN3 3
00246 #define MTOUCH_PIN_AN4 5
00247 #define MTOUCH_PIN_AN5 0
00248 #define MTOUCH_PIN_AN6 1
00249 #define MTOUCH_PIN_AN7 2
00250 #define MTOUCH_PIN_AN8 2
00251 #define MTOUCH_PIN_AN9 3
00252 #define MTOUCH_PIN_AN10 1
00253 #define MTOUCH_PIN_AN11 4
00254 #define MTOUCH_PIN_AN12 0
00255 #define MTOUCH_PIN_AN13 5
00256
00257 #define MTOUCH_LETTER_AN0 A
00258 #define MTOUCH_LETTER_AN1 A
00259 #define MTOUCH_LETTER_AN2 A
00260 #define MTOUCH_LETTER_AN3 A
00261 #define MTOUCH_LETTER_AN4 A
00262 #define MTOUCH_LETTER_AN5 E
00263 #define MTOUCH_LETTER_AN6 E
00264 #define MTOUCH_LETTER_AN7 E
00265 #define MTOUCH_LETTER_AN8 B
00266 #define MTOUCH_LETTER_AN9 B
00267 #define MTOUCH_LETTER_AN10 B
00268 #define MTOUCH_LETTER_AN11 B
00269 #define MTOUCH_LETTER_AN12 B
00270 #define MTOUCH_LETTER_AN13 B
00271
00272 #endif
00273