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.

[参考译文] MSP432E401Y:使用 MSP432E401Y 从 INA210读取模拟输出

Guru**** 2467980 points
Other Parts Discussed in Thread: INA210, MSP432E401Y

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1467082/msp432e401y-reading-analog-output-from-ina210-with-msp432e401y

器件型号:MSP432E401Y
主题中讨论的其他器件:INA210

工具与软件:

团队成员、您好!

我们已将 INA210输出电压引脚与 MSP432E401Y 微控制器的 PD4引脚连接、以测量电压和电流。

PD4引脚是 AIN7 (模数转换器输入端7)。使用 MAP_GPIOPinTypeADC、可以将 PD4配置为 ADC。 但我找不到任何特定于输入7通道的配置。

您能否说明如何使用 driverlib 配置 AIN7?

谢谢你。

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

    您好!

     下面是配置 AIN7的示例。  

        //
        // The ADC0 peripheral must be enabled for use.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    
        //
        // For this example ADC0 is used with AIN7 on port D4.
        // The actual port and pins used may be different on your part, consult
        // the data sheet for more information.  GPIO port D needs to be enabled
        // so these pins can be used.
        // TODO: change this to whichever GPIO port you are using.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    
        //
        // Select the analog ADC function for these pins.
        // Consult the data sheet to see which functions are allocated per pin.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_4);
    
        //
        // Enable sample sequence 3 with a processor signal trigger.  Sequence 3
        // will do a single sample when the processor sends a signal to start the
        // conversion.  Each ADC module has 4 programmable sequences, sequence 0
        // to sequence 3.  This example is arbitrarily using sequence 3.
        //
        ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
    
        //
        // Configure step 0 on sequence 1.  Sample channel 8 (ADC_CTL_CH8) in
        // single-ended mode (default) and configure the interrupt flag
        // (ADC_CTL_IE) to be set when the sample is done.  Tell the ADC logic
        // that this is the last conversion on sequence 1 (ADC_CTL_END).  Sequence
        // 3 has only one programmable step.  Sequence 1 and 2 have 4 steps, and
        // sequence 0 has 8 programmable steps.  Since we are only doing a single
        // conversion using sequence 1 we will only configure step 0.  For more
        // information on the ADC sequences and steps, reference the datasheet.
        //
        ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH7 | ADC_CTL_IE |
                                 ADC_CTL_END);
    
        //
        // Since sample sequence 1 is now configured, it must be enabled.
        //
        ADCSequenceEnable(ADC0_BASE, 1);
    
        //
        // Clear the interrupt status flag.  This is done to make sure the
        // interrupt flag is cleared before we sample.
        //
        ADCIntClear(ADC0_BASE, 1);