|
在工程中有如下代码,是基站将距离信息(distance)打包发送出去的部分。
你可以将distance 这个距离信息通过串口打印出来
- distance = distance - dwt_getrangebias(config.chan,(float)distance, config.prf);//距离减去矫正系数
- //将计算结果发送给TAG
- int temp = (int)(distance*100);
- distance_msg[10] = temp/100;
- // a=x; //自动类型转换,取整数部分
- distance_msg[11] = temp%100; //乘100后对100取余,得到2位小数点后数字
- distance_msg[12] = anthor_index;
- distance_msg[ALL_MSG_SN_IDX] = frame_seq_nb;
- distance_msg[ALL_MSG_TAG_IDX] = tag_index;
- dwt_writetxdata(sizeof(distance_msg), distance_msg, 0);
- dwt_writetxfctrl(sizeof(distance_msg), 0);
- /* Start transmission, indicating that a response is expected so that reception is enabled automatically after the frame is sent and the delay
- * set by dwt_setrxaftertxdelay() has elapsed. */
- dwt_starttx(DWT_START_TX_IMMEDIATE );
复制代码
|
|