adc10b.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_ADC10B_H__
00002 #define __MSP430WARE_ADC10B_H__
00003 
00004 //*****************************************************************************
00005 //
00006 //The following are the defines to include the required modules for this
00007 //peripheral in msp430xgeneric.h file
00008 //
00009 //*****************************************************************************
00010 #define __MSP430_HAS_ADC10_B__
00011 
00012 //*****************************************************************************
00013 //
00014 //The following are values that can be passed to ADC10_B_init() in the
00015 //sampleTimerSourceSelect parameter.
00016 //
00017 //*****************************************************************************
00018 #define ADC10B_SAMPLEHOLDSOURCE_SC (ADC10SHS_0)
00019 #define ADC10B_SAMPLEHOLDSOURCE_1  (ADC10SHS_1)
00020 #define ADC10B_SAMPLEHOLDSOURCE_2  (ADC10SHS_2)
00021 #define ADC10B_SAMPLEHOLDSOURCE_3  (ADC10SHS_3)
00022 
00023 //*****************************************************************************
00024 //
00025 //The following are values that can be passed to ADC10B_init() in the
00026 //clockSourceSelect parameter.
00027 //
00028 //*****************************************************************************
00029 #define ADC10B_CLOCKSOURCE_ADC10OSC (ADC10SSEL_0)
00030 #define ADC10B_CLOCKSOURCE_ACLK     (ADC10SSEL_1)
00031 #define ADC10B_CLOCKSOURCE_MCLK     (ADC10SSEL_2)
00032 #define ADC10B_CLOCKSOURCE_SMCLK    (ADC10SSEL_3)
00033 
00034 //*****************************************************************************
00035 //
00036 //The following are values that can be passed to ADC10B_init() in the
00037 //clockSourceDivider parameter.
00038 //Note: Bit 8-9 determines if the pre-divider is 1, 4, or 64
00039 //Bits 5-7 determine the the post-divider 1-8 (0x00 - 0xE0)
00040 //
00041 //*****************************************************************************
00042 #define ADC10B_CLOCKDIVIDER_1   (ADC10DIV_0 + ADC10PDIV_0)
00043 #define ADC10B_CLOCKDIVIDER_2   (ADC10DIV_1 + ADC10PDIV_0)
00044 #define ADC10B_CLOCKDIVIDER_3   (ADC10DIV_2 + ADC10PDIV_0)
00045 #define ADC10B_CLOCKDIVIDER_4   (ADC10DIV_3 + ADC10PDIV_0)
00046 #define ADC10B_CLOCKDIVIDER_5   (ADC10DIV_4 + ADC10PDIV_0)
00047 #define ADC10B_CLOCKDIVIDER_6   (ADC10DIV_5 + ADC10PDIV_0)
00048 #define ADC10B_CLOCKDIVIDER_7   (ADC10DIV_6 + ADC10PDIV_0)
00049 #define ADC10B_CLOCKDIVIDER_8   (ADC10DIV_7 + ADC10PDIV_0)
00050 #define ADC10B_CLOCKDIVIDER_12  (ADC10DIV_2 + ADC10PDIV_1)
00051 #define ADC10B_CLOCKDIVIDER_16  (ADC10DIV_3 + ADC10PDIV_1)
00052 #define ADC10B_CLOCKDIVIDER_20  (ADC10DIV_4 + ADC10PDIV_1)
00053 #define ADC10B_CLOCKDIVIDER_24  (ADC10DIV_5 + ADC10PDIV_1)
00054 #define ADC10B_CLOCKDIVIDER_28  (ADC10DIV_6 + ADC10PDIV_1)
00055 #define ADC10B_CLOCKDIVIDER_32  (ADC10DIV_7 + ADC10PDIV_1)
00056 #define ADC10B_CLOCKDIVIDER_64  (ADC10DIV_0 + ADC10PDIV_2)
00057 #define ADC10B_CLOCKDIVIDER_128 (ADC10DIV_1 + ADC10PDIV_2)
00058 #define ADC10B_CLOCKDIVIDER_192 (ADC10DIV_2 + ADC10PDIV_2)
00059 #define ADC10B_CLOCKDIVIDER_256 (ADC10DIV_3 + ADC10PDIV_2)
00060 #define ADC10B_CLOCKDIVIDER_320 (ADC10DIV_4 + ADC10PDIV_2)
00061 #define ADC10B_CLOCKDIVIDER_384 (ADC10DIV_5 + ADC10PDIV_2)
00062 #define ADC10B_CLOCKDIVIDER_448 (ADC10DIV_6 + ADC10PDIV_2)
00063 #define ADC10B_CLOCKDIVIDER_512 (ADC10DIV_7 + ADC10PDIV_2)
00064 
00065 //*****************************************************************************
00066 //
00067 //The following are values that can be passed to ADC10B_setupSamplingTimer() in
00068 //the clockCycleHoldCount parameter.
00069 //
00070 //*****************************************************************************
00071 #define ADC10B_CYCLEHOLD_4_CYCLES    (ADC10SHT_0)
00072 #define ADC10B_CYCLEHOLD_8_CYCLES    (ADC10SHT_1)
00073 #define ADC10B_CYCLEHOLD_16_CYCLES   (ADC10SHT_2)
00074 #define ADC10B_CYCLEHOLD_32_CYCLES   (ADC10SHT_3)
00075 #define ADC10B_CYCLEHOLD_64_CYCLES   (ADC10SHT_4)
00076 #define ADC10B_CYCLEHOLD_96_CYCLES   (ADC10SHT_5)
00077 #define ADC10B_CYCLEHOLD_128_CYCLES  (ADC10SHT_6)
00078 #define ADC10B_CYCLEHOLD_192_CYCLES  (ADC10SHT_7)
00079 #define ADC10B_CYCLEHOLD_256_CYCLES  (ADC10SHT_8)
00080 #define ADC10B_CYCLEHOLD_384_CYCLES  (ADC10SHT_9)
00081 #define ADC10B_CYCLEHOLD_512_CYCLES  (ADC10SHT_10)
00082 #define ADC10B_CYCLEHOLD_768_CYCLES  (ADC10SHT_11)
00083 #define ADC10B_CYCLEHOLD_1024_CYCLES (ADC10SHT_12)
00084 
00085 //*****************************************************************************
00086 //
00087 //The following are values that can be passed to ADC10B_setupSamplingTimer() in
00088 //the multipleSamplesEnabled parameter.
00089 //
00090 //*****************************************************************************
00091 #define ADC10B_MULTIPLESAMPLESDISABLE ( !(ADC10MSC) )
00092 #define ADC10B_MULTIPLESAMPLESENABLE  (ADC10MSC)
00093 
00094 //*****************************************************************************
00095 //
00096 //The following are values that can be passed to ADC10B_memoryConfigure() in the
00097 //inputSourceSelect parameter.
00098 //
00099 //*****************************************************************************
00100 #define ADC10B_INPUT_A0              (ADC10INCH_0)
00101 #define ADC10B_INPUT_A1              (ADC10INCH_1)
00102 #define ADC10B_INPUT_A2              (ADC10INCH_2)
00103 #define ADC10B_INPUT_A3              (ADC10INCH_3)
00104 #define ADC10B_INPUT_A4              (ADC10INCH_4)
00105 #define ADC10B_INPUT_A5              (ADC10INCH_5)
00106 #define ADC10B_INPUT_A6              (ADC10INCH_6)
00107 #define ADC10B_INPUT_A7              (ADC10INCH_7)
00108 #define ADC10B_INPUT_VEREF_P         (ADC10INCH_8)
00109 #define ADC10B_INPUT_VEREF_N         (ADC10INCH_9)
00110 #define ADC10B_INPUT_TEMPSENSOR      (ADC10INCH_10)
00111 #define ADC10B_INPUT_BATTERYMONITOR  (ADC10INCH_11)
00112 #define ADC10B_INPUT_A12             (ADC10INCH_12)
00113 #define ADC10B_INPUT_A13             (ADC10INCH_13)
00114 #define ADC10B_INPUT_A14             (ADC10INCH_14)
00115 #define ADC10B_INPUT_A15             (ADC10INCH_15)
00116 
00117 //*****************************************************************************
00118 //
00119 //The following are values that can be passed to ADC10B_memoryConfigure() in the
00120 //positiveRefVoltageSourceSelect parameter.
00121 //
00122 //*****************************************************************************
00123 #define ADC10B_VREFPOS_AVCC ( !(ADC10SREF0 + ADC10SREF1) )
00124 #define ADC10B_VREFPOS_INT  (ADC10SREF0)
00125 #define ADC10B_VREFPOS_EXT  (ADC10SREF1)
00126 
00127 //*****************************************************************************
00128 //
00129 //The following are values that can be passed to ADC10B_memoryConfigure() in the
00130 //negativeRefVoltageSourceSelect parameter.
00131 //
00132 //*****************************************************************************
00133 #define ADC10B_VREFNEG_AVSS ( !(ADC10SREF2) )
00134 #define ADC10B_VREFNEG_EXT  (ADC10SREF2)
00135 
00136 //*****************************************************************************
00137 //
00138 //The following are values that can be passed to ADC10B_startConversion() in the
00139 //conversionSequenceModeSelect parameter.
00140 //
00141 //*****************************************************************************
00142 #define ADC10B_SINGLECHANNEL          (ADC10CONSEQ_0)
00143 #define ADC10B_SEQOFCHANNELS          (ADC10CONSEQ_1)
00144 #define ADC10B_REPEATED_SINGLECHANNEL (ADC10CONSEQ_2)
00145 #define ADC10B_REPEATED_SEQOFCHANNELS (ADC10CONSEQ_3)
00146 
00147 //*****************************************************************************
00148 //
00149 //The following are values that can be passed to ADC10B_disableConversions() in
00150 //the preempt parameter.
00151 //
00152 //*****************************************************************************
00153 #define ADC10B_COMPLETECONVERSION (0x0)
00154 #define ADC10B_PREEMPTCONVERSION  (0x1)
00155 
00156 //*****************************************************************************
00157 //
00158 //The following are values that can be passed to ADC10B_setDataReadBackFormat()
00159 //in the readBackFormat parameter.
00160 //
00161 //*****************************************************************************
00162 #define ADC10B_UNSIGNED_BINARY     ( !(ADC10DF) )
00163 #define ADC10B_SIGNED_2SCOMPLEMENT (ADC10DF)
00164 
00165 //*****************************************************************************
00166 //
00167 //The following are values that can be passed to ADC10B_setResolution() in the
00168 //resolutionSelect parameter.
00169 //
00170 //*****************************************************************************
00171 #define ADC10B_RESOLUTION_8BIT  ( !(ADC10RES) )
00172 #define ADC10B_RESOLUTION_10BIT (ADC10RES)
00173 
00174 //*****************************************************************************
00175 //
00176 //The following are values that can be passed to
00177 //ADC10B_setSampleHoldSignalInversion() in the invertedSignal parameter.
00178 //
00179 //*****************************************************************************
00180 #define ADC10B_NONINVERTEDSIGNAL ( !(ADC10ISSH) )
00181 #define ADC10B_INVERTEDSIGNAL    (ADC10ISSH)
00182 
00183 //*****************************************************************************
00184 //
00185 //The following are values that can be passed to
00186 //ADC10B_setReferenceBufferSamplingRate() in the samplingRateSelect parameter.
00187 //
00188 //*****************************************************************************
00189 #define ADC10B_MAXSAMPLINGRATE_200KSPS ( !(ADC10SR) )
00190 #define ADC10B_MAXSAMPLINGRATE_50KSPS  (ADC10SR)
00191 
00192 //*****************************************************************************
00193 //
00194 //The following are values that are returned by ADC10B_isBusy().
00195 //
00196 //*****************************************************************************
00197 #define ADC10B_NOTBUSY (0x0)
00198 #define ADC10B_BUSY    (0x1)
00199 
00200 
00201 //*****************************************************************************
00202 //
00203 //Prototypes for the APIs.
00204 //
00205 //*****************************************************************************
00206 
00207 extern unsigned short ADC10B_init (unsigned int baseAddress,
00208     unsigned int sampleHoldSourceSelect,
00209     unsigned char clockSourceSelect,
00210     unsigned int clockSourceDivider);
00211 
00212 extern void ADC10B_enable (unsigned int baseAddress);
00213 
00214 extern void ADC10B_disable (unsigned int baseAddress);
00215 
00216 extern void ADC10B_setupSamplingTimer (unsigned int baseAddress,
00217     unsigned int clockCycleHoldCount,
00218     unsigned short multipleSamplesEnabled);
00219 
00220 extern void ADC10B_disableSamplingTimer (unsigned int baseAddress);
00221 
00222 extern void ADC10B_memoryConfigure (unsigned int baseAddress,
00223     unsigned char inputSourceSelect,
00224     unsigned char positiveRefVoltageSourceSelect,
00225     unsigned char negativeRefVoltageSourceSelect);
00226 
00227 extern void ADC10B_enableInterrupt (unsigned int baseAddress,
00228     unsigned char interruptMask);
00229 
00230 extern void ADC10B_disableInterrupt (unsigned int baseAddress,
00231     unsigned char interruptMask);
00232 
00233 extern void ADC10B_clearInterrupt (unsigned int baseAddress,
00234     unsigned char interruptFlagMask);
00235 
00236 extern unsigned char ADC10B_getInterruptStatus (unsigned int baseAddress,
00237     unsigned char interruptFlagMask);
00238 
00239 extern void ADC10B_startConversion (unsigned int baseAddress,
00240     unsigned char conversionSequenceModeSelect);
00241 
00242 void ADC10B_disableConversions (unsigned int baseAddress,
00243     unsigned short preempt);
00244 
00245 extern int ADC10B_getResults (unsigned int baseAddress);
00246 
00247 void ADC10B_setResolution (unsigned int baseAddress,
00248     unsigned char resolutionSelect);
00249 
00250 extern void ADC10B_setSampleHoldSignalInversion (unsigned int baseAddress,
00251     unsigned int invertedSignal);
00252 
00253 extern void ADC10B_setDataReadBackFormat (unsigned int baseAddress,
00254     unsigned short readBackFormat);
00255 
00256 extern void ADC10B_enableReferenceBurst (unsigned int baseAddress);
00257 
00258 extern void ADC10B_disableReferenceBurst (unsigned int baseAddress);
00259 
00260 extern void ADC10B_setReferenceBufferSamplingRate (unsigned int baseAddress,
00261     unsigned short samplingRateSelect);
00262 
00263 extern void ADC10B_setWindowComp (unsigned int baseAddress,
00264     unsigned int highThreshold,
00265     unsigned int lowThreshold);
00266 
00267 extern unsigned long ADC10B_getMemoryAddressForDMA (unsigned int baseAddress);
00268 
00269 extern unsigned short ADC10B_isBusy (unsigned int baseAddress);
00270 
00271 #endif

Copyright 2012, Texas Instruments Incorporated