1、【增加】转换延迟及响应超时宏定义;
2、【更新】IAR及Keil工程配置适应新的代码文件结构; 3、【修改】所有Slaver字段为Slave Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
parent
cb7ce7ee03
commit
ff438e63fc
18
.cproject
18
.cproject
|
@ -48,15 +48,15 @@
|
|||
<option id="iar.arm.toolchain.compiler.option.cppdialect.v6.1.0.1638054484" name="C++ dialect" superClass="iar.arm.toolchain.compiler.option.cppdialect.v6.1.0"/>
|
||||
<option id="iar.arm.toolchain.compiler.option.cpuMode.v5.4.0.1177576854" name="Processor mode:" superClass="iar.arm.toolchain.compiler.option.cpuMode.v5.4.0" value="iar.arm.toolchain.compiler.option.cpuMode.thumb.v5.4.0" valueType="enumerated"/>
|
||||
<option id="iar.arm.toolchain.compiler.option.incPaths.v5.4.0.219050810" name="Additional include directories" superClass="iar.arm.toolchain.compiler.option.incPaths.v5.4.0" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/APP/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/BSP/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/Libaries/STM32F10x_StdPeriph_Driver/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/RT-Thread-1.1.1/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/Libaries/CMSIS_EWARM/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/Libaries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/FreeModbus/modbus/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/FreeModbus/modbus/rtu}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slaver&Master+RTT+STM32/FreeModbus/port}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/APP/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/BSP/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/Libaries/STM32F10x_StdPeriph_Driver/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/RT-Thread-1.1.1/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/Libaries/CMSIS_EWARM/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/Libaries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/FreeModbus/modbus/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/FreeModbus/modbus/rtu}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/FreeModbus_Slave&Master+RTT+STM32/FreeModbus/port}""/>
|
||||
</option>
|
||||
<option id="iar.arm.toolchain.compiler.option.defines.v5.4.0.1280497388" name="Defined Symbols:" superClass="iar.arm.toolchain.compiler.option.defines.v5.4.0" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="STM32F10X_MD"/>
|
||||
|
|
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>FreeModbus_Slaver&Master+RTT+STM32</name>
|
||||
<name>FreeModbus_Slave&Master+RTT+STM32</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define DELAY_SYS_RUN_LED DELAY_MS(500) //系统指示灯延时500ms
|
||||
#define DELAY_SYS_SLEEP_LED DELAY_MS(1000) //系统指示灯延时1s
|
||||
#define DELAY_MB_SLAVER_POLL DELAY_MS(10) //Modbus从机轮训时间
|
||||
#define DELAY_MB_SLAVE_POLL DELAY_MS(10) //Modbus从机轮训时间
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ void thread_entry_ModbusSlaverPoll(void* parameter)
|
|||
while (1)
|
||||
{
|
||||
eMBPoll();
|
||||
rt_thread_delay(DELAY_MB_SLAVER_POLL);
|
||||
rt_thread_delay(DELAY_MB_SLAVE_POLL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1854,18 +1854,12 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\src\cpuusage.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\RT-Thread-0.3.2\include\rtthread.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\inc\stm32f10x_conf.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\src\stm32f10x_it.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\src\UserModbusSlaver.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>BSP</name>
|
||||
|
@ -1920,6 +1914,9 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\modbus\rtu\mbrtu.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\modbus\rtu\mbrtu_m.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\modbus\functions\mbutils.c</name>
|
||||
</file>
|
||||
|
@ -1927,17 +1924,26 @@
|
|||
<name>$PROJ_DIR$\..\FreeModbus\port\port.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\port.h</name>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\portevent.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\portevent.c</name>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\portevent_m.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\portserial.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\portserial_m.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\porttimer.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\porttimer_m.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\FreeModbus\port\user_app_s.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>RT-Thread Kernel</name>
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\FreeModbus_Slaver&Master+RTT+STM32.ewp</path>
|
||||
<path>$WS_DIR$\FreeModbus_Slave&Master+RTT+STM32.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<Workspace>
|
||||
<ConfigDictionary>
|
||||
|
||||
<CurrentConfigs><Project>FreeModbus_Slave&Master+RTT+STM32/Debug</Project></CurrentConfigs></ConfigDictionary>
|
||||
<Desktop>
|
||||
<Static>
|
||||
<Workspace>
|
||||
<ColumnWidths>
|
||||
|
||||
|
||||
|
||||
|
||||
<Column0>391</Column0><Column1>13</Column1><Column2>27</Column2><Column3>0</Column3></ColumnWidths>
|
||||
</Workspace>
|
||||
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1215</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>19</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log></Static>
|
||||
<Windows>
|
||||
|
||||
<Wnd2>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Identity>TabID-30370-1297</Identity>
|
||||
<TabName>Workspace</TabName>
|
||||
<Factory>Workspace</Factory>
|
||||
<Session>
|
||||
|
||||
<NodeDict><ExpandedNode>FreeModbus_Slave&Master+RTT+STM32</ExpandedNode></NodeDict></Session>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-24390-6730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
|
||||
<Editor>
|
||||
|
||||
|
||||
|
||||
|
||||
<Pane/><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
|
||||
<Positions>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Top><Row0><Sizes><Toolbar-00e15d58><key>iaridepm.enu1</key></Toolbar-00e15d58></Sizes></Row0></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>772</Bottom><Right>451</Right><x>-2</x><y>-2</y><xscreen>456</xscreen><yscreen>101</yscreen><sizeHorzCX>271429</sizeHorzCX><sizeHorzCY>104339</sizeHorzCY><sizeVertCX>269643</sizeVertCX><sizeVertCY>799587</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>151</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>153</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>158058</sizeHorzCY><sizeVertCX>271429</sizeVertCX><sizeVertCY>104339</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
|
||||
</Desktop>
|
||||
</Workspace>
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<Workspace>
|
||||
<ConfigDictionary>
|
||||
|
||||
<CurrentConfigs><Project>FreeModbus_Slaver&Master+RTT+STM32/Debug</Project></CurrentConfigs></ConfigDictionary>
|
||||
<Desktop>
|
||||
<Static>
|
||||
<Workspace>
|
||||
<ColumnWidths>
|
||||
|
||||
|
||||
|
||||
|
||||
<Column0>238</Column0><Column1>13</Column1><Column2>27</Column2><Column3>0</Column3></ColumnWidths>
|
||||
</Workspace>
|
||||
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1215</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>19</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log></Static>
|
||||
<Windows>
|
||||
|
||||
<Wnd2>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Identity>TabID-30370-1297</Identity>
|
||||
<TabName>Workspace</TabName>
|
||||
<Factory>Workspace</Factory>
|
||||
<Session>
|
||||
|
||||
<NodeDict><ExpandedNode>FreeModbus_Slaver&Master+RTT+STM32</ExpandedNode><ExpandedNode>FreeModbus_Slaver&Master+RTT+STM32/APP</ExpandedNode><ExpandedNode>FreeModbus_Slaver&Master+RTT+STM32/CMSIS</ExpandedNode></NodeDict></Session>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-24390-6730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-4402-12329</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
|
||||
<Editor>
|
||||
|
||||
|
||||
|
||||
|
||||
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app_task.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>79</YPos2><SelStart2>1359</SelStart2><SelEnd2>1359</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\app.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>23</SelStart2><SelEnd2>23</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\FreeModbus\port\portserial.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>120</YPos2><SelStart2>5890</SelStart2><SelEnd2>5890</SelEnd2></Tab><ActiveTab>2</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\RT-Thread-1.1.1\libcpu\arm\cortex-m3\cpuport.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>98</YPos2><SelStart2>4032</SelStart2><SelEnd2>4032</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Libaries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_md.s</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>42</YPos2><SelStart2>3319</SelStart2><SelEnd2>3334</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\BSP\src\bsp.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>226</YPos2><SelStart2>8652</SelStart2><SelEnd2>8652</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\src\stm32f10x_it.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>79</YPos2><SelStart2>3317</SelStart2><SelEnd2>3317</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\APP\inc\stm32f10x_it.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>2</YPos2><SelStart2>821</SelStart2><SelEnd2>821</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\FreeModbus\modbus\include\mbport.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>37</YPos2><SelStart2>2526</SelStart2><SelEnd2>2537</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\RT-Thread-1.1.1\libcpu\arm\cortex-m3\context_iar.S</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>29</YPos2><SelStart2>1312</SelStart2><SelEnd2>1312</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Libaries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>1003</YPos2><SelStart2>35272</SelStart2><SelEnd2>35272</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
|
||||
<Positions>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Top><Row0><Sizes><Toolbar-01ba1b18><key>iaridepm.enu1</key></Toolbar-01ba1b18></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>710</Bottom><Right>298</Right><x>-2</x><y>-2</y><xscreen>302</xscreen><yscreen>142</yscreen><sizeHorzCX>179762</sizeHorzCX><sizeHorzCY>146694</sizeHorzCY><sizeVertCX>178571</sizeVertCX><sizeVertCY>735537</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>213</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>215</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>222107</sizeHorzCY><sizeVertCX>179762</sizeVertCX><sizeVertCY>146694</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
|
||||
</Desktop>
|
||||
</Workspace>
|
||||
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
#include "mbcrc.h"
|
||||
#include "mbport.h"
|
||||
|
||||
#if MB_SLAVER_ASCII_ENABLED > 0
|
||||
#if MB_SLAVE_ASCII_ENABLED > 0
|
||||
|
||||
/* ----------------------- Defines ------------------------------------------*/
|
||||
#define MB_ASCII_DEFAULT_CR '\r' /*!< Default CR character for Modbus ASCII. */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
PR_BEGIN_EXTERN_C
|
||||
#endif
|
||||
|
||||
#if MB_SLAVER_ASCII_ENABLED > 0
|
||||
#if MB_SLAVE_ASCII_ENABLED > 0
|
||||
eMBErrorCode eMBASCIIInit( UCHAR slaveAddress, UCHAR ucPort,
|
||||
ULONG ulBaudRate, eMBParity eParity );
|
||||
void eMBASCIIStart( void );
|
||||
|
|
|
@ -54,11 +54,11 @@ PR_BEGIN_EXTERN_C
|
|||
/*! \brief If Modbus Master TCP support is enabled. */
|
||||
#define MB_MASTER_TCP_ENABLED ( 0 )
|
||||
/*! \brief If Modbus Slaver ASCII support is enabled. */
|
||||
#define MB_SLAVER_ASCII_ENABLED ( 0 )
|
||||
#define MB_SLAVE_ASCII_ENABLED ( 0 )
|
||||
/*! \brief If Modbus Slaver RTU support is enabled. */
|
||||
#define MB_SLAVER_RTU_ENABLED ( 1 )
|
||||
#define MB_SLAVE_RTU_ENABLED ( 1 )
|
||||
/*! \brief If Modbus Slaver TCP support is enabled. */
|
||||
#define MB_SLAVER_TCP_ENABLED ( 0 )
|
||||
#define MB_SLAVE_TCP_ENABLED ( 0 )
|
||||
/*! \brief The character timeout value for Modbus ASCII.
|
||||
*
|
||||
* The character timeout value is not fixed for Modbus ASCII and is therefore
|
||||
|
@ -107,4 +107,15 @@ PR_BEGIN_EXTERN_C
|
|||
#ifdef __cplusplus
|
||||
PR_END_EXTERN_C
|
||||
#endif
|
||||
|
||||
#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
|
||||
/*! \brief If master send a broadcast frame,the master will wait time of convert to delay,
|
||||
* then master can send other frame */
|
||||
#define MB_MASTER_DELAY_MS_CONVERT (200 )
|
||||
/*! \brief If master send a frame which is not broadcast,the master will wait sometime for slaver.
|
||||
* And if slaver is not respond in this time,the master will process this timeout error.
|
||||
* Then master can send other frame */
|
||||
#define MB_MASTER_TIMEOUT_MS_RESPOND (2000)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -139,6 +139,12 @@ extern BOOL( *pxMBFrameCBTransmitterEmpty ) ( void );
|
|||
|
||||
extern BOOL( *pxMBPortCBTimerExpired ) ( void );
|
||||
|
||||
extern BOOL( *pxMBMasterFrameCBByteReceived ) ( void );
|
||||
|
||||
extern BOOL( *pxMBMasterFrameCBTransmitterEmpty ) ( void );
|
||||
|
||||
extern BOOL( *pxMBMasterPortCBTimerExpired ) ( void );
|
||||
|
||||
/* ----------------------- TCP port functions -------------------------------*/
|
||||
BOOL xMBTCPPortInit( USHORT usTCPPort );
|
||||
|
||||
|
|
|
@ -44,13 +44,13 @@
|
|||
#include "mbfunc.h"
|
||||
|
||||
#include "mbport.h"
|
||||
#if MB_SLAVER_RTU_ENABLED == 1
|
||||
#if MB_SLAVE_RTU_ENABLED == 1
|
||||
#include "mbrtu.h"
|
||||
#endif
|
||||
#if MB_SLAVER_ASCII_ENABLED == 1
|
||||
#if MB_SLAVE_ASCII_ENABLED == 1
|
||||
#include "mbascii.h"
|
||||
#endif
|
||||
#if MB_SLAVER_TCP_ENABLED == 1
|
||||
#if MB_SLAVE_TCP_ENABLED == 1
|
||||
#include "mbtcp.h"
|
||||
#endif
|
||||
|
||||
|
@ -168,7 +168,7 @@ eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eM
|
|||
|
||||
switch ( eMode )
|
||||
{
|
||||
#if MB_SLAVER_RTU_ENABLED > 0
|
||||
#if MB_SLAVE_RTU_ENABLED > 0
|
||||
case MB_RTU:
|
||||
pvMBFrameStartCur = eMBRTUStart;
|
||||
pvMBFrameStopCur = eMBRTUStop;
|
||||
|
@ -182,7 +182,7 @@ eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eM
|
|||
eStatus = eMBRTUInit( ucMBAddress, ucPort, ulBaudRate, eParity );
|
||||
break;
|
||||
#endif
|
||||
#if MB_SLAVER_ASCII_ENABLED > 0
|
||||
#if MB_SLAVE_ASCII_ENABLED > 0
|
||||
case MB_ASCII:
|
||||
pvMBFrameStartCur = eMBASCIIStart;
|
||||
pvMBFrameStopCur = eMBASCIIStop;
|
||||
|
@ -218,7 +218,7 @@ eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eM
|
|||
return eStatus;
|
||||
}
|
||||
|
||||
#if MB_SLAVER_TCP_ENABLED > 0
|
||||
#if MB_SLAVE_TCP_ENABLED > 0
|
||||
eMBErrorCode
|
||||
eMBTCPInit( USHORT ucTCPPort )
|
||||
{
|
||||
|
|
|
@ -339,7 +339,7 @@ xMBMasterRTUTimerT35Expired(void)
|
|||
break;
|
||||
|
||||
/* An error occured while receiving the frame. */
|
||||
case STATE_RX_ERROR:
|
||||
case STATE_M_RX_ERROR:
|
||||
break;
|
||||
|
||||
/* Function called in an illegal state. */
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "mbframe.h"
|
||||
#include "mbport.h"
|
||||
|
||||
#if MB_SLAVER_TCP_ENABLED > 0
|
||||
#if MB_SLAVE_TCP_ENABLED > 0
|
||||
|
||||
/* ----------------------- Defines ------------------------------------------*/
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
#define PR_END_EXTERN_C }
|
||||
|
||||
//TODO 暂时先写B13引脚,等组网测试时再确认
|
||||
#define SLAVER_RS485_SEND_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
|
||||
#define SLAVER_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
|
||||
#define SLAVE_RS485_SEND_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
|
||||
#define SLAVE_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
|
||||
#define MASTER_RS485_SEND_MODE GPIO_SetBits(GPIOB,GPIO_Pin_13)
|
||||
#define MASTER_RS485_RECEIVE_MODE GPIO_ResetBits(GPIOB,GPIO_Pin_13)
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ void vMBPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
|
|||
{
|
||||
if (xRxEnable)
|
||||
{
|
||||
SLAVER_RS485_RECEIVE_MODE;
|
||||
SLAVE_RS485_RECEIVE_MODE;
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SLAVER_RS485_SEND_MODE;
|
||||
SLAVE_RS485_SEND_MODE;
|
||||
USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
|
||||
}
|
||||
if (xTxEnable)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef USER_MODBUS_SLAVER_H
|
||||
#define USER_MODBUS_SLAVER_H
|
||||
#ifndef USER_APP
|
||||
#define USER_APP
|
||||
/* ----------------------- Modbus includes ----------------------------------*/
|
||||
#include "mb.h"
|
||||
#include "mbport.h"
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -400,11 +400,6 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\APP\src\stm32f10x_it.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>UserModbusSlaver.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\APP\src\UserModbusSlaver.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpuusage.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -673,7 +668,7 @@
|
|||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>FreeModbusSlaver</GroupName>
|
||||
<GroupName>FreeModbus</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>mb.c</FileName>
|
||||
|
@ -725,6 +720,11 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\modbus\rtu\mbrtu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mbrtu_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\modbus\rtu\mbrtu_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -745,6 +745,26 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\porttimer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portevent_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\portevent_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portserial_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\portserial_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>porttimer_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\porttimer_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>user_app_s.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\user_app_s.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
|
@ -1143,11 +1163,6 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\APP\src\stm32f10x_it.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>UserModbusSlaver.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\APP\src\UserModbusSlaver.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpuusage.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -1416,7 +1431,7 @@
|
|||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>FreeModbusSlaver</GroupName>
|
||||
<GroupName>FreeModbus</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>mb.c</FileName>
|
||||
|
@ -1468,6 +1483,11 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\modbus\rtu\mbrtu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mbrtu_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\modbus\rtu\mbrtu_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -1488,6 +1508,26 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\porttimer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portevent_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\portevent_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portserial_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\portserial_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>porttimer_m.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\porttimer_m.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>user_app_s.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\FreeModbus\port\user_app_s.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue