From 92d139e68796bf902f9e387e6416ced78ad0f44c Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期四, 07 十一月 2019 17:22:39 +0800 Subject: [PATCH] MODBUS移植完成 --- 源码/核心板/Src/application/dw_app.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" index 8ef4487..cbc0f8b 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" @@ -27,7 +27,7 @@ #include "filters.h" #include <stdio.h> #include "beep.h" - +#include "modbus.h" /*------------------------------------ Marcos ------------------------------------------*/ /* Inter-ranging delay period, in milliseconds. */ @@ -380,7 +380,7 @@ poll_tx_ts = get_tx_timestamp_u64(); //获得POLL发送时间T1 resp_rx_ts = get_rx_timestamp_u64(); //获得RESPONSE接收时间T4 - if(getsync_flag==0) + if(getsync_flag==0&&g_com_map[DEV_ROLE]) { getsync_flag=1; memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2); @@ -432,7 +432,8 @@ checksum = Checksum_u16(&usart_send[2],17); memcpy(&usart_send[19],&checksum,2); UART_PushFrame(usart_send,21); - + + memcpy(&Modbus_HoldReg[tag_id_recv*2],&anchor_dist_last_frm[tag_id_recv-TAG_ID_START],4); /* Poll DW1000 until TX frame sent event set. See NOTE 8 below. */ if(result==0) {while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))//不断查询芯片状态直到发送完成 @@ -626,6 +627,8 @@ checksum = Checksum_u16(&usart_send[2],17); memcpy(&usart_send[19],&checksum,2); UART_PushFrame(usart_send,21); + + memcpy(&Modbus_HoldReg[tag_id_recv*2],&anchor_dist_last_frm[tag_id_recv-TAG_ID_START],4); //dis_after_filter = LP_Frac_Update(p_Dis_Filter, dist_cm); -- Gitblit v1.9.3