mirror of
https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32.git
synced 2025-02-13 19:29:15 +08:00
2、【修改】FreeModbus的port文件夹下相关文件的命名方式,从机保留FreeModbus原有的文件,主机则在文件名后面增加“_m”以区分,尽量保证FreeModbus源码的统一性; 3、【增加】FreeModbus主机初始化、使能、失能及定时器状态机相关方法,定时器超时状态机还需要后期完善,发送状态机及接收状态机还未实现; Signed-off-by: armink <armink.ztl@gmail.com>
35 lines
1.6 KiB
C
35 lines
1.6 KiB
C
#ifndef USER_MODBUS_SLAVER_H
|
|
#define USER_MODBUS_SLAVER_H
|
|
/* ----------------------- Modbus includes ----------------------------------*/
|
|
#include "mb.h"
|
|
#include "mbport.h"
|
|
/* ----------------------- Defines ------------------------------------------*/
|
|
#define DISCRETE_INPUT_START 1
|
|
#define DISCRETE_INPUT_NDISCRETES 16
|
|
#define COIL_START 1
|
|
#define COIL_NCOILS 64
|
|
#define REG_INPUT_START 1
|
|
#define REG_INPUT_NREGS 100
|
|
#define REG_HOLDING_START 1
|
|
#define REG_HOLDING_NREGS 100
|
|
|
|
//===========================在保持寄存器中,各个地址对应的功能定义========================
|
|
#define HD_RESERVE 0 //保留
|
|
#define HD_CPU_USAGE_MAJOR 1 //当前CPU利用率的整数位
|
|
#define HD_CPU_USAGE_MINOR 2 //当前CPU利用率的小数位
|
|
|
|
//===========================在输入寄存器中,各个地址对应的功能定义========================
|
|
#define IN_RESERVE 0 //保留
|
|
|
|
//===========================在线圈中,各个地址对应的功能定义============================
|
|
#define CO_RESERVE 2 //保留
|
|
|
|
//===========================在离散输入中,各个地址对应的功能定义=========================
|
|
#define DI_RESERVE 1 //保留
|
|
|
|
/*--------------------------Extern Functions------------------------------------*/
|
|
extern UCHAR xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits );
|
|
extern void xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits,UCHAR ucValue );
|
|
|
|
#endif
|