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.

430F5418通过uart方式与lcd通讯,无法接收lcd返回的数据。

上面是lcd的通讯方式;

void put_char( uchar ch)
{
        while(!(UCA1IFG & UCTXIFG));            // --BIT5
        UCA1TXBUF = ch;
}
 
char get_char(void)
{
uchar ch;
        ch   =  temp;
return ch;
}
//下面是背光指令;
void Back_Toggle(void)
{
uchar ch;
        put_char(BACK_TOGGLE);
ch=get_char();
while(ch!=0xCC); //等待返回值???
}
//下面是中断程序
 #pragma vector=USCI_A1_VECTOR  
__interrupt void USCI_A1_ISR(void)  
{  
  switch(__even_in_range(UCA1IV,4))  
  {  
  case 0:break;  
  case 2:                                   // 接收中断  
    while (!(UCA1IFG&UCTXIFG));             // 等待发送完成  
    temp = UCA1RXBUF;                  // 接收缓冲区  
    break;  
  case 4:break;                             // 发送中断  
  default: break;  
  }  
}