微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > 射频无线通信设计 > 求大神进来看看,为什么会这样!

求大神进来看看,为什么会这样!

时间:10-02 整理:3721RD 点击:

  1. /*****************点对点通信发送函数*************************/
  2. uint8 fs[]="";
  3. uint8 buf[]="";
  4. void SampleApp_SendPointToPointMessage( void )
  5. {
  6. fasong++;
  7. sprintf(fs,"发送数据包总数:%4d---",fasong);
  8. HalUARTWrite(0,fs,strlen(fs));
  9. sprintf(buf,"This is a test_丢包 fasong_个数:%d\n",fasong);
  10. if ( AF_DataRequest( &Point_To_Point_DstAddr,
  11. &SampleApp_epDesc,
  12. SAMPLEAPP_POINT_TO_POINT_CLUSTERID,
  13. strlen(buf),
  14. buf,
  15. &SampleApp_TransID,
  16. AF_DISCV_ROUTE,
  17. AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
  18. {
  19. HalUARTWrite(0,buf,strlen(buf));
  20. //点灯
  21. HalLedSet (HAL_LED_2, HAL_LED_MODE_TOGGLE);

  22. }
  23. else
  24. {
  25. // Error occurred in request to send.
  26. }

  27. if(fasong==10001)
  28. {
  29. uint8 data[]="1000个数据包发送结束!\n\r";
  30. HalUARTWrite(0,data,strlen(data));
  31. while(1);
  32. }

  33. }

复制代码

==============================================================================================

  1. /****************接收处理函数******************/
  2. void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pkt )
  3. {
  4. uint16 flashTime;
  5. unsigned char count[100]="";

  6. switch ( pkt->clusterId )
  7. {
  8. case SAMPLEAPP_POINT_TO_POINT_CLUSTERID:
  9. if(fasong == 1)
  10. {
  11. jieshou = 1;
  12. }
  13. jieshou++;
  14. sprintf(count,"接收到的数据包总数:%4d---",jieshou);
  15. HalUARTWrite(0,count,strlen(count));
  16. HalUARTWrite(0, pkt->cmd.Data,strlen(pkt->cmd.Data));
  17. HalUARTWrite(0,"\n",1);
  18. HalLedSet (HAL_LED_1, HAL_LED_MODE_TOGGLE);

  19. break;

  20. case SAMPLEAPP_FLASH_CLUSTERID:
  21. flashTime = BUILD_UINT16(pkt->cmd.Data[1], pkt->cmd.Data[2] );
  22. HalLedBlink( HAL_LED_4, 4, 50, (flashTime / 4) );
  23. break;
  24. }
  25. }

复制代码

===============================问题来了==========================
为什么发送的数据正常:




==========================而接收的多了个感叹号

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top