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/MSP432P401R:从引脚读取模拟值并在串行端口中打印

Guru**** 2560390 points
Other Parts Discussed in Thread: ENERGIA

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/601052/ccs-msp432p401r-read-analog-value-from-pin-and-print-in-the-serial-port

器件型号:MSP432P401R
主题中讨论的其他器件:Energia

工具/软件:Code Composer Studio

您好!

我的问题是:我能否从引脚读取一个模拟值并使用 Code Composer Studio 将其打印在串行端口中?

我知道 Energia 中的任务非常简单、但我需要使用 Code Composer Studio、因为我有一个 PWM 发生器代码。

谢谢

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

    是的、这是可能的! 请参阅此 SimpleLink Academy 培训、该培训将介绍如何执行此操作!
    dev.ti.com/.../
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    谢谢、但我不明白为什么值读数为实际值的+0.2伏特。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    显示您的代码。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    我的代码的一部分是:
    ________________________________________________________________
    ADC_PARAMS_INIT (params);
    ADC = ADC_open (Board_ADC0、params);

    if (ADC == NULL){
    System_abort ("初始化 ADC 通道0\n"时出错);

    否则{
    system_printf ("ADC 通道0已初始化\n"\});


    对于(I = 0;I < ADC_SAMPLE_COUNT;I++){

    RES = ADC_convert (ADC、&adcValue1[i]);
    RES = ADC_convertRawToMicroVolts (ADC、adcValue1[i]);

    ValoresADC[i]= RES/1000000.0;

    if (res == ADC_STATUS_SUCCESS){
    system_printf ("ADC 通道0转换结果(%d):%d\n"、i、
    adcValue1[i]);
    printf ("ADC 通道0转换结果(%d):%f\n"、i、
    ValoresADC[i]);

    否则{
    system_printf ("ADC 通道0转换失败(%d)\n"、i);


    ________________________________________________________________


    我使用函数 ADC_convertRawToMicroVolts (ADC、adcValue1[i])获取以微伏为单位的值、但该值为-0.2伏、实际值...
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您的电压基准是多少? 结果值是否合理?