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_16F68X_H)
00060 #define __MTOUCH_HARDWARE_16F68X_H
00061
00062 #if !defined(_16F677)
00063 #if !defined(_16F685)
00064 #if !defined(_16F687)
00065 #if !defined(_16F688)
00066 #if !defined(_16F689)
00067 #if !defined(_16F690)
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(_16F688)
00077 #if MTOUCH_NUMBER_SENSORS > 8
00078 #error The current mTouch microcontroller is not able to support more than 8 sensors on the mTouch Framework due to pinout limitations.
00079 #endif
00080 #else
00081 #if MTOUCH_NUMBER_SENSORS > 12
00082 #error The current mTouch microcontroller is not able to support more than 12 sensors on the mTouch Framework due to pinout limitations.
00083 #endif
00084 #endif
00085
00086
00087
00088
00089 #define MTOUCH_USE_PORT
00090
00091
00092
00093
00094
00095 #define PIC_UART_AVAILABLE
00096 #define PIC_UART_BAUD_BITS 16
00097
00098 #define PIC_TIMER0_AVAILABLE
00099 #define PIC_TIMER1_AVAILABLE
00100 #if !defined(_16F688)
00101 #define PIC_TIMER2_AVAILABLE
00102 #endif
00103
00104 #define TMR0IF T0IF
00105 #define TMR0IE T0IE
00106
00107
00108
00109
00110
00111 #define PIC_ADC_BITS 10
00112
00113 #if !defined(_16F688)
00114 #define PIC_ADC_UNIMP_AVAILABLE
00115 #endif
00116
00117 #define PIC_ADC_ADCS ADCON1bits.ADCS
00118 #define PIC_ADC_ADFM ADCON0bits.ADFM
00119 #define PIC_ADC_ADON ADCON0bits.ADON
00120
00121 #define PIC_ADC_ADCS_FOSC2 0b000
00122 #define PIC_ADC_ADCS_FOSC4 0b100
00123 #define PIC_ADC_ADCS_FOSC8 0b001
00124 #define PIC_ADC_ADCS_FOSC16 0b101
00125 #define PIC_ADC_ADCS_FOSC32 0b010
00126 #define PIC_ADC_ADCS_FOSC64 0b110
00127 #define PIC_ADC_ADCS_FRC 0b111
00128
00129 #define PIC_ADC_ADFM_RIGHT 1
00130 #define PIC_ADC_ADFM_LEFT 0
00131
00132 #if _XTAL_FREQ == 8000000
00133 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00134 #define PIC_ADC_TAD 2
00135 #elif _XTAL_FREQ == 4000000
00136 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00137 #define PIC_ADC_TAD 2
00138 #elif _XTAL_FREQ == 1000000
00139 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00140 #define PIC_ADC_TAD 2
00141 #else
00142 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00143 #endif
00144
00145
00146
00147
00148
00149 #if !defined(_16F688)
00150 #define PIC_VRCON_BANK 2
00151 #define PIC_VRCON_MAX 0x8F
00152 #define PIC_VRCON_MIN 0xA0
00153 #endif
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 #define MTOUCH_AD_AN0 0x81
00169 #define MTOUCH_AD_AN1 0x85
00170 #define MTOUCH_AD_AN2 0x89
00171 #define MTOUCH_AD_AN3 0x8D
00172 #define MTOUCH_AD_AN4 0x91
00173 #define MTOUCH_AD_AN5 0x95
00174 #define MTOUCH_AD_AN6 0x99
00175 #define MTOUCH_AD_AN7 0x9D
00176
00177 #if !defined(_16F688)
00178 #define MTOUCH_AD_AN8 0xA1
00179 #define MTOUCH_AD_AN9 0xA5
00180 #define MTOUCH_AD_AN10 0xA9
00181 #define MTOUCH_AD_AN11 0xAD
00182 #define MTOUCH_AD_DAC_NOGO 0xB1
00183 #define MTOUCH_AD_DAC_AND_GO 0xB3
00184 #define MTOUCH_AD_ISO_NOGO 0xBD
00185 #define MTOUCH_AD_ISO_AND_GO 0xBF
00186 #endif
00187
00188 #define MTOUCH_PIN_AN0 0
00189 #define MTOUCH_PIN_AN1 1
00190 #define MTOUCH_PIN_AN2 2
00191 #define MTOUCH_PIN_AN3 4
00192 #define MTOUCH_PIN_AN4 0
00193 #define MTOUCH_PIN_AN5 1
00194 #define MTOUCH_PIN_AN6 2
00195 #define MTOUCH_PIN_AN7 3
00196 #define MTOUCH_PIN_AN8 6
00197 #define MTOUCH_PIN_AN9 7
00198 #define MTOUCH_PIN_AN10 4
00199 #define MTOUCH_PIN_AN11 5
00200
00201 #define MTOUCH_LETTER_AN0 A
00202 #define MTOUCH_LETTER_AN1 A
00203 #define MTOUCH_LETTER_AN2 A
00204 #define MTOUCH_LETTER_AN3 A
00205 #define MTOUCH_LETTER_AN4 C
00206 #define MTOUCH_LETTER_AN5 C
00207 #define MTOUCH_LETTER_AN6 C
00208 #define MTOUCH_LETTER_AN7 C
00209 #define MTOUCH_LETTER_AN8 C
00210 #define MTOUCH_LETTER_AN9 C
00211 #define MTOUCH_LETTER_AN10 B
00212 #define MTOUCH_LETTER_AN11 B
00213
00214 #endif
00215