msp430怎样接收字符串,请教各位大神,最好有程序解释,谢谢!!
1个回答
展开全部
用中断啊...举例:
/******************UARTA3_interrupt***************/
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCI_A3_VECTOR
__interrupt void USCI_A3_ISR(void)
{
switch(__even_in_range(UCA3IV,4))
{
case 0:break; // 没有中断挂起
case 2: // 数据接收
while (!(UCA3IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
RXA3_data_buffer[RXA3_num]=UCA3RXBUF;
if(RXA3_data_buffer[RXA3_num]==0xdd)RXA3_newdata=1;
RXA3_num++;
break;
case 4:break; // 发送缓冲空
default: break;
}
}
/******************UARTA3_interrupt***************/
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCI_A3_VECTOR
__interrupt void USCI_A3_ISR(void)
{
switch(__even_in_range(UCA3IV,4))
{
case 0:break; // 没有中断挂起
case 2: // 数据接收
while (!(UCA3IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
RXA3_data_buffer[RXA3_num]=UCA3RXBUF;
if(RXA3_data_buffer[RXA3_num]==0xdd)RXA3_newdata=1;
RXA3_num++;
break;
case 4:break; // 发送缓冲空
default: break;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询