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_16F194X_H)
00060 #define __MTOUCH_HARDWARE_16F194X_H
00061
00062 #if !defined(_16F1946) && !defined(_16LF1946)
00063 #if !defined(_16F1947) && !defined(_16LF1947)
00064 #error The current mTouch hardware include file does not support this PIC microcontroller.
00065 #endif
00066 #endif
00067
00068 #if defined(_16F1946) || defined(_16LF1946)
00069 #if MTOUCH_NUMBER_SENSORS > 17
00070 #error The PIC16F/LF1946 is not able to support more than 17 sensors due to pinout limitations.
00071 #endif
00072 #endif
00073 #if defined(_16F1947) || defined(_16LF1947)
00074 #if MTOUCH_NUMBER_SENSORS > 17
00075 #error The PIC16F/LF1947 is not able to support more than 17 sensors due to pinout limitations.
00076 #endif
00077 #endif
00078
00079
00080
00081
00082
00083 #define PIC_UART_AVAILABLE
00084 #define PIC_UART_BAUD_BITS 16
00085
00086 #define PIC_TIMER0_AVAILABLE
00087 #define PIC_TIMER1_AVAILABLE
00088 #define PIC_TIMER2_AVAILABLE
00089 #define PIC_TIMER4_AVAILABLE
00090 #define PIC_TIMER6_AVAILABLE
00091
00092
00093
00094
00095 #define PIC_ADC_BITS 10
00096 #define PIC_ADC_UNIMP_AVAILABLE
00097
00098 #define PIC_ADC_ADCS ADCON1bits.ADCS
00099 #define PIC_ADC_ADFM ADCON1bits.ADFM
00100 #define PIC_ADC_ADON ADCON0bits.ADON
00101
00102 #define PIC_ADC_ADCS_FOSC2 0b000
00103 #define PIC_ADC_ADCS_FOSC4 0b100
00104 #define PIC_ADC_ADCS_FOSC8 0b001
00105 #define PIC_ADC_ADCS_FOSC16 0b101
00106 #define PIC_ADC_ADCS_FOSC32 0b010
00107 #define PIC_ADC_ADCS_FOSC64 0b110
00108 #define PIC_ADC_ADCS_FRC 0b111
00109
00110 #define PIC_ADC_ADFM_RIGHT 1
00111 #define PIC_ADC_ADFM_LEFT 0
00112
00113 #if _XTAL_FREQ == 32000000
00114 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC32
00115 #define PIC_ADC_TAD 1
00116 #elif _XTAL_FREQ == 16000000
00117 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00118 #define PIC_ADC_TAD 1
00119 #elif _XTAL_FREQ == 8000000
00120 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00121 #define PIC_ADC_TAD 1
00122 #elif _XTAL_FREQ == 4000000
00123 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00124 #define PIC_ADC_TAD 1
00125 #elif _XTAL_FREQ == 2000000
00126 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00127 #define PIC_ADC_TAD 1
00128 #elif _XTAL_FREQ == 1000000
00129 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00130 #define PIC_ADC_TAD 2
00131 #else
00132 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00133 #endif
00134
00135
00136
00137
00138
00139 #define PIC_DAC_AVAILABLE
00140 #define PIC_DACOUT_AVAILABLE
00141
00142 #define PIC_DACCON0_VDD 0xC0
00143 #define PIC_DACCON1_VDD 0x1F
00144 #define PIC_DACCON0_VSS 0x80
00145 #define PIC_DACCON1_VSS 0x00
00146
00147 #define PIC_DACOUT_DACCON0_VSS 0xA0
00148 #define PIC_DACOUT_DACCON0_1_3RD_VDD 0xA0
00149 #define PIC_DACOUT_DACCON0_HALF_VDD 0xA0
00150 #define PIC_DACOUT_DACCON0_2_3RD_VDD 0xE0
00151 #define PIC_DACOUT_DACCON0_VDD 0xE0
00152
00153 #define PIC_DACOUT_DACCON1_VSS 0x00
00154 #define PIC_DACOUT_DACCON1_1_3RD_VDD 0x0B
00155 #define PIC_DACOUT_DACCON1_HALF_VDD 0x10
00156 #define PIC_DACOUT_DACCON1_2_3RD_VDD 0x16
00157 #define PIC_DACOUT_DACCON1_VDD 0x1F
00158
00159
00160
00161
00162
00163 #define PIC_SWDTEN_AVAILABLE
00164 #define PIC_SWDTEN_OFF() WDTCONbits.SWDTEN = 0
00165 #define PIC_SWDTEN_ON() WDTCONbits.SWDTEN = 1
00166
00167
00168
00169
00170
00171
00172
00173
00174 #define MTOUCH_AD_AN0 0x01
00175 #define MTOUCH_AD_AN1 0x05
00176 #define MTOUCH_AD_AN2 0x09
00177 #define MTOUCH_AD_AN3 0x0D
00178 #define MTOUCH_AD_AN4 0x11
00179 #define MTOUCH_AD_AN5 0x15
00180 #define MTOUCH_AD_AN6 0x19
00181 #define MTOUCH_AD_AN7 0x1D
00182 #define MTOUCH_AD_AN8 0x21
00183 #define MTOUCH_AD_AN9 0x25
00184 #define MTOUCH_AD_AN10 0x29
00185 #define MTOUCH_AD_AN11 0x2D
00186 #define MTOUCH_AD_AN12 0x31
00187 #define MTOUCH_AD_AN13 0x35
00188 #define MTOUCH_AD_AN14 0x39
00189 #define MTOUCH_AD_AN15 0x3D
00190 #define MTOUCH_AD_AN16 0x41
00191
00192 #define MTOUCH_AD_FVR_AND_GO 0x7F
00193 #define MTOUCH_AD_DAC_AND_GO 0x7B
00194 #define MTOUCH_AD_DAC_NOGO 0x79
00195 #define MTOUCH_AD_ISO_AND_GO 0x47
00196 #define MTOUCH_AD_ISO_NOGO 0x45
00197
00198 #define MTOUCH_PIN_AN0 0
00199 #define MTOUCH_PIN_AN1 1
00200 #define MTOUCH_PIN_AN2 2
00201 #define MTOUCH_PIN_AN3 3
00202 #define MTOUCH_PIN_AN4 5
00203 #define MTOUCH_PIN_AN5 7
00204 #define MTOUCH_PIN_AN6 1
00205 #define MTOUCH_PIN_AN7 2
00206 #define MTOUCH_PIN_AN8 3
00207 #define MTOUCH_PIN_AN9 4
00208 #define MTOUCH_PIN_AN10 5
00209 #define MTOUCH_PIN_AN11 6
00210 #define MTOUCH_PIN_AN12 4
00211 #define MTOUCH_PIN_AN13 3
00212 #define MTOUCH_PIN_AN14 2
00213 #define MTOUCH_PIN_AN15 1
00214 #define MTOUCH_PIN_AN16 0
00215
00216 #define MTOUCH_LETTER_AN0 A
00217 #define MTOUCH_LETTER_AN1 A
00218 #define MTOUCH_LETTER_AN2 A
00219 #define MTOUCH_LETTER_AN3 A
00220 #define MTOUCH_LETTER_AN4 A
00221 #define MTOUCH_LETTER_AN5 F
00222 #define MTOUCH_LETTER_AN6 F
00223 #define MTOUCH_LETTER_AN7 F
00224 #define MTOUCH_LETTER_AN8 F
00225 #define MTOUCH_LETTER_AN9 F
00226 #define MTOUCH_LETTER_AN10 F
00227 #define MTOUCH_LETTER_AN11 F
00228 #define MTOUCH_LETTER_AN12 G
00229 #define MTOUCH_LETTER_AN13 G
00230 #define MTOUCH_LETTER_AN14 G
00231 #define MTOUCH_LETTER_AN15 G
00232 #define MTOUCH_LETTER_AN16 F
00233
00234
00235
00236 #endif
00237
00238