通过串口接收一包数据(5字节),结果总出差,如果一个一个接收就正常,代码:
1.485初始化
void init485(void)
{
UCTL0 = CHAR; // 8-bit character
UTCTL0 = SSEL0; // UCLK = ACLK
UBR00 = 0x03; // 32k/9600
UBR10 = 0;
UMCTL0 = 0x4a;
ME2 |= URXE0;
IE2 |= URXIE0;
}
2.485中断接收一包数据
#pragma vector = UART0RX_VECTOR
__interrupt void r485(void)
{
for(cycle = 0;cycle < 5;cycle ++)
{rxbuf[cycle] = RXBUF0; }
cycle = 0;
}