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.

[参考译文] MSP430FR2355:有人能告诉我为什么我无法获得 Rx 字符吗???

Guru**** 2539500 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/955111/msp430fr2355-can-someone-please-tell-me-why-i-cannot-get-rx-characters

器件型号:MSP430FR2355

我有以下代码。  它非常简单、但在我的一生中、我无法弄清为什么我从未看到 RXData 数组采用值?  我的逻辑分析仪在发送和接收总线上显示字符。  已验证我的所有寄存器。

#include 
#include "test.h"


volatile uint rxCount = 0;
unsigned char RXData[10];

int main (void)
{
uchar *mssg;
uchar *rxMssg;

mssg ="ER_CMD#P0";

WDTCTL = WDTPW | WDTHOLD;//停止看门狗计时器
P2SEL1 |=(BIT6 | BIT7);P2SEL0 &=~(BIT6 | BIT4);/*LFXT*/
PM5CTL0 &=~LOCKLPM5;
initClockTo16MHz();
P1DIR |= BIT0;P1SEL1 |= BIT0;//SMCLK

P4SEL0 |=(BIT2 + BIT3);//A1 UART
UCA1CTLW0 = UCSWRST;
UCA1CTLW0 |= UCSSEL_SMCLK;
UCA1BRW = 0x34;
UCA1MCTLW =(0x49 << 8)|(1 << 4)| UCOS16;
UCA1CTLW0 &=~UCSWRST;
RadioMachine (mssg);

}

uchar * radioMachine (uchar * PCD)
{
放射性状态;

STATE = CMD_DATA;

while (state!= done){
开关(状态){
案例 CMD_DATA:
如果(!(P3IN & BIT0)){
UCA1TXBUF =* PCD;
UCA1IE |= UCTXIE;
_bis_SR_register (LPM0_bits + GIE);
PCD++;
如果(* PCD ='\0'){
UCA1IE &=~UCTXIE;
UCA1IE |= UCRXIE;
状态=完成;
}
中断;
}
案例响应:
中断;
案例完成:
中断;
默认值:break;
}
}
返回0;
}


#pragma vector=USCI_A1_vector //无线电通信
__interrupt void RF_ISR_USCIA1 (void)
{
switch (__evo_in_range (UCA1IV、USCI_UART_UCTXIFG))
{
USCI_NONE 案例:中断;
USCI_UART_UCRXIFG 案例:
RXData[rxCount]= UCA0RXBUF;
rxCount++;
中断;
USCI_UART_UCTXIFG 案例:
LPM0_EXIT;
中断;
默认值:break;
}
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    拼写错误警报:
    >          RXData[rxCount] = UCA0RXBUF;

    I suspect you intended:

    >          RXData[rxCount] = UCA1RXBUF;

     

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

    问题已解决

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

    谢谢 Bruce。。。。

    我自己刚刚意识到了这一点。

    Steve