请问CC2640R2F的ADC例程中参考电压是多少?如果我要改为4.3V的话要怎么改呢?
Kevin Qiu1:
0: Fixed reference = 4.3V
1: Relative reference = VDDS
/*!*@briefSpecifies whether the internal reference of the ADC is sourced from the battery voltage or a fixed internal source.**- In practice, using the internal fixed voltage reference sets the upper range of the ADC to a fixed value. That value is 4.3V with*input scaling enabled and ~1.4785V with input scaling disabled. In this mode, the output is a function of the input voltage multiplied*by the resolution in alternatives (not bits) divided by the upper voltage range of the ADC. Output = Input (V) * 2^12 / (ADC range (V))**- Using VDDS as a reference scales the upper range of the ADC with the battery voltage. As the battery depletes and its voltage drops, so does*the range of the ADC. This is helpful when measuring signals that are generated relative to the battery voltage. In this mode, the output is*a function of the input voltage multiplied by the resolution in alternatives (not bits) divided by VDDS multiplied by a scaling factor derived*from the input scaling. Output = Input (V) * 2^12 / (VDDS (V) * Scaling factor), where the scaling factor is ~1.4785/4.3 for input scaling*disabled and 1 for input scaling enabled.**@noteThe actual reference values are slightly different for each device and are higher than the values specified above. This gain is saved in*the FCFG. The function ::ADC_convertToMicroVolts() must be used to derive actual voltage values. Do not attempt to compare raw values*between devices or derive a voltage from them yourself. The results of doing so will only be approximately correct.**@warningEven though the upper voltage range of the ADC is 4.3 volts in fixed mode with input scaling enabled, the input should never exceed*VDDS as per the data sheet.*/ typedef enum ADCCC26XX_Reference_Source {ADCCC26XX_FIXED_REFERENCE= AUXADC_REF_FIXED,ADCCC26XX_VDDS_REFERENCE= AUXADC_REF_VDDS_REL } ADCCC26XX_Reference_Source;
梦与远方:
回复 Kevin Qiu1:
这个是用的AUX域吗?
梦与远方:
回复 Kevin Qiu1:
那例程中ADC的参考电压值是多少呢?
Kevin Qiu1:
回复 梦与远方:
例程中参考源是 ADCCC26XX_FIXED_REFERENCE4.3V
梦与远方:
回复 Kevin Qiu1:
如果我想修改Board_ADC1的引脚,要怎么做呢?
Kevin Qiu1:
回复 梦与远方:
和枚举中的顺序对应就可以了,例如:改为DIO25在Board.h中#define Board_ADC1 CC2640R2_LAUNCHXL_ADC2/*!*@defCC2640R2_LAUNCHXL_ADCName*@briefEnum of ADCs*/ typedef enum CC2640R2_LAUNCHXL_ADCName {CC2640R2_LAUNCHXL_ADC0 = 0,CC2640R2_LAUNCHXL_ADC1,CC2640R2_LAUNCHXL_ADC2,CC2640R2_LAUNCHXL_ADC3,CC2640R2_LAUNCHXL_ADC4,CC2640R2_LAUNCHXL_ADC5,CC2640R2_LAUNCHXL_ADC6,CC2640R2_LAUNCHXL_ADC7,CC2640R2_LAUNCHXL_ADCDCOUPL,CC2640R2_LAUNCHXL_ADCVSS,CC2640R2_LAUNCHXL_ADCVDDS,CC2640R2_LAUNCHXL_ADCCOUNT } CC2640R2_LAUNCHXL_ADCName;
梦与远方:
回复 Kevin Qiu1:
您的意思是我直接#define Board_ADC1DIO25?
Kevin Qiu1:
回复 梦与远方:
不是,将原来的#define Board_ADC1CC2640R2_LAUNCHXL_ADC1
改为#define Board_ADC1CC2640R2_LAUNCHXL_ADC2
就由DIO24变为DIO25了
上面的CC2640R2_LAUNCHXL_ADC0 -CC2640R2_LAUNCHXL_ADC7
依次对应DIO23-DIO30
梦与远方:
回复 Kevin Qiu1:
好的
YiKai Chen:
回复 梦与远方:
把CC2640R2_LAUNCHXL_DIO24_ANALOG的adcCompBInput 改成ADC_COMPB_IN_AUXIO7,CC2640R2_LAUNCHXL_DIO23_ANALOG的adcCompBInput 改成ADC_COMPB_IN_AUXIO6,就可以把ADC0的腳位換成DIO24了,其他的可以以此類推
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCCOUNT] = { { .adcDIO = CC2640R2_LAUNCHXL_DIO23_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO6, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO24_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO7, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO25_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO5, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO26_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO4, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO27_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO3, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO28_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO2, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO29_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO1, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = CC2640R2_LAUNCHXL_DIO30_ANALOG, .adcCompBInput = ADC_COMPB_IN_AUXIO0, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = PIN_UNASSIGNED, .adcCompBInput = ADC_COMPB_IN_DCOUPL, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = PIN_UNASSIGNED, .adcCompBInput = ADC_COMPB_IN_VSS, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }, { .adcDIO = PIN_UNASSIGNED, .adcCompBInput = ADC_COMPB_IN_VDDS, .refSource = ADCCC26XX_FIXED_REFERENCE, .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US, .inputScalingEnabled = true, .triggerSource = ADCCC26XX_TRIGGER_MANUAL, .returnAdjustedVal = false }};