Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
d188fa49
R
rt-thread
项目概览
2345VOR
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d188fa49
编写于
6月 25, 2018
作者:
L
liquanqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
solve the dependency on the stm32 header file for freemodbus
上级
6ecdfca2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
16 deletion
+20
-16
components/net/freemodbus/modbus/functions/mbutils.c
components/net/freemodbus/modbus/functions/mbutils.c
+2
-2
components/net/freemodbus/modbus/rtu/mbrtu.c
components/net/freemodbus/modbus/rtu/mbrtu.c
+4
-4
components/net/freemodbus/port/portserial.c
components/net/freemodbus/port/portserial.c
+3
-3
components/net/freemodbus/port/user_mb_app.h
components/net/freemodbus/port/user_mb_app.h
+11
-7
未找到文件。
components/net/freemodbus/modbus/functions/mbutils.c
浏览文件 @
d188fa49
...
...
@@ -53,8 +53,8 @@ xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits,
USHORT
usNPreBits
;
USHORT
usValue
=
ucValue
;
assert_param
(
ucNBits
<=
8
);
assert_param
(
(
size_t
)
BITS_UCHAR
==
sizeof
(
UCHAR
)
*
8
);
RT_ASSERT
(
ucNBits
<=
8
);
RT_ASSERT
(
(
size_t
)
BITS_UCHAR
==
sizeof
(
UCHAR
)
*
8
);
/* Calculate byte offset for first byte containing the bit values starting
* at usBitOffset. */
...
...
components/net/freemodbus/modbus/rtu/mbrtu.c
浏览文件 @
d188fa49
...
...
@@ -153,7 +153,7 @@ eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength )
eMBErrorCode
eStatus
=
MB_ENOERR
;
ENTER_CRITICAL_SECTION
(
);
assert_param
(
usRcvBufferPos
<
MB_SER_PDU_SIZE_MAX
);
RT_ASSERT
(
usRcvBufferPos
<
MB_SER_PDU_SIZE_MAX
);
/* Length and CRC check */
if
(
(
usRcvBufferPos
>=
MB_SER_PDU_SIZE_MIN
)
...
...
@@ -226,7 +226,7 @@ xMBRTUReceiveFSM( void )
BOOL
xTaskNeedSwitch
=
FALSE
;
UCHAR
ucByte
;
assert_param
(
eSndState
==
STATE_TX_IDLE
);
RT_ASSERT
(
eSndState
==
STATE_TX_IDLE
);
/* Always read the character. */
(
void
)
xMBPortSerialGetByte
(
(
CHAR
*
)
&
ucByte
);
...
...
@@ -285,7 +285,7 @@ xMBRTUTransmitFSM( void )
{
BOOL
xNeedPoll
=
FALSE
;
assert_param
(
eRcvState
==
STATE_RX_IDLE
);
RT_ASSERT
(
eRcvState
==
STATE_RX_IDLE
);
switch
(
eSndState
)
{
...
...
@@ -342,7 +342,7 @@ xMBRTUTimerT35Expired( void )
/* Function called in an illegal state. */
default:
assert_param
(
(
eRcvState
==
STATE_RX_INIT
)
||
RT_ASSERT
(
(
eRcvState
==
STATE_RX_INIT
)
||
(
eRcvState
==
STATE_RX_RCV
)
||
(
eRcvState
==
STATE_RX_ERROR
)
);
break
;
}
...
...
components/net/freemodbus/port/portserial.c
浏览文件 @
d188fa49
...
...
@@ -56,7 +56,7 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
* set 485 mode receive and transmit control IO
* @note MODBUS_SLAVE_RT_CONTROL_PIN_INDEX need be defined by user
*/
rt_pin_mode
(
MODBUS_SLAVE_RT_CONTROL_PIN_INDEX
,
PIN_MODE_OUTPUT
);
//
rt_pin_mode(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
/* set serial name */
if
(
ucPORT
==
1
)
{
...
...
@@ -127,12 +127,12 @@ void vMBPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
/* enable RX interrupt */
serial
->
ops
->
control
(
serial
,
RT_DEVICE_CTRL_SET_INT
,
(
void
*
)
RT_DEVICE_FLAG_INT_RX
);
/* switch 485 to receive mode */
rt_pin_write
(
MODBUS_SLAVE_RT_CONTROL_PIN_INDEX
,
PIN_LOW
);
//
rt_pin_write(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_LOW);
}
else
{
/* switch 485 to transmit mode */
rt_pin_write
(
MODBUS_SLAVE_RT_CONTROL_PIN_INDEX
,
PIN_HIGH
);
//
rt_pin_write(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_HIGH);
/* disable RX interrupt */
serial
->
ops
->
control
(
serial
,
RT_DEVICE_CTRL_CLR_INT
,
(
void
*
)
RT_DEVICE_FLAG_INT_RX
);
}
...
...
components/net/freemodbus/port/user_mb_app.h
浏览文件 @
d188fa49
...
...
@@ -12,10 +12,10 @@
#define S_DISCRETE_INPUT_NDISCRETES 16
#define S_COIL_START 0
#define S_COIL_NCOILS 64
#define S_REG_INPUT_START
0
#define S_REG_INPUT_NREGS
100
#define S_REG_INPUT_START
(0x0000)
#define S_REG_INPUT_NREGS
(0x0006 - 0x0000)
#define S_REG_HOLDING_START 0
#define S_REG_HOLDING_NREGS
100
#define S_REG_HOLDING_NREGS
(0x004B)
/* salve mode: holding register's all address */
#define S_HD_RESERVE 0
/* salve mode: input register's all address */
...
...
@@ -24,15 +24,19 @@
#define S_CO_RESERVE 0
/* salve mode: discrete's all address */
#define S_DI_RESERVE 0
/* slave mode: holding register"s startup address */
#define S_SYSTEM_START_ADDR 0x003A
#define S_SYSTEM_SLAVE_ID_ADDR 0x0040
#define S_SYSTEM_KEEP_TEMP 0x0009
/* -----------------------Master Defines -------------------------------------*/
#define M_DISCRETE_INPUT_START
0
#define M_DISCRETE_INPUT_START
1
#define M_DISCRETE_INPUT_NDISCRETES 16
#define M_COIL_START
0
#define M_COIL_START
1
#define M_COIL_NCOILS 64
#define M_REG_INPUT_START
0
#define M_REG_INPUT_START
1
#define M_REG_INPUT_NREGS 100
#define M_REG_HOLDING_START
0
#define M_REG_HOLDING_START
1
#define M_REG_HOLDING_NREGS 100
/* master mode: holding register's all address */
#define M_HD_RESERVE 0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录