Definitions common to Modbus/TCP client and server. More...
#include "core/net.h"
Go to the source code of this file.
Macros | |
#define | MODBUS_TCP_PORT 502 |
#define | MODBUS_TCP_SECURE_PORT 802 |
#define | MODBUS_PROTOCOL_ID 0 |
#define | MODBUS_DEFAULT_UNIT_ID 255 |
#define | MODBUS_MAX_PDU_SIZE 253 |
#define | MODBUS_MAX_ADU_SIZE 260 |
#define | MODBUS_FUNCTION_CODE_MASK 0x7F |
#define | MODBUS_EXCEPTION_MASK 0x80 |
#define | MODBUS_SET_COIL(a, n) ((a)[(n) / 8] |= (1 << ((n) % 8))) |
#define | MODBUS_RESET_COIL(a, n) ((a)[(n) / 8] &= ~(1 << ((n) % 8))) |
#define | MODBUS_TEST_COIL(a, n) ((a[(n) / 8] >> ((n) % 8)) & 1) |
Detailed Description
Definitions common to Modbus/TCP client and server.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file modbus_common.h.
Macro Definition Documentation
◆ MODBUS_DEFAULT_UNIT_ID
#define MODBUS_DEFAULT_UNIT_ID 255 |
Definition at line 45 of file modbus_common.h.
◆ MODBUS_EXCEPTION_MASK
#define MODBUS_EXCEPTION_MASK 0x80 |
Definition at line 55 of file modbus_common.h.
◆ MODBUS_FUNCTION_CODE_MASK
#define MODBUS_FUNCTION_CODE_MASK 0x7F |
Definition at line 53 of file modbus_common.h.
◆ MODBUS_MAX_ADU_SIZE
#define MODBUS_MAX_ADU_SIZE 260 |
Definition at line 50 of file modbus_common.h.
◆ MODBUS_MAX_PDU_SIZE
#define MODBUS_MAX_PDU_SIZE 253 |
Definition at line 48 of file modbus_common.h.
◆ MODBUS_PROTOCOL_ID
#define MODBUS_PROTOCOL_ID 0 |
Definition at line 43 of file modbus_common.h.
◆ MODBUS_RESET_COIL
Definition at line 60 of file modbus_common.h.
◆ MODBUS_SET_COIL
Definition at line 58 of file modbus_common.h.
◆ MODBUS_TCP_PORT
#define MODBUS_TCP_PORT 502 |
Definition at line 38 of file modbus_common.h.
◆ MODBUS_TCP_SECURE_PORT
#define MODBUS_TCP_SECURE_PORT 802 |
Definition at line 40 of file modbus_common.h.
◆ MODBUS_TEST_COIL
Definition at line 62 of file modbus_common.h.
Enumeration Type Documentation
◆ ModbusCoilState
enum ModbusCoilState |
Coil states.
Enumerator | |
---|---|
MODBUS_COIL_STATE_OFF | |
MODBUS_COIL_STATE_ON |
Definition at line 120 of file modbus_common.h.
◆ ModbusExceptionCode
enum ModbusExceptionCode |
Modbus exception codes.
Definition at line 102 of file modbus_common.h.
◆ ModbusFunctionCode
enum ModbusFunctionCode |
Modbus functions codes.
Definition at line 74 of file modbus_common.h.
Variable Documentation
◆ __packed_struct
typedef __packed_struct |
MBAP header (Modbus Application Protocol)
Exception response PDU.
Read/Write Multiple Registers response PDU.
Read/Write Multiple Registers request PDU.
Mask Write Register response PDU.
Mask Write Register request PDU.
Write Multiple Registers response PDU.
Write Multiple Registers request PDU.
Write Multiple Coils response PDU.
Write Multiple Coils request PDU.
Write Single Register response PDU.
Write Single Register request PDU.
Write Single Coil response PDU.
Write Single Coil request PDU.
Read Holding Input response PDU.
Read Holding Input request PDU.
Read Holding Registers response PDU.
Read Holding Registers request PDU.
Read Discrete Inputs response PDU.
Read Discrete Inputs request PDU.
Read Coils response PDU.
Read Coils request PDU.
Definition at line 139 of file modbus_common.h.
◆ andMask
uint16_t andMask |
Definition at line 353 of file modbus_common.h.
◆ byteCount
uint8_t byteCount |
Definition at line 168 of file modbus_common.h.
◆ coilStatus
uint8_t coilStatus[] |
Definition at line 169 of file modbus_common.h.
◆ exceptionCode
uint8_t exceptionCode |
Definition at line 406 of file modbus_common.h.
◆ inputStatus
uint8_t inputStatus[] |
Definition at line 193 of file modbus_common.h.
◆ length
uint16_t length |
Definition at line 143 of file modbus_common.h.
◆ ModbusExceptionResp
ModbusExceptionResp |
Definition at line 407 of file modbus_common.h.
◆ ModbusHeader
ModbusHeader |
Definition at line 146 of file modbus_common.h.
◆ ModbusMaskWriteRegReq
ModbusMaskWriteRegReq |
Definition at line 355 of file modbus_common.h.
◆ ModbusMaskWriteRegResp
ModbusMaskWriteRegResp |
Definition at line 368 of file modbus_common.h.
◆ ModbusReadCoilsReq
ModbusReadCoilsReq |
Definition at line 158 of file modbus_common.h.
◆ ModbusReadCoilsResp
ModbusReadCoilsResp |
Definition at line 170 of file modbus_common.h.
◆ ModbusReadDiscreteInputsReq
ModbusReadDiscreteInputsReq |
Definition at line 182 of file modbus_common.h.
◆ ModbusReadDiscreteInputsResp
ModbusReadDiscreteInputsResp |
Definition at line 194 of file modbus_common.h.
◆ ModbusReadHoldingRegsReq
ModbusReadHoldingRegsReq |
Definition at line 206 of file modbus_common.h.
◆ ModbusReadHoldingRegsResp
ModbusReadHoldingRegsResp |
Definition at line 218 of file modbus_common.h.
◆ ModbusReadInputRegsReq
ModbusReadInputRegsReq |
Definition at line 230 of file modbus_common.h.
◆ ModbusReadInputRegsResp
ModbusReadInputRegsResp |
Definition at line 242 of file modbus_common.h.
◆ ModbusReadWriteMultipleRegsReq
ModbusReadWriteMultipleRegsReq |
Definition at line 384 of file modbus_common.h.
◆ ModbusReadWriteMultipleRegsResp
ModbusReadWriteMultipleRegsResp |
Definition at line 396 of file modbus_common.h.
◆ ModbusWriteMultipleCoilsReq
ModbusWriteMultipleCoilsReq |
Definition at line 304 of file modbus_common.h.
◆ ModbusWriteMultipleCoilsResp
ModbusWriteMultipleCoilsResp |
Definition at line 316 of file modbus_common.h.
◆ ModbusWriteMultipleRegsReq
ModbusWriteMultipleRegsReq |
Definition at line 330 of file modbus_common.h.
◆ ModbusWriteMultipleRegsResp
ModbusWriteMultipleRegsResp |
Definition at line 342 of file modbus_common.h.
◆ ModbusWriteSingleCoilReq
ModbusWriteSingleCoilReq |
Definition at line 254 of file modbus_common.h.
◆ ModbusWriteSingleCoilResp
ModbusWriteSingleCoilResp |
Definition at line 266 of file modbus_common.h.
◆ ModbusWriteSingleRegReq
ModbusWriteSingleRegReq |
Definition at line 278 of file modbus_common.h.
◆ ModbusWriteSingleRegResp
ModbusWriteSingleRegResp |
Definition at line 290 of file modbus_common.h.
◆ orMask
uint16_t orMask |
Definition at line 354 of file modbus_common.h.
◆ outputAddr
uint16_t outputAddr |
Definition at line 252 of file modbus_common.h.
◆ outputValue
uint8_t outputValue |
Definition at line 253 of file modbus_common.h.
◆ pdu
uint8_t pdu[] |
Definition at line 145 of file modbus_common.h.
◆ protocolId
uint16_t protocolId |
Definition at line 142 of file modbus_common.h.
◆ quantityOfCoils
uint16_t quantityOfCoils |
Definition at line 157 of file modbus_common.h.
◆ quantityOfInputs
uint16_t quantityOfInputs |
Definition at line 181 of file modbus_common.h.
◆ quantityOfOutputs
uint16_t quantityOfOutputs |
Definition at line 301 of file modbus_common.h.
◆ quantityOfRegs
uint16_t quantityOfRegs |
Definition at line 205 of file modbus_common.h.
◆ quantityToRead
uint16_t quantityToRead |
Definition at line 379 of file modbus_common.h.
◆ quantityToWrite
uint16_t quantityToWrite |
Definition at line 381 of file modbus_common.h.
◆ readByteCount
uint8_t readByteCount |
Definition at line 394 of file modbus_common.h.
◆ readRegValue
uint16_t readRegValue[] |
Definition at line 395 of file modbus_common.h.
◆ readStartingAddr
uint16_t readStartingAddr |
Definition at line 378 of file modbus_common.h.
◆ referenceAddr
uint16_t referenceAddr |
Definition at line 352 of file modbus_common.h.
◆ regAddr
uint16_t regAddr |
Definition at line 276 of file modbus_common.h.
◆ regValue
uint16_t regValue |
Definition at line 217 of file modbus_common.h.
◆ startingAddr
uint16_t startingAddr |
Definition at line 156 of file modbus_common.h.
◆ unitId
uint8_t unitId |
Definition at line 144 of file modbus_common.h.
◆ writeByteCount
uint8_t writeByteCount |
Definition at line 382 of file modbus_common.h.
◆ writeRegValue
uint16_t writeRegValue[] |
Definition at line 383 of file modbus_common.h.
◆ writeStartingAddr
uint16_t writeStartingAddr |
Definition at line 380 of file modbus_common.h.