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.

MSP432P401R: 有两个引脚P2.0和P2.1一直输出高电平

Part Number: MSP432P401R


之前有一次下载代码之后,P2控制的那三个发光二极管,有两个就一直亮着,分别是P2.0和P2.1控制的红灯和绿灯,无论是代码覆盖还是按下复位按钮这两个引脚的输出一直是高电平,而且板子跟电脑接上之后,板子就会慢慢发热,怎么解决?

  • 请问您现在使用的是TI launchpad?

    无论是代码覆盖还是按下复位按钮这两个引脚的输出一直是高电平

    烧录TI的例程是否可以成功运行?

    而且板子跟电脑接上之后,板子就会慢慢发热

    是否有测量相关电压?根据您的描述,板子硬件出现问题的概率比较大

  • 代码烧录覆盖了,都是正常运行的,只有这两个灯不正常,然后这两个角的电压输出一直都是高电平来着

  • 请尝试下面的代码

    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2013, 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.
     *
     *******************************************************************************
     *
     *                       MSP432 CODE EXAMPLE DISCLAIMER
     *
     * MSP432 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see http://www.ti.com/tool/mspdriverlib for an API functional
     * library & https://dev.ti.com/pinmux/ for a GUI approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //   MSP432P401 Demo - Software Toggle P1.0
    //
    //   Description: Toggle P1.0 by xor'ing P1.0 inside of a software loop.
    //   ACLK = 32.768kHz, MCLK = SMCLK = default DCO~1MHz
    //
    //                MSP432P401x
    //             -----------------
    //         /|\|                 |
    //          | |                 |
    //          --|RST              |
    //            |                 |
    //            |             P1.0|-->LED
    //
    //   William Goh
    //   Texas Instruments Inc.
    //   June 2016 (updated) | November 2013 (created)
    //   Built with CCSv6.1, IAR, Keil, GCC
    //******************************************************************************
    #include "ti/devices/msp432p4xx/inc/msp.h"
    #include <stdint.h>
    
    int main(void) {
        volatile uint32_t i;
    
        WDT_A->CTL = WDT_A_CTL_PW |             // Stop WDT
                     WDT_A_CTL_HOLD;
    
        P2->DIR |= BIT0;                        // P2.0 set as output
    
        while (1)                               // continuous loop
        {
            P2->OUT ^= BIT0;                    // Blink P2.0 LED
            for (i = 20000; i > 0; i--);        // Delay
        }
    }
    
    

    运行后LED2,红色的LED,会闪烁