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.

[参考译文] MSP430F6459:为 RS485 配置 UART

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1593183/msp430f6459-configuring-uart-for-rs485

器件型号: MSP430F6459

您好专家、

我正在尝试在 MSP430F6459TPZR 上为 RS485 配置 UART。 时钟为 20Mhz、波特率为 115200。

我使用了以下代码:

======================

P2SEL |=(BIT4 + BIT5); //新 UART 针脚:P2.4、5 = UCA1 TXD/RXD
 
 UCA0CTL1 =(uint8_t) UCSWRST;

 UCA0CTL0 =(uint8_t) 0;             // 8 位、无奇偶校验、1 个停止
 UCA0CTL1 |=(uint8_t) UCSSEL_SMCLK;  

 UCA0BR0 =(uint8_t) 0xA;  
 UCA0BR1 = 0;
  
 UCA0STAT = 0x00;
 UCA0IE = 0x00;
     
 UCA0MCTL =(uint8_t) 0xAD;//(uint8_t)(13<< 4)|(0xAD << 1)| UCOS16;//UCBRF_13 + 0xAD + UCOS16;//SUCBRF_13 + UCOS16;//UCBRS2 + UCBRS0;      //请参阅表

 UCA0CTL1 且=(uint8_t)~UCSWRST;

==============================

我肯定有一个挑战配置 UCA0MCTL ,因为我不知道如何存储 UCBRSx 值 (0xAD) 在它,因为从我的未知它应该只消耗 3 位在 UCA0MCTL 寄存器.

不确定其他寄存器中是否存在任何错误。 我非常感谢你在这方面的帮助

谢谢、
Kavita

 

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

    指南中可能会出现混淆、包括有关两种串行端口变体的信息。 eUSCI 和 USCI。 eUSCI 有一个 16 位 MCTL 寄存器、这些值似乎是针对它的。

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

    感谢您对此进行澄清。 那么、MCTL 寄存器中的值应该是多少?

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

    它在指南中。