我是要在接收中断中调用函数h_rx1byte(void)接收一个数据 ,为啥不能接收一个数据就调用一次,进入函数h_rx1byte(void)进行判断。。void h_rx1byte(void)
{unsigned char rxbuf;
//while (!(UART_S1_REG(UART0_BASE_PTR) & UART_S1_RDRF_MASK));
rxbuf=UART0_D_REG(UART0_BASE_PTR);
//rx_overtime = 1000; //ÑÓ³Ù30mS
//if((COMSTA0 & BIT2) == BIT2) //ÆæżУÑéλ³ö´í
//{H_T_ACK[0] = H_T_ACK[0] | BIT6;
//}
if(H_R_STATUS == 0)
{if(rxbuf == 0xff)
{rxsize++;
printf("STATUS==0\r\n");
if(rxsize >= 2) //Á¬ÐøÊÕÁË2¸öÇ°µ¼Âë
{H_R_STATUS = 1; printf("STATUS==1\r\n");
rxsize = 0;
H_T_ACK[0] = 0; //ÏìÓ¦ÂëµÚ1,2×Ö½ÚÇå0
H_T_ACK[1] = 0;
}
中断调用函数的实现
//temp[ii++]=uart0GetChar();
while(UART0_S1_REG(uartPtr) & UART0_S1_RDRF_MASK){
// /* Çå³ýÖжϱêÖ¾ */
//uart0SendChar(UART0_D_REG(uartPtr)); /* ·µ»Ø½ÓÊÕÊý¾Ý */
//;
//ii= UART0_D_REG(uartPtr);
h_rx1byte();
//while(!UART0_D_REG(uartPtr)); /* Çå½ÓÊÕ»º³åÇø */
}
|