通过串口,协调器发送命令给终端节点,如输入A,发送collect_start(0x01),不加zb_SendDataRequest这句的话,输入A后,LED亮,串口显示Starting Collect, 使用zb_SendDataRequest 向终端节点传送命令时,串口不能正常接收数据。求分析!在线等。
void my_Uart(void)
{
uint8 c;
uint8 pData[1];
c=Uart0Receive();
asm("NOP");
switch(c)
{
case 'A': //开始采集
HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
HalUARTWrite(0,"Starting Collect\n",17);
pData[0] = Collect_start;
zb_SendDataRequest(0xFFFF,SENSOR_CONTROL_CMD_ID,1,pData, 0,AF_SKIP_ROUTING,0 );
break;
case 'B': //停止采集
HalLedSet( HAL_LED_1, HAL_LED_MODE_OFF );
HalUARTWrite(0,"Stop Collect\n",13);
pData[0] = Collect_stop;
//zb_SendDataRequest( 0xFFFF, SENSOR_CONTROL_CMD_ID,1,pData, 0, AF_ACK_REQUEST, 0 );
break;
default:
break;
}
} |