1、【优化】FreeModbus主、从机回调接口内寄存器地址定义及数量只有8位的问题,统一改为16位。感谢网友 @weiweijeff 的反馈。
Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
parent
c4a9632836
commit
7eed16b188
|
@ -56,9 +56,9 @@ eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs )
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex;
|
USHORT iRegIndex;
|
||||||
USHORT * pusRegInputBuf;
|
USHORT * pusRegInputBuf;
|
||||||
UCHAR REG_INPUT_START;
|
USHORT REG_INPUT_START;
|
||||||
UCHAR REG_INPUT_NREGS;
|
USHORT REG_INPUT_NREGS;
|
||||||
UCHAR usRegInStart;
|
USHORT usRegInStart;
|
||||||
|
|
||||||
pusRegInputBuf = usSRegInBuf;
|
pusRegInputBuf = usSRegInBuf;
|
||||||
REG_INPUT_START = S_REG_INPUT_START;
|
REG_INPUT_START = S_REG_INPUT_START;
|
||||||
|
@ -103,9 +103,9 @@ eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegi
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex;
|
USHORT iRegIndex;
|
||||||
USHORT * pusRegHoldingBuf;
|
USHORT * pusRegHoldingBuf;
|
||||||
UCHAR REG_HOLDING_START;
|
USHORT REG_HOLDING_START;
|
||||||
UCHAR REG_HOLDING_NREGS;
|
USHORT REG_HOLDING_NREGS;
|
||||||
UCHAR usRegHoldStart;
|
USHORT usRegHoldStart;
|
||||||
|
|
||||||
pusRegHoldingBuf = usSRegHoldBuf;
|
pusRegHoldingBuf = usSRegHoldBuf;
|
||||||
REG_HOLDING_START = S_REG_HOLDING_START;
|
REG_HOLDING_START = S_REG_HOLDING_START;
|
||||||
|
@ -167,9 +167,9 @@ eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegis
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex , iRegBitIndex , iNReg;
|
USHORT iRegIndex , iRegBitIndex , iNReg;
|
||||||
UCHAR * pucCoilBuf;
|
UCHAR * pucCoilBuf;
|
||||||
UCHAR COIL_START;
|
USHORT COIL_START;
|
||||||
UCHAR COIL_NCOILS;
|
USHORT COIL_NCOILS;
|
||||||
UCHAR usCoilStart;
|
USHORT usCoilStart;
|
||||||
iNReg = usNCoils / 8 + 1; //占用寄存器数量
|
iNReg = usNCoils / 8 + 1; //占用寄存器数量
|
||||||
|
|
||||||
pucCoilBuf = ucSCoilBuf;
|
pucCoilBuf = ucSCoilBuf;
|
||||||
|
@ -237,9 +237,9 @@ eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete )
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex , iRegBitIndex , iNReg;
|
USHORT iRegIndex , iRegBitIndex , iNReg;
|
||||||
UCHAR * pucDiscreteInputBuf;
|
UCHAR * pucDiscreteInputBuf;
|
||||||
UCHAR DISCRETE_INPUT_START;
|
USHORT DISCRETE_INPUT_START;
|
||||||
UCHAR DISCRETE_INPUT_NDISCRETES;
|
USHORT DISCRETE_INPUT_NDISCRETES;
|
||||||
UCHAR usDiscreteInputStart;
|
USHORT usDiscreteInputStart;
|
||||||
iNReg = usNDiscrete / 8 + 1; //占用寄存器数量
|
iNReg = usNDiscrete / 8 + 1; //占用寄存器数量
|
||||||
|
|
||||||
pucDiscreteInputBuf = ucSDiscInBuf;
|
pucDiscreteInputBuf = ucSDiscInBuf;
|
||||||
|
|
|
@ -58,9 +58,9 @@ eMBMasterRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs )
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex;
|
USHORT iRegIndex;
|
||||||
USHORT * pusRegInputBuf;
|
USHORT * pusRegInputBuf;
|
||||||
UCHAR REG_INPUT_START;
|
USHORT REG_INPUT_START;
|
||||||
UCHAR REG_INPUT_NREGS;
|
USHORT REG_INPUT_NREGS;
|
||||||
UCHAR usRegInStart;
|
USHORT usRegInStart;
|
||||||
|
|
||||||
pusRegInputBuf = usMRegInBuf[ucMBMasterGetDestAddress() - 1];
|
pusRegInputBuf = usMRegInBuf[ucMBMasterGetDestAddress() - 1];
|
||||||
REG_INPUT_START = M_REG_INPUT_START;
|
REG_INPUT_START = M_REG_INPUT_START;
|
||||||
|
@ -105,9 +105,9 @@ eMBMasterRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, e
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex;
|
USHORT iRegIndex;
|
||||||
USHORT * pusRegHoldingBuf;
|
USHORT * pusRegHoldingBuf;
|
||||||
UCHAR REG_HOLDING_START;
|
USHORT REG_HOLDING_START;
|
||||||
UCHAR REG_HOLDING_NREGS;
|
USHORT REG_HOLDING_NREGS;
|
||||||
UCHAR usRegHoldStart;
|
USHORT usRegHoldStart;
|
||||||
|
|
||||||
pusRegHoldingBuf = usMRegHoldBuf[ucMBMasterGetDestAddress() - 1];
|
pusRegHoldingBuf = usMRegHoldBuf[ucMBMasterGetDestAddress() - 1];
|
||||||
REG_HOLDING_START = M_REG_HOLDING_START;
|
REG_HOLDING_START = M_REG_HOLDING_START;
|
||||||
|
@ -171,9 +171,9 @@ eMBMasterRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eM
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex , iRegBitIndex , iNReg;
|
USHORT iRegIndex , iRegBitIndex , iNReg;
|
||||||
UCHAR * pucCoilBuf;
|
UCHAR * pucCoilBuf;
|
||||||
UCHAR COIL_START;
|
USHORT COIL_START;
|
||||||
UCHAR COIL_NCOILS;
|
USHORT COIL_NCOILS;
|
||||||
UCHAR usCoilStart;
|
USHORT usCoilStart;
|
||||||
iNReg = usNCoils / 8 + 1; //占用寄存器数量
|
iNReg = usNCoils / 8 + 1; //占用寄存器数量
|
||||||
|
|
||||||
pucCoilBuf = ucMCoilBuf[ucMBMasterGetDestAddress() - 1];
|
pucCoilBuf = ucMCoilBuf[ucMBMasterGetDestAddress() - 1];
|
||||||
|
@ -243,9 +243,9 @@ eMBMasterRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscre
|
||||||
eMBErrorCode eStatus = MB_ENOERR;
|
eMBErrorCode eStatus = MB_ENOERR;
|
||||||
USHORT iRegIndex , iRegBitIndex , iNReg;
|
USHORT iRegIndex , iRegBitIndex , iNReg;
|
||||||
UCHAR * pucDiscreteInputBuf;
|
UCHAR * pucDiscreteInputBuf;
|
||||||
UCHAR DISCRETE_INPUT_START;
|
USHORT DISCRETE_INPUT_START;
|
||||||
UCHAR DISCRETE_INPUT_NDISCRETES;
|
USHORT DISCRETE_INPUT_NDISCRETES;
|
||||||
UCHAR usDiscreteInputStart;
|
USHORT usDiscreteInputStart;
|
||||||
iNReg = usNDiscrete / 8 + 1; //占用寄存器数量
|
iNReg = usNDiscrete / 8 + 1; //占用寄存器数量
|
||||||
|
|
||||||
pucDiscreteInputBuf = ucMDiscInBuf[ucMBMasterGetDestAddress() - 1];
|
pucDiscreteInputBuf = ucMDiscInBuf[ucMBMasterGetDestAddress() - 1];
|
||||||
|
|
Loading…
Reference in New Issue