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_12F184X_H)
00060 #define __MTOUCH_HARDWARE_12F184X_H
00061
00062 #if !defined(_12F1840) && !defined(_12LF1840)
00063 #error The current mTouch hardware include file does not support this PIC microcontroller.
00064 #endif
00065
00066 #if defined(_12F1840) || defined(_12LF1840)
00067 #if MTOUCH_NUMBER_SENSORS > 4
00068 #error The PIC12F/LF1840 is not able to support more than 4 sensors due to pinout limitations.
00069 #endif
00070 #if MTOUCH_NUMBER_OF_SLEEP_SENSORS > 4
00071 #error The PIC12F/LF1840 is not able to support more than 4 sleep-mode sensors due to pinout limitations.
00072 #endif
00073 #endif
00074
00075 #if ((MTOUCH_COMM_TYPE == MTOUCH_COMM_RS232_1WAY_ASCII) && !defined(MTOUCH_COMM_ASCII_SOFT_ENABLED)) || (MTOUCH_COMM_TYPE == MTOUCH_COMM_RS232_2WAY_BINARY)
00076 #if !defined(APFCON_INITIALIZED)
00077 #warning The mTouch comm module does not automatically set the APFCON# register. The TX pin may be selectable. This warning can be removed by defining the precompiler variable 'APFCON_INITIALIZED' in the mTouch_config.h file - verifying that you've initialized this register.
00078 #endif
00079 #endif
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 #define PIC_UART_AVAILABLE
00090 #define PIC_UART_BAUD_BITS 16
00091
00092 #define PIC_TIMER0_AVAILABLE
00093 #define PIC_TIMER1_AVAILABLE
00094 #define PIC_TIMER2_AVAILABLE
00095
00096
00097
00098
00099 #define PIC_ADC_BITS 10
00100 #define PIC_ADC_UNIMP_AVAILABLE
00101
00102 #define PIC_ADC_ADCS ADCON1bits.ADCS
00103 #define PIC_ADC_ADFM ADCON1bits.ADFM
00104 #define PIC_ADC_ADON ADCON0bits.ADON
00105
00106 #define PIC_ADC_ADCS_FOSC2 0b000
00107 #define PIC_ADC_ADCS_FOSC4 0b100
00108 #define PIC_ADC_ADCS_FOSC8 0b001
00109 #define PIC_ADC_ADCS_FOSC16 0b101
00110 #define PIC_ADC_ADCS_FOSC32 0b010
00111 #define PIC_ADC_ADCS_FOSC64 0b110
00112 #define PIC_ADC_ADCS_FRC 0b111
00113
00114 #define PIC_ADC_ADFM_RIGHT 1
00115 #define PIC_ADC_ADFM_LEFT 0
00116
00117 #if _XTAL_FREQ == 32000000
00118 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC32
00119 #define PIC_ADC_TAD 1
00120 #elif _XTAL_FREQ == 16000000
00121 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC16
00122 #define PIC_ADC_TAD 1
00123 #elif _XTAL_FREQ == 8000000
00124 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC8
00125 #define PIC_ADC_TAD 1
00126 #elif _XTAL_FREQ == 4000000
00127 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC4
00128 #define PIC_ADC_TAD 1
00129 #elif _XTAL_FREQ == 2000000
00130 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00131 #define PIC_ADC_TAD 1
00132 #elif _XTAL_FREQ == 1000000
00133 #define PIC_ADC_SETCLK() PIC_ADC_ADCS = PIC_ADC_ADCS_FOSC2
00134 #define PIC_ADC_TAD 2
00135 #else
00136 #error No predefined ADC clock values for the chosen _XTAL_FREQ.
00137 #endif
00138
00139
00140
00141
00142
00143 #define PIC_DAC_AVAILABLE
00144 #define PIC_DACOUT_AVAILABLE
00145
00146 #define PIC_DACOUT_TRIS_C TRISA0
00147 #define PIC_DACOUT_LAT_C LATA0
00148 #define PIC_DACOUT_LAT_ASM _LATA
00149 #define PIC_DACOUT_PIN 0
00150
00151 #define PIC_DACCON0_VDD 0xC0
00152 #define PIC_DACCON1_VDD 0x1F
00153 #define PIC_DACCON0_VSS 0x80
00154 #define PIC_DACCON1_VSS 0x00
00155
00156 #define PIC_DACOUT_DACCON0_VSS 0xA0
00157 #define PIC_DACOUT_DACCON0_1_3RD_VDD 0xA0
00158 #define PIC_DACOUT_DACCON0_HALF_VDD 0xA0
00159 #define PIC_DACOUT_DACCON0_2_3RD_VDD 0xE0
00160 #define PIC_DACOUT_DACCON0_VDD 0xE0
00161
00162 #define PIC_DACOUT_DACCON1_VSS 0x00
00163 #define PIC_DACOUT_DACCON1_1_3RD_VDD 0x0B
00164 #define PIC_DACOUT_DACCON1_HALF_VDD 0x10
00165 #define PIC_DACOUT_DACCON1_2_3RD_VDD 0x16
00166 #define PIC_DACOUT_DACCON1_VDD 0x1F
00167
00168
00169
00170
00171 #define PIC_SWDTEN_AVAILABLE
00172 #define PIC_SWDTEN_OFF() WDTCONbits.SWDTEN = 0
00173 #define PIC_SWDTEN_ON() WDTCONbits.SWDTEN = 1
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 #define MTOUCH_AD_AN0 0x01
00185 #define MTOUCH_AD_AN1 0x05
00186 #define MTOUCH_AD_AN2 0x09
00187 #define MTOUCH_AD_AN3 0x0D
00188
00189 #define MTOUCH_AD_FVR_AND_GO 0x7F
00190 #define MTOUCH_AD_DAC_AND_GO 0x7B
00191 #define MTOUCH_AD_DAC_NOGO 0x79
00192 #define MTOUCH_AD_ISO_AND_GO 0x43
00193 #define MTOUCH_AD_ISO_NOGO 0x41
00194
00195 #define MTOUCH_PIN_AN0 0
00196 #define MTOUCH_PIN_AN1 1
00197 #define MTOUCH_PIN_AN2 2
00198 #define MTOUCH_PIN_AN3 4
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
00205
00206 #endif
00207
00208