This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F ADC

Other Parts Discussed in Thread: CC2640R2F

请问CC2640R2F的ADC例程中参考电压是多少?如果我要改为4.3V的话要怎么改呢?

  • 0: Fixed reference = 4.3V

    1: Relative reference = VDDS

    /*!
     *  @brief  Specifies 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.
     *
     *  @note   The 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.
     *
     *  @warning    Even 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;
    

  • 这个是用的AUX域吗?
  • 那例程中ADC的参考电压值是多少呢?
  • 例程中参考源是 ADCCC26XX_FIXED_REFERENCE 4.3V
  • 如果我想修改Board_ADC1的引脚,要怎么做呢?
  • 和枚举中的顺序对应就可以了,例如:改为DIO25 
    在Board.h中
    #define Board_ADC1           CC2640R2_LAUNCHXL_ADC2

    /*!
     *  @def    CC2640R2_LAUNCHXL_ADCName
     *  @brief  Enum 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;
  • 您的意思是我直接#define Board_ADC1 DIO25?
  • 不是,将原来的#define Board_ADC1 CC2640R2_LAUNCHXL_ADC1
    改为#define Board_ADC1 CC2640R2_LAUNCHXL_ADC2
    就由DIO24变为DIO25了

    上面的CC2640R2_LAUNCHXL_ADC0 -CC2640R2_LAUNCHXL_ADC7

    依次对应DIO23-DIO30
  • 把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
        }
    };