This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

串口通信问题



各位达人:

          请问为什么在用串口调试助手调试时,发送A或B时,都接收不到预期的数据。下面是我的程序,帮我看看是否是程序的原因还是怎么的,谢谢。

#include "Led.h"
#include "uart.h"
unsigned char cmd;
void main(void)
{
Led_Init();
Uart_Init();
while(1)
{
switch(cmd)
{
case 'A':
cmd=0;
Uart_Print("LED1_ON",7);
Led1_On();
case 'B':
cmd=0;
Uart_Print("LED1_OFF",8);
Led1_Off();
break;
default:
break;
}
}

}
#pragma vector=URX0_VECTOR
__interrupt void URX0_ISR(void)
{
cmd=U0DBUF;
URX0IF=0;
}