两块板,无线通信成功(依据是CRC校验OK点亮LED),现在想把接收到的数据取出来发送到串口,串口部分带有自动回显,应该是没有问题的,
问题是,A板从串口接收数据通过无线发送到B板的时候,输入的是6个字节的“012345”,输出的是112个字节,而且其中看不到 30 31 32 33 34 35,
我想问,我应该怎么操作,才能取出想要的数据?部分代码如下。
/*******************************************************************************
**接收中断处理
******************************************************************************/
#pragma vector=CC1101_VECTOR
__interrupt void CC1101_ISR(void)
{
switch(__even_in_range(RF1AIV,32)) // Prioritizing Radio Core Interrupt
{
case 0: break; // No RF core interrupt pending
case 2: break; // RFIFG0
case 4: break; // RFIFG1
case 6: break; // RFIFG2
case 8: break; // RFIFG3
case 10: break; // RFIFG4
case 12: break; // RFIFG5
case 14: break; // RFIFG6
case 16: break; // RFIFG7
case 18: break; // RFIFG8
case 20: // RFIFG9
if(receiving) // 接收触发的中断
{
// Read the length byte from the FIFO
RxBufferLength = ReadSingleReg( RXBYTES );
ReadBurstReg(RF_RXFIFORD, RxBuffer, RxBufferLength);
__no_operation();
// Check the CRC results
if(RxBuffer[CRC_LQI_IDX] & CRC_OK)
{
delayms(10);
PutString(RxBuffer);
}
}
else if(transmitting) // 发送触发的中断
{
RF1AIE &= ~BIT9; // Disable TX end-of-packet interrupt
transmitting = 0;
}
else while(1);
ResetRadioCore();
InitRadio();
Strobe( RF_SRX );
// trap
break;
case 22: break; // RFIFG10
case 24: break; // RFIFG11
case 26: break; // RFIFG12
case 28: break; // RFIFG13
case 30: break; // RFIFG14
case 32: break; // RFIFG15
}
__bic_SR_register_on_exit(LPM3_bits);
}
/*******************************************************************************
**串口中断处理
*******************************************************************************/
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
switch(__even_in_range(UCA0IV,4))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
ReceiveOff();
receiving = 0;
Transmit( (unsigned char*)UCA0TXBUF,sizeof UCA0TXBUF);
transmitting = 1;
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}