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.

关于MSP432模拟量输入



请问TI工程师:

      我使用MSP432P4011处理器 

     我的项目 有6个模拟量

     前2个模拟量需要差分输入  后4个模拟量普通单端输入

     A0-A1   差分输入1      

     A2-A3   差分输入2

     A4   普通单端输入1

     A5   普通单端输入2

     A6   普通单端输入3

     A7   普通单端输入4

     这样混合用可以的是吧

 

  • 我没有实际试过,但理论上应该是可以的。您现在是想使用多通道序列多次转换?

    在TI Resource Explorer 中有相关的差分使用例程,您可以参考一下

    dev.ti.com/.../node
  • 是的~~ 多通道序列多次转换 6路模拟量 周期转换
  • 我6路配置如下:
    MAP_ADC14_configureConversionMemory(ADC_MEM0,
    ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG,
    ADC_INPUT_A0, ADC_DIFFERENTIAL_INPUTS); //差分输入

    MAP_ADC14_configureConversionMemory(ADC_MEM1,
    ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG,
    ADC_INPUT_A2, ADC_DIFFERENTIAL_INPUTS); //差分输入


    MAP_ADC14_configureConversionMemory(ADC_MEM2,
    ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG,
    ADC_INPUT_A4, ADC_NONDIFFERENTIAL_INPUTS); //单端输入

    MAP_ADC14_configureConversionMemory(ADC_MEM3,
    ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG,
    ADC_INPUT_A5, ADC_NONDIFFERENTIAL_INPUTS); //单端输入

    MAP_ADC14_configureConversionMemory(ADC_MEM4,
    ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG,
    ADC_INPUT_A6, ADC_NONDIFFERENTIAL_INPUTS); //单端输入

    MAP_ADC14_configureConversionMemory(ADC_MEM5,
    ADC_VREFPOS_EXTPOS_VREFNEG_EXTNEG,
    ADC_INPUT_A7, ADC_NONDIFFERENTIAL_INPUTS); //单端输入
  • 同时问一下:
    我们现在评测MSP432P4011 处理器 发现 对于模拟量要求高的信号,必须进行差分输入才能达到AD14的高分辨率 ,如果采用普通的单端信号 可能因为GND的不稳定 会导致采样AD数据ENOB 偏低。 所以 才使用混合输入(重要信号差分+普通信号 单端)
  • 看着没啥问题,附上差分的例程

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    /*******************************************************************************
     * MSP432 ADC14 -  Differential Mode with 2's Compliment
     *
     * Description: This example will use the ADC14 module mode in differential
     * mode and take advantage of the 2's compliment mode. One ADC memory location
     * is set to sample the differential voltage between terminals A0 and A1. The
     * sample timer is used to periodically sample the difference in the value,
     * the value is converted is float, and the value is stored in memory for the
     * user to observe in the debugger.
     *
     *                MSP432P4111
     *             ------------------
     *         /|\|                  |
     *          | |                  |
     *          --|RST         P5.5  |<----- A0 In
     *            |            P5.4  |<----- A1 In
     *            |                  |
     *            |                  |
     *
     ******************************************************************************/
    /* DriverLib Includes */
    #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
    
    /* Standard Includes */
    #include <stdint.h>
    
    #include <string.h>
    
    /* Statics */
    static volatile float adcResult;
    static float convertToFloat(uint16_t result);
    
    int main(void)
    {
        /* Halting WDT */
        MAP_WDT_A_holdTimer();
        MAP_Interrupt_enableSleepOnIsrExit();
    
        /* Enabling the FPU with stacking enabled (for use within ISR) */
        MAP_FPU_enableModule();
        MAP_FPU_enableLazyStacking();
    
        /* Initializing ADC (MCLK/1/1) */
        MAP_ADC14_enableModule();
        MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1,
                0);
    
        /* Configuring ADC Memory (ADC_MEM0 A0/A1 Differential) in repeat mode */
        MAP_ADC14_configureSingleSampleMode(ADC_MEM0, true);
        MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS,
                ADC_INPUT_A0, true);
    
        /* Setting up GPIO pins as analog inputs */
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5,
                GPIO_PIN5 | GPIO_PIN4, GPIO_TERTIARY_MODULE_FUNCTION);
    
        /* Switching data mode to 2's Complement mode */
        MAP_ADC14_setResultFormat(ADC_SIGNED_BINARY);
    
        /* Enabling sample timer in auto iteration mode and interrupts*/
        MAP_ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION);
        MAP_ADC14_enableInterrupt(ADC_INT0);
    
        /* Enabling Interrupts */
        MAP_Interrupt_enableInterrupt(INT_ADC14);
        MAP_Interrupt_enableMaster();
    
        /* Triggering the start of the sample */
        MAP_ADC14_enableConversion();
        MAP_ADC14_toggleConversionTrigger();
    
        /* Going to sleep */
        while (1)
        {
            MAP_PCM_gotoLPM0();
        }
    }
    
    /* This interrupt happens every time a conversion has completed. Since the FPU
     * is enabled in stacking mode, we are able to use the FPU safely to perform
     * efficient floating point arithmetic.*/
    void ADC14_IRQHandler(void)
    {
        uint64_t status;
    
        status = MAP_ADC14_getEnabledInterruptStatus();
        MAP_ADC14_clearInterruptFlag(status);
    
        if(status & ADC_INT0)
        {
            adcResult = convertToFloat(MAP_ADC14_getResult(ADC_MEM0));
        }
    
    }
    
    //![Conversion to Real Value]
    /* Converts the ADC result (14-bit) to a float with respect to a 3.3v reference
     */
    static float convertToFloat(uint16_t result)
    {
        int32_t temp;
    
            if(0x8000 & result)
            {
                temp = (result >> 2) | 0xFFFFC000;
                return ((temp * 3.3f) / 8191);
            }
            else
                return ((result >> 2)*3.3f) / 8191;
    }
    //![Conversion to Real Value]
    

  • 关于这个您可以看一下

    www.ti.com/.../msp432p4011.pdf



    Table 5-27. Precision ADC Power Supply and Input Range Conditions
  • 很高兴能帮到您