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(__MTOUCHCVD_HARDWARE_12F61X_H)
00060 #define __MTOUCHCVD_HARDWARE_12F61X_H
00061
00062 #if !defined(_12F615) && !defined(_12HV615)
00063 #if !defined(_12F617)
00064 #error The current mTouch hardware include file does not support this PIC microcontroller.
00065 #endif
00066 #endif
00067
00068 #if defined(_12F615) || defined(_12HV615)
00069 #if CVD_NUMBER_SENSORS > 2
00070 #error The PIC12F/HV615 is not able to support more than 2 sensors on the mTouch Framework due to memory limitations.
00071 #endif
00072 #if defined(CVD_DEBUG) && (CVD_DEBUG == 1)
00073 #error The PIC12F/HV615 is not able to support debug communications at this time.
00074 #endif
00075 #endif
00076 #if defined(_12F617)
00077 #if CVD_NUMBER_SENSORS > 4
00078 #error The PIC12F617 is not able to support more than 4 sensors due to pinout limitations.
00079 #endif
00080 #endif
00081
00082
00083
00084
00085 #define CVD_DEBUG_COMM_INIT() \
00086 do { \
00087 } while (0)
00088
00089 #define CVD_DEBUG_COMM_TXIF TXIF
00090 #define CVD_DEBUG_COMM_TXREG TXREG
00091
00092 #define CVD_SET_TMR0IE() TMR0IE = 1
00093 #define CVD_SET_GIE() GIE = 1
00094
00095 #define CVD_SET_ADC_CLK_8MHZ() ANSEL = 0b01010000 // 16
00096 #define CVD_SET_ADC_CLK_4MHZ() ANSEL = 0b00010000 // 8
00097 #define CVD_SET_ADC_CLK_1MHZ() ANSEL = 0b00000000 // 2
00098
00099 #if defined(CVD_DEBUG) && (CVD_DEBUG == 1)
00100 #if !(CVD_DEBUG_SPEED == 9600 || CVD_DEBUG_SPEED == 115200)
00101 #error CVD_DEBUG_SPEED must be set to either 9600 or 115200 in the configuration file.
00102 #endif
00103 #endif
00104
00105 #if _XTAL_FREQ == 8000000
00106 #define CVD_SET_ADC_CLK() CVD_SET_ADC_CLK_8MHZ()
00107 #define CVD_TAD 2
00108 #elif _XTAL_FREQ == 4000000
00109 #define CVD_SET_ADC_CLK() CVD_SET_ADC_CLK_4MHZ()
00110 #define CVD_TAD 2
00111 #elif _XTAL_FREQ == 1000000
00112 #define CVD_SET_ADC_CLK() CVD_SET_ADC_CLK_1MHZ()
00113 #define CVD_TAD 2
00114 #else
00115 #error Chosen Fosc frequency is not supported by the mTouch framework on this device.
00116 #endif
00117
00118 #define CVD_ADCON0_BANK 0
00119 #define CVD_VRCON_BANK 0
00120 #define CVD_UNIMPLEMENTED_AVAILABLE 1
00121 #define CVD_VRCON_MAX 0x8F
00122 #define CVD_VRCON_MIN 0xB0
00123
00124
00125
00126 #define CVD_AD_AN0 0x81
00127 #define CVD_AD_AN1 0x85
00128 #define CVD_AD_AN2 0x89
00129 #define CVD_AD_AN3 0x8D
00130
00131 #define CVD_AD_CVREF_NOGO 0x91
00132 #define CVD_AD_CVREF_AND_GO 0x93
00133 #define CVD_AD_ISO_AND_GO 0x9F // Selects an unimplemented, isolated ADC mux option and sets the GO/DONE bit.
00134 #define CVD_AD_ISO_NOGO 0x9D // Selects an unimplemented, isolated ADC mux option w/o setting the GO/DONE bit.
00135
00136 #define CVD_SELECT_SENSOR0 __paste(CVD_AD_, CVD_SENSOR0)
00137 #define CVD_SELECT_SENSOR1 __paste(CVD_AD_, CVD_SENSOR1)
00138 #define CVD_SELECT_SENSOR2 __paste(CVD_AD_, CVD_SENSOR2)
00139 #define CVD_SELECT_SENSOR3 __paste(CVD_AD_, CVD_SENSOR3)
00140 #define CVD_SELECT_CVREF_AND_GO __paste(CVD_AD_, CVREF_AND_GO)
00141 #define CVD_SELECT_CVREF_NOGO __paste(CVD_AD_, CVREF_NOGO)
00142 #define CVD_SELECT_ISO_AND_GO __paste(CVD_AD_, ISO_AND_GO)
00143 #define CVD_SELECT_ISO_NOGO __paste(CVD_AD_, ISO_NOGO)
00144 #define CVD_SELECT_REFERENCE __paste(CVD_AD_, CVD_REFERENCE)
00145
00146 #define CVD_PIN_AN0 0
00147 #define CVD_PIN_AN1 1
00148 #define CVD_PIN_AN2 2
00149 #define CVD_PIN_AN3 4
00150
00151 #define CVD_PIN_SENSOR0 __paste(CVD_PIN_,CVD_SENSOR0)
00152 #define CVD_PIN_SENSOR1 __paste(CVD_PIN_,CVD_SENSOR1)
00153 #define CVD_PIN_SENSOR2 __paste(CVD_PIN_,CVD_SENSOR2)
00154 #define CVD_PIN_SENSOR3 __paste(CVD_PIN_,CVD_SENSOR3)
00155 #define CVD_PIN_REFERENCE __paste(CVD_PIN_,CVD_REFERENCE)
00156
00157 #define CVD_PORT_AN0 _GPIO
00158 #define CVD_PORT_AN1 _GPIO
00159 #define CVD_PORT_AN2 _GPIO
00160 #define CVD_PORT_AN3 _GPIO
00161
00162 #define CVD_PORT_SENSOR0 __paste(CVD_PORT_,CVD_SENSOR0)
00163 #define CVD_PORT_SENSOR1 __paste(CVD_PORT_,CVD_SENSOR1)
00164 #define CVD_PORT_SENSOR2 __paste(CVD_PORT_,CVD_SENSOR2)
00165 #define CVD_PORT_SENSOR3 __paste(CVD_PORT_,CVD_SENSOR3)
00166 #define CVD_PORT_REFERENCE __paste(CVD_PORT_,CVD_REFERENCE)
00167
00168 #endif
00169