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.

[参考译文] MSP430FR5969:简单的 GPIO 问题

Guru**** 2529140 points
Other Parts Discussed in Thread: MSP430FR5969

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1179882/msp430fr5969-simple-gpio-issues

器件型号:MSP430FR5969

您好!

我正在从事涉及此微处理器(MSP430FR5969)的项目、现在难以让简单的 GPIO 驱动/感应正常工作。

CCS 版本:12.1.0.00007。

我有一个连接到 P3.4的开关、可用于驱动该引脚上的"0"或"1":

#include <msp430.h>
#include <stdint.h>

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   /* Hold on-chip WDT. */

    volatile uint8_t nP3IN;

    /* Assert power-on defaults. */
    P3SEL0 = 0;
    P3SEL1 = 0;
    P3REN = 0;
    P3OUT = 0;
    P3DIR = 0;

    while( 1 ) {
        nP3IN = P3IN;   /* Read 'P3IN'. */
    }
}


切换开关不会导致 P1IN 寄存器发生任何变化。 使用万用表进行探测时、我可以确认引脚电平在 GND 和 VCC ("0"和"1")之间变化。

同样、我似乎无法从该微控制器的 GPIO 引脚中驱动任何东西。 我将一个 DNF 电阻器垫连接到 P3.3、我可以使用万用表探测该垫以感测引脚电平变化:

#include <msp430.h>

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   /* Hold on-chip WDT. */

    /* Assert power-on defaults. */
    P3SEL0 = 0;
    P3SEL1 = 0;
    P3REN = 0;
    P3OUT = 0;

    P3DIR = BIT3; /* Set data direction of P3.3 to '1' (drive output). */

    while( 1 ) {
        P3OUT = BIT3;   /* Drive '1' on P3.3. */
        P3OUT = 0;      /* Drive '0' on P3.3. */
    }
}


创建每个项目所采取的步骤:

1.加载 CCS 并选择新的工作区。
2.从"入门"启动页中单击"新建项目"。
3.从目标器件列表中选择"MSP430FR5969"、为项目指定任何种类的名称并选择"Empty Project (with main.c)"模板。 点击"Finish"。
4.将两个代码片段中的任何一个复制并粘贴到"main.c"源文件中。
5.点击 CCS 工具栏中的"Debug"按钮对器件进行编程并单步执行"main.c"。

我对这里可能出现的问题有些困惑。 如果有任何指示,将不胜感激。

此致、
km

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

    错过的步骤:读取文档并找到 LOCKLPM5。

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

    谢谢—正如您发布的那样、我遇到了 LOCKLPM5寄存器位。 清除 LOCKLPM5可解决我的问题。

    此致、
    km