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:我正在尝试使用 UART 端口、但其无法正常工作

Guru**** 2199010 points
Other Parts Discussed in Thread: MSP430FR5969, MSP-EXP430FR2311
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1443019/msp430fr5969-i-am-trying-to-use-the-uart-port-but-its-not-working-as-intended

器件型号:MSP430FR5969
主题中讨论的其他器件: MSP-EXP430FR2311

工具与软件:

您好、TI 团队:

每当 UART RX 从键盘接收到"t"时、我将使用 TI MSP430FR5969微控制器使 LED P4.6闪烁。 我把我的代码复制到这段文字中、问题是当我按下"没有发生任何情况"时会出现这种情况。 我敢肯定该代码是正确的、而且 MSP430完全是新的。 是否有人仍能审阅代码或提供解决此问题的方法?

代码  

#include


/**
* main.c
*/
int main (void)

WDTCTL = WDTPW | WDTHOLD;//停止看门狗计时器

UCA0CTLW0 |= UCSWRST;

UCA0CTLW0 |= UCSSEL__SMCLK;
UCA0BRW = 8;
UCA0MCTLW = 0XD600;


//设置端口

P2SEL0 &=~μ s BIT1;
P2SEL1 |=位1;

P4DIR |=位6;
P4OUT &=~BIT6;

PM5CTL0 &=~μ H LOCKLPM5;

UCA0CTLW0 &=~μ s UCSWRST;

UCA1IE |= UCRXIE;
___ enable_interrupt ();

while (1){

}

返回0;
}

#pragma vector = USCI_A0_VECTOR
_interrupt void RX_vector (void)

如果(UCA0RXBUF ="t")

P4OUT ^= BIT6;

}
}  

谢谢!

此致、

Pukhraj Singh

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

    UCA0RXBUF 不是字符串、它是一个字符。

    请尝试

    if (UCA0RXBUF ="t")//单引号

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

    我刚刚在 MSP-EXP430FR2311上进行了尝试、结果得到的警告非常清楚。

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

    谢谢基思,不知道为什么我不认识它!!