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_16F88X_H)
00060 #define __MTOUCH_HARDWARE_16F88X_H
00061
00062 #if !defined(_16F882)
00063 #if !defined(_16F883)
00064 #if !defined(_16F884)
00065 #if !defined(_16F886)
00066 #if !defined(_16F887)
00067 #error The current mTouch hardware include file does not support this PIC microcontroller.
00068 #endif
00069 #endif
00070 #endif
00071 #endif
00072 #endif
00073
00074 #if defined(_16F882) || defined(_16F883) || defined(_16F886)
00075 #if MTOUCH_NUMBER_SENSORS > 11
00076 #error The current mTouch microcontroller is not able to support more than 11 sensors on the mTouch Framework due to pinout limitations.
00077 #endif
00078 #else
00079 #if MTOUCH_NUMBER_SENSORS > 14
00080 #error The current mTouch microcontroller is not able to support more than 14 sensors on the mTouch Framework due to pinout limitations.
00081 #endif
00082 #endif
00083
00084
00085
00086
00087 #define MTOUCH_USE_PORT
00088
00089
00090
00091
00092 #define PIC_UART_AVAILABLE
00093 #define PIC_UART_BAUD_BITS 16
00094
00095 #define PIC_TIMER0_AVAILABLE
00096 #define PIC_TIMER1_AVAILABLE
00097 #define PIC_TIMER2_AVAILABLE
00098
00099
00100
00101
00102 #define PIC_ADC_BITS 10
00103
00104 #if defined(_16F882) || defined(_16F883) || defined(_16F886)
00105 #define PIC_ADC_UNIMP_AVAILABLE
00106 #endif
00107
00108 #define PIC_ADC_ADCS ADCON0bits.ADCS
00109 #define PIC_ADC_ADFM ADCON1bits.ADFM
00110 #define PIC_ADC_ADON ADCON0bits.ADON
00111
00112 #define PIC_ADC_ADCS_FOSC2 0b00
00113 #define PIC_ADC_ADCS_FOSC8 0b01
00114 #define PIC_ADC_ADCS_FOSC32 0b10
00115 #define PIC_ADC_ADCS_FRC 0b11
00116
00117 #define PIC_ADC_ADFM_RIGHT 1
00118 #define PIC_ADC_ADFM_LEFT 0
00119
00120 #define PIC_ADC_CLK_MASK 0x00
00121 #if _XTAL_FREQ == 8000000
00122 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00123 #define PIC_ADC_TAD 1
00124 #undef PIC_ADC_CLK_MASK
00125 #define PIC_ADC_CLK_MASK 0x40
00126 #elif _XTAL_FREQ == 4000000
00127 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00128 #define PIC_ADC_TAD 2
00129 #undef PIC_ADC_CLK_MASK
00130 #define PIC_ADC_CLK_MASK 0x40
00131 #elif _XTAL_FREQ == 1000000
00132 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00133 #define PIC_ADC_TAD 2
00134 #undef PIC_ADC_CLK_MASK
00135 #define PIC_ADC_CLK_MASK 0x00
00136 #else
00137 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00138 #endif
00139
00140
00141
00142
00143
00144
00145
00146 #define PIC_VRCON_BANK 1
00147 #define PIC_VRCON_MAX 0x8F
00148 #define PIC_VRCON_MIN 0xA0
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 #define MTOUCH_AD_AN0 0x01 | PIC_ADC_CLK_MASK
00165 #define MTOUCH_AD_AN1 0x05 | PIC_ADC_CLK_MASK
00166 #define MTOUCH_AD_AN2 0x09 | PIC_ADC_CLK_MASK
00167 #define MTOUCH_AD_AN3 0x0D | PIC_ADC_CLK_MASK
00168 #define MTOUCH_AD_AN4 0x11 | PIC_ADC_CLK_MASK
00169
00170 #if defined(_16F884) || defined(_16F887)
00171 #define MTOUCH_AD_AN5 0x15 | PIC_ADC_CLK_MASK
00172 #define MTOUCH_AD_AN6 0x19 | PIC_ADC_CLK_MASK
00173 #define MTOUCH_AD_AN7 0x1D | PIC_ADC_CLK_MASK
00174 #endif
00175
00176 #define MTOUCH_AD_AN8 0x21 | PIC_ADC_CLK_MASK
00177 #define MTOUCH_AD_AN9 0x25 | PIC_ADC_CLK_MASK
00178 #define MTOUCH_AD_AN10 0x29 | PIC_ADC_CLK_MASK
00179 #define MTOUCH_AD_AN11 0x2D | PIC_ADC_CLK_MASK
00180 #define MTOUCH_AD_AN12 0x31 | PIC_ADC_CLK_MASK
00181 #define MTOUCH_AD_AN13 0x35 | PIC_ADC_CLK_MASK
00182 #define MTOUCH_AD_DAC_NOGO 0x39 | PIC_ADC_CLK_MASK
00183 #define MTOUCH_AD_DAC_AND_GO 0x3B | PIC_ADC_CLK_MASK
00184
00185 #if defined(_16F882) || defined(_16F883) || defined(_16F886)
00186 #define MTOUCH_AD_ISO_NOGO 0x15 | PIC_ADC_CLK_MASK
00187 #define MTOUCH_AD_ISO_AND_GO 0x17 | PIC_ADC_CLK_MASK
00188 #endif
00189
00190 #define MTOUCH_PIN_AN0 0
00191 #define MTOUCH_PIN_AN1 1
00192 #define MTOUCH_PIN_AN2 2
00193 #define MTOUCH_PIN_AN3 3
00194 #define MTOUCH_PIN_AN4 5
00195 #define MTOUCH_PIN_AN5 0
00196 #define MTOUCH_PIN_AN6 1
00197 #define MTOUCH_PIN_AN7 2
00198 #define MTOUCH_PIN_AN8 2
00199 #define MTOUCH_PIN_AN9 3
00200 #define MTOUCH_PIN_AN10 1
00201 #define MTOUCH_PIN_AN11 4
00202 #define MTOUCH_PIN_AN12 0
00203 #define MTOUCH_PIN_AN13 5
00204
00205 #define MTOUCH_LETTER_AN0 A
00206 #define MTOUCH_LETTER_AN1 A
00207 #define MTOUCH_LETTER_AN2 A
00208 #define MTOUCH_LETTER_AN3 A
00209 #define MTOUCH_LETTER_AN4 A
00210 #define MTOUCH_LETTER_AN5 E
00211 #define MTOUCH_LETTER_AN6 E
00212 #define MTOUCH_LETTER_AN7 E
00213 #define MTOUCH_LETTER_AN8 B
00214 #define MTOUCH_LETTER_AN9 B
00215 #define MTOUCH_LETTER_AN10 B
00216 #define MTOUCH_LETTER_AN11 B
00217 #define MTOUCH_LETTER_AN12 B
00218 #define MTOUCH_LETTER_AN13 B
00219
00220 #endif
00221