From 45ca69e9c11a0b924f5b88073649aa73ac65b5e7 Mon Sep 17 00:00:00 2001 From: armink Date: Wed, 2 Jul 2014 13:42:22 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91#?= =?UTF-8?q?9=20=E6=8F=90=E5=87=BA=E7=9A=84485=E4=B8=B2=E5=8F=A3=E8=AF=BB?= =?UTF-8?q?=E5=86=99=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E6=8F=90=E5=8D=87485=E9=80=9A?= =?UTF-8?q?=E4=BF=A1=E6=95=88=E7=8E=87=E3=80=82=E6=84=9F=E8=B0=A2@JoeyZhu?= =?UTF-8?q?=E7=9A=84=E5=8F=8D=E9=A6=88=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- FreeModbus/port/portserial.c | 6 ++---- FreeModbus/port/portserial_m.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/FreeModbus/port/portserial.c b/FreeModbus/port/portserial.c index 1013980..f246284 100644 --- a/FreeModbus/port/portserial.c +++ b/FreeModbus/port/portserial.c @@ -33,10 +33,8 @@ void vMBPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable) { if (xRxEnable) { - /* 485通信时,等待串口移位寄存器中的数据发送完成后,再去使能485的接收、失能485的发送 - * 该延时时间可以结合CPU主频及串口波特率做适当调整 - * */ - vMBDelay(1000); + /* 485通信时,等待串口移位寄存器中的数据发送完成后,再去使能485的接收、失能485的发送*/ + while (!USART_GetFlagStatus(USART1,USART_FLAG_TC)); SLAVE_RS485_RECEIVE_MODE; USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); } diff --git a/FreeModbus/port/portserial_m.c b/FreeModbus/port/portserial_m.c index 863e912..57f8aee 100644 --- a/FreeModbus/port/portserial_m.c +++ b/FreeModbus/port/portserial_m.c @@ -35,10 +35,8 @@ void vMBMasterPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable) { if (xRxEnable) { - /* 485通信时,等待串口移位寄存器中的数据发送完成后,再去使能485的接收、失能485的发送 - * 该延时时间可以结合CPU主频及串口波特率做适当调整 - * */ - vMBDelay(1000); + /* 485通信时,等待串口移位寄存器中的数据发送完成后,再去使能485的接收、失能485的发送*/ + while (!USART_GetFlagStatus(USART2,USART_FLAG_TC)); MASTER_RS485_RECEIVE_MODE; USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); }