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_16F72X_H)
00060 #define __MTOUCH_HARDWARE_16F72X_H
00061
00062 #if !defined(_16F722 ) && !defined(_16LF722 )
00063 #if !defined(_16F722A) && !defined(_16LF722A)
00064 #if !defined(_16F723 ) && !defined(_16LF723 )
00065 #if !defined(_16F723A) && !defined(_16LF723A)
00066 #if !defined(_16F724 ) && !defined(_16LF724 )
00067 #if !defined(_16F726 ) && !defined(_16LF726 )
00068 #if !defined(_16F727 ) && !defined(_16LF727 )
00069 #error The current mTouch hardware include file does not support this PIC microcontroller.
00070 #endif
00071 #endif
00072 #endif
00073 #endif
00074 #endif
00075 #endif
00076 #endif
00077
00078 #if defined(_16F720) || defined(_16LF720) || defined(_16F721) || defined(_16LF721)
00079 #if MTOUCH_NUMBER_SENSORS > 12
00080 #error The current mTouch microcontroller is not able to support more than 12 sensors due to pinout limitations.
00081 #endif
00082 #endif
00083 #if defined(_16F722) || defined(_16LF722) || defined(_16F722A) || defined(_16LF722A) || defined(_16F723) || defined(_16LF723) || defined(_16F723A) || defined(_16LF723A) || defined(_16F726) || defined(_16LF726)
00084 #if MTOUCH_NUMBER_SENSORS > 11
00085 #error The current mTouch microcontroller is not able to support more than 11 sensors due to pinout limitations.
00086 #endif
00087 #endif
00088 #if defined(_16F724) || defined(_16LF724) || defined(_16F727) || defined(_16LF727)
00089 #if MTOUCH_NUMBER_SENSORS > 14
00090 #error The current mTouch microcontroller is not able to support more than 14 sensors due to pinout limitations.
00091 #endif
00092 #endif
00093
00094
00095
00096
00097 #define MTOUCH_USE_PORT
00098
00099
00100
00101
00102 #define PIC_UART_AVAILABLE
00103 #define PIC_UART_BAUD_BITS 8
00104
00105
00106 #define PIC_TIMER0_AVAILABLE
00107 #define PIC_TIMER1_AVAILABLE
00108 #define PIC_TIMER2_AVAILABLE
00109
00110
00111
00112
00113
00114 #define PIC_ADC_BITS 8
00115
00116 #if !defined(_16F720) && !defined(_16LF720) && !defined(_16F721) && !defined(_16LF721)
00117 #define PIC_ADC_UNIMP_AVAILABLE
00118 #endif
00119
00120 #define PIC_ADC_ADCS ADCON1bits.ADCS
00121 #define PIC_ADC_ADON ADCON0bits.ADON
00122
00123 #define PIC_ADC_ADCS_FOSC2 0b000
00124 #define PIC_ADC_ADCS_FOSC4 0b100
00125 #define PIC_ADC_ADCS_FOSC8 0b001
00126 #define PIC_ADC_ADCS_FOSC16 0b101
00127 #define PIC_ADC_ADCS_FOSC32 0b010
00128 #define PIC_ADC_ADCS_FOSC64 0b110
00129 #define PIC_ADC_ADCS_FRC 0b111
00130
00131 #if _XTAL_FREQ == 16000000
00132 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00133 #define CVD_TAD 1
00134 #elif _XTAL_FREQ == 8000000
00135 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00136 #define PIC_ADC_TAD 1
00137 #elif _XTAL_FREQ == 4000000
00138 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00139 #define PIC_ADC_TAD 1
00140 #elif _XTAL_FREQ == 1000000
00141 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00142 #define PIC_ADC_TAD 2
00143 #else
00144 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00145 #endif
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 #define MTOUCH_AD_AN0 0x01
00166 #define MTOUCH_AD_AN1 0x05
00167 #define MTOUCH_AD_AN2 0x09
00168 #define MTOUCH_AD_AN3 0x0D
00169 #define MTOUCH_AD_AN4 0x11
00170
00171 #if defined(_16F720) || defined(_16LF720) || \
00172 defined(_16F721) || defined(_16LF721) || \
00173 defined(_16F724) || defined(_16LF724) || \
00174 defined(_16F727) || defined(_16LF727)
00175
00176 #define MTOUCH_AD_AN5 0x15
00177 #define MTOUCH_AD_AN6 0x19
00178 #define MTOUCH_AD_AN7 0x1D
00179 #endif
00180
00181 #define MTOUCH_AD_AN8 0x21
00182 #define MTOUCH_AD_AN9 0x25
00183 #define MTOUCH_AD_AN10 0x29
00184 #define MTOUCH_AD_AN11 0x2D
00185
00186 #if !defined(_16F720) && !defined(_16LF720) && \
00187 !defined(_16F721) && !defined(_16LF721)
00188
00189 #define MTOUCH_AD_AN12 0x31
00190 #define MTOUCH_AD_AN13 0x35
00191 #define MTOUCH_AD_ISO_NOGO 0x39
00192 #define MTOUCH_AD_ISO_AND_GO 0x3B
00193 #endif
00194
00195 #if defined(_16F720) || defined(_16LF720) || \
00196 defined(_16F721) || defined(_16LF721)
00197
00198 #define MTOUCH_PIN_AN0 0
00199 #define MTOUCH_PIN_AN1 1
00200 #define MTOUCH_PIN_AN2 2
00201 #define MTOUCH_PIN_AN3 4
00202 #define MTOUCH_PIN_AN4 0
00203 #define MTOUCH_PIN_AN5 1
00204 #define MTOUCH_PIN_AN6 2
00205 #define MTOUCH_PIN_AN7 3
00206 #define MTOUCH_PIN_AN8 6
00207 #define MTOUCH_PIN_AN9 7
00208 #define MTOUCH_PIN_AN10 4
00209 #define MTOUCH_PIN_AN11 5
00210
00211 #define MTOUCH_LETTER_AN0 A
00212 #define MTOUCH_LETTER_AN1 A
00213 #define MTOUCH_LETTER_AN2 A
00214 #define MTOUCH_LETTER_AN3 A
00215 #define MTOUCH_LETTER_AN4 C
00216 #define MTOUCH_LETTER_AN5 C
00217 #define MTOUCH_LETTER_AN6 C
00218 #define MTOUCH_LETTER_AN7 C
00219 #define MTOUCH_LETTER_AN8 C
00220 #define MTOUCH_LETTER_AN9 C
00221 #define MTOUCH_LETTER_AN10 B
00222 #define MTOUCH_LETTER_AN11 B
00223 #else
00224 #define MTOUCH_PIN_AN0 0
00225 #define MTOUCH_PIN_AN1 1
00226 #define MTOUCH_PIN_AN2 2
00227 #define MTOUCH_PIN_AN3 3
00228 #define MTOUCH_PIN_AN4 5
00229 #define MTOUCH_PIN_AN5 0
00230 #define MTOUCH_PIN_AN6 1
00231 #define MTOUCH_PIN_AN7 2
00232 #define MTOUCH_PIN_AN8 2
00233 #define MTOUCH_PIN_AN9 3
00234 #define MTOUCH_PIN_AN10 1
00235 #define MTOUCH_PIN_AN11 4
00236 #define MTOUCH_PIN_AN12 0
00237 #define MTOUCH_PIN_AN13 5
00238
00239 #define MTOUCH_LETTER_AN0 A
00240 #define MTOUCH_LETTER_AN1 A
00241 #define MTOUCH_LETTER_AN2 A
00242 #define MTOUCH_LETTER_AN3 A
00243 #define MTOUCH_LETTER_AN4 A
00244 #define MTOUCH_LETTER_AN5 E
00245 #define MTOUCH_LETTER_AN6 E
00246 #define MTOUCH_LETTER_AN7 E
00247 #define MTOUCH_LETTER_AN8 B
00248 #define MTOUCH_LETTER_AN9 B
00249 #define MTOUCH_LETTER_AN10 B
00250 #define MTOUCH_LETTER_AN11 B
00251 #define MTOUCH_LETTER_AN12 B
00252 #define MTOUCH_LETTER_AN13 B
00253 #endif
00254
00255
00256
00257 #endif
00258