4
0
mirror of https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32.git synced 2025-01-27 00:47:11 +08:00
armink f16856e34c 1、【增加】FreeModbus从机,保持寄存器测试没问题,其余功能有待测试。3个IDE编译运行后,获取的CPU利用率不一致问题,有待进一步解决
2、【修改】IAR、Keil工程中启动文件,及部分CM3相关的文件,解决之前工程配置遗留下来的问题
3、【增加】RTT的CPU利用率更新至Modbus保持寄存器的功能

Signed-off-by: armink <armink.ztl@gmail.com>
2013-08-03 11:39:51 +08:00

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