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.

[参考译文] CCS/CC1312R:如何将传感器控制器 ADC 值转换为电压?

Guru**** 2587345 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/774650/ccs-cc1312r-how-to-convert-the-sensor-controller-adc-value-to-voltage

器件型号:CC1312R

工具/软件:Code Composer Studio

您好!

例如 rfWsnNode_CC1312R1_LAUNCHXL_tirtos_ccs、我尝试通过将传感器控制器 ADC 值转换为 M4中的电压

AUXADCValueToMicroVOLTAGE (AUXADC_FIXED_REF_VOLTGE_NORMAL、latestAdcValue) 

但与示波器比较、它显示的值为1.9v、上面的 API 返回的值约为1.76V。

我错过了什么吗?

同样、对于采样 多个引脚的情况、如何将多个 ADC 值转换为电压? 谢谢

adcEnableSync (adc_REF_FIXED、adc_sample_time_2P7_US、adc_trigger_manual);

//对于每个引脚(cfg.pAdcValue[]和 output.pAdcValue[]中每个引脚一个条目)...
对于(U16 n = 0;n < sensor_output_count;n++){

//选择 ADC 输入
adcSelectGpioInput (cfg.pAuxoASensorOutput[n]);

//对引脚进行采样并存储 ADC 值
adcGenManualTrigger();
adcReadFifo (output.pAdcValue[n]);
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如果您看一下 adcsinglechChannel 示例、这将使用函数 ADC_convertRawToMicroVolts 来转换该值。

    此函数如下所示:

    /*
    === ADCCC26XX_convertToMicroVolts ===
    //
    uint32_t ADCCC26XX_convertToMicroVolts (adc_handle、uint16_t adcValue){
    ADCCC26XX_HWAttrs const *hwAttrs;
    uint32_t 辅助值;
    
    DebugP_assert (handle);
    
    /*获取指向 hwAttrs 的指针*/
    hwAttrs = handle->hwAttrs;
    
    /*仅在指定时应用剪裁*/
    if (hwAttrs->returnAdjustedVal){
    adjustdValue = adcValue;
    }
    否则{
    uint32_t 增益= AUXADCGetAdjustmentGain (hwAttrs->refSource);
    uint32_t offset = AUXADCGetAdjustmentOffset (hwAttrs->refSource);
    adjustedValue = AUXADCAdjustValueForGainAndOffset (adcValue、增益、偏移);
    }
    
    返回 AUXADCValueToMicroVolt(hwAttrs->inputScalingEnabled? AUXADC_FIXED_REF_VOLTGE_NORMAL:AUXADC_FIXED_REF_VOLTGE_UNSCALED)、AD调节 值);
    } 

    正如您看到的、除了 AUXADCValueToMicroVolts 之外、它还调用其他函数来调整增益和偏移。 =>使用示例中使用的函数。

    对于多个引脚、您必须针对生成的数组中的每个值调用此函数。