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_16F150X_H)
00060 #define __MTOUCH_HARDWARE_16F150X_H
00061
00062 #if !defined(_16F1503) && !defined(_16LF1503)
00063 #if !defined(_16F1507) && !defined(_16LF1507)
00064 #if !defined(_16F1508) && !defined(_16LF1508)
00065 #if !defined(_16F1509) && !defined(_16LF1509)
00066 #error The current mTouch hardware include file does not support this PIC microcontroller.
00067 #endif
00068 #endif
00069 #endif
00070 #endif
00071
00072 #if defined(_16F1503) || defined(_16LF1503)
00073 #if MTOUCH_NUMBER_SENSORS > 8
00074 #error The PIC16F/LF1503 is not able to support more than 8 sensors due to pinout limitations.
00075 #endif
00076 #endif
00077 #if defined(_16F1507) || defined(_16LF1507)
00078 #if MTOUCH_NUMBER_SENSORS > 12
00079 #error The PIC16F/LF1507 is not able to support more than 12 sensors due to pinout limitations.
00080 #endif
00081 #endif
00082 #if defined(_16F1508) || defined(_16LF1508)
00083 #if MTOUCH_NUMBER_SENSORS > 12
00084 #error The PIC16F/LF1508 is not able to support more than 12 sensors due to pinout limitations.
00085 #endif
00086 #endif
00087 #if defined(_16F1509) || defined(_16LF1509)
00088 #if MTOUCH_NUMBER_SENSORS > 12
00089 #error The PIC16F/LF1509 is not able to support more than 12 sensors due to pinout limitations.
00090 #endif
00091 #endif
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #define PIC_TIMER0_AVAILABLE
00103 #define PIC_TIMER1_AVAILABLE
00104 #define PIC_TIMER2_AVAILABLE
00105
00106
00107
00108
00109 #define PIC_ADC_BITS 10
00110 #define PIC_ADC_UNIMP_AVAILABLE
00111
00112 #define PIC_ADC_ADCS ADCON1bits.ADCS
00113 #define PIC_ADC_ADFM ADCON1bits.ADFM
00114 #define PIC_ADC_ADON ADCON0bits.ADON
00115
00116 #define PIC_ADC_ADCS_FOSC2 0b000
00117 #define PIC_ADC_ADCS_FOSC4 0b100
00118 #define PIC_ADC_ADCS_FOSC8 0b001
00119 #define PIC_ADC_ADCS_FOSC16 0b101
00120 #define PIC_ADC_ADCS_FOSC32 0b010
00121 #define PIC_ADC_ADCS_FOSC64 0b110
00122 #define PIC_ADC_ADCS_FRC 0b111
00123
00124 #define PIC_ADC_ADFM_RIGHT 1
00125 #define PIC_ADC_ADFM_LEFT 0
00126
00127 #if _XTAL_FREQ == 16000000
00128 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00129 #define PIC_ADC_TAD 1
00130 #elif _XTAL_FREQ == 8000000
00131 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00132 #define PIC_ADC_TAD 1
00133 #elif _XTAL_FREQ == 4000000
00134 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00135 #define PIC_ADC_TAD 1
00136 #elif _XTAL_FREQ == 2000000
00137 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00138 #define PIC_ADC_TAD 1
00139 #elif _XTAL_FREQ == 1000000
00140 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00141 #define PIC_ADC_TAD 2
00142 #else
00143 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00144 #endif
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 #define PIC_SWDTEN_AVAILABLE
00156 #define PIC_SWDTEN_OFF() WDTCONbits.SWDTEN = 0
00157 #define PIC_SWDTEN_ON() WDTCONbits.SWDTEN = 1
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 #define MTOUCH_AD_AN0 0x01
00169 #define MTOUCH_AD_AN1 0x05
00170 #define MTOUCH_AD_AN2 0x09
00171 #define MTOUCH_AD_AN3 0x0D
00172 #define MTOUCH_AD_AN4 0x11
00173 #define MTOUCH_AD_AN5 0x15
00174 #define MTOUCH_AD_AN6 0x19
00175 #define MTOUCH_AD_AN7 0x1D
00176
00177 #if !defined(_16F1503) && !defined(_16LF1503)
00178 #define MTOUCH_AD_AN8 0x21
00179 #define MTOUCH_AD_AN9 0x25
00180 #define MTOUCH_AD_AN10 0x29
00181 #define MTOUCH_AD_AN11 0x2D
00182 #endif
00183
00184 #define MTOUCH_AD_ISO_AND_GO 0x33
00185 #define MTOUCH_AD_ISO_NOGO 0x31
00186
00187 #define MTOUCH_PIN_AN0 0
00188 #define MTOUCH_PIN_AN1 1
00189 #define MTOUCH_PIN_AN2 2
00190 #define MTOUCH_PIN_AN3 4
00191 #define MTOUCH_PIN_AN4 0
00192 #define MTOUCH_PIN_AN5 1
00193 #define MTOUCH_PIN_AN6 2
00194 #define MTOUCH_PIN_AN7 3
00195 #define MTOUCH_PIN_AN8 6
00196 #define MTOUCH_PIN_AN9 7
00197 #define MTOUCH_PIN_AN10 4
00198 #define MTOUCH_PIN_AN11 5
00199
00200 #define MTOUCH_LETTER_AN0 A
00201 #define MTOUCH_LETTER_AN1 A
00202 #define MTOUCH_LETTER_AN2 A
00203 #define MTOUCH_LETTER_AN3 A
00204 #define MTOUCH_LETTER_AN4 C
00205 #define MTOUCH_LETTER_AN5 C
00206 #define MTOUCH_LETTER_AN6 C
00207 #define MTOUCH_LETTER_AN7 C
00208 #define MTOUCH_LETTER_AN8 C
00209 #define MTOUCH_LETTER_AN9 C
00210 #define MTOUCH_LETTER_AN10 B
00211 #define MTOUCH_LETTER_AN11 B
00212
00213
00214 #endif
00215
00216