主题中讨论的其他部件: MSP-EXP430FR6989
工具/软件:Code Composer Studio
我是初学者,尝试在MSP430FR6989中运行以下程序以访问背面通道UART。 但我面临以下问题,
1. CCS显示2个警告,说明#2580-D pragma vector=接受数值参数或“unused_interrupts”,但不接受USICAB0RX_vector。
2.使用 IE2 |= UCA0RXIE;CCS抛出错误,使用 UCA0IE |= UCRXIE无错误;
参考设备管理器选择确切的终端后,我无法在相应的终端中看到任何数据。
#include <msp430fr6989.h>
#include <stdio.h>
字符串1[]="Hello /n /r";
字符I=0;
字符j =0;
Void主(void)
{
WDTCTL = WDTPW + WDTHOLD;//停止WDT
PM5CTL0 = 0x00;
P3SEL0 || BIT4 | BIT5;
P3SEL1 &=~(BIT4 | BIT5);
UCA0CTL1 || UCSSEL_1;// CLK = ACLK
UCA0BR0 = 0x03;// 32kHz/9600 = 3.41
UCA0BR1 = 0x00;//
UCA0MCTLW = UCBRS1 + UCBRS0;//调制UCBRSx = 3
UCA0CTL1 &=~UCSWRST;
UCA0IE |= UCRXIE;//IE2 |= UCA0RXIE;
__bis_sr_register(LPM3_bits + GIE);//输入LPM3,中断已启用
}
#pragma vector=USCIAB0TX_vector
__interrupt void USCI0TX_ISR(void)
{
UCA0TXBUF = string1[I++];
如果(i == sizeof string1)
{
UCA0IE &=~UCTXIE;//IE2 &=~UCA0TXIE;
}
}
#pragma vector=USCIAB0RX_vector
__interrupt void USCI0RX_ISR(void)
{
string1[j++]= UCA0RXBUF;
如果(j > sizeof string1 - 1)
{
I = 0;
J = 0;
UCA0IE &=~UCTXIE;//IE2 |= UCA0TXIE;
UCA0TXBUF = string1[I++];
}
}