RxBuffer1[RxCounter1++] = USART_ReceiveData(USART1); //将读寄存器的数据缓存到接收缓冲区里
if(RxBuffer1[RxCounter1-2]==0x0d&&RxBuffer1[RxCounter1-1]==0x0a) //判断结束标志是否是0x0d 0x0a
{
for(i=0; i< RxCounter1; i++) TxBuffer1[i] = RxBuffer1[i]; //将接收缓冲器的数据转到发送缓冲区,准备转发
rec_f=1; //接收成功标志
TxBuffer1[RxCounter1]=0; //发送缓冲区结束符
RxCounter1=0;
}
这里面写错了,串口2的中断处理程序处,RxCounter1=0;改成RxCounter2=0;