Modbus Master and Slave for Arduino
1.2
Arduino library for implementing a Modbus Master or Slave through Serial port
|
Go to the source code of this file.
Classes | |
struct | modbus_t |
Master query structure: This includes all the necessary fields to make the Master generate a Modbus query. A Master may keep several of these structures and send them cyclically or use them according to program needs. More... | |
class | Modbus |
Arduino class library for communicating with Modbus devices over USB/RS232/485 (via RTU protocol). More... | |
Macros | |
#define | T35 5 |
#define | MAX_BUFFER 64 |
maximum size for the communication buffer in bytes More... | |
Enumerations | |
enum | { RESPONSE_SIZE = 6, EXCEPTION_SIZE = 3, CHECKSUM_SIZE = 2 } |
enum | MESSAGE { ID = 0, FUNC, ADD_HI, ADD_LO, NB_HI, NB_LO, BYTE_CNT } |
Indexes to telegram frame positions. More... | |
enum | MB_FC { MB_FC_NONE = 0, MB_FC_READ_COILS = 1, MB_FC_READ_DISCRETE_INPUT = 2, MB_FC_READ_REGISTERS = 3, MB_FC_READ_INPUT_REGISTER = 4, MB_FC_WRITE_COIL = 5, MB_FC_WRITE_REGISTER = 6, MB_FC_WRITE_MULTIPLE_COILS = 15, MB_FC_WRITE_MULTIPLE_REGISTERS = 16 } |
Modbus function codes summary. These are the implement function codes either for Master or for Slave. More... | |
enum | COM_STATES { COM_IDLE = 0, COM_WAITING = 1 } |
enum | ERR_LIST { ERR_NOT_MASTER = -1, ERR_POLLING = -2, ERR_BUFF_OVERFLOW = -3, ERR_BAD_CRC = -4, ERR_EXCEPTION = -5 } |
enum | { NO_REPLY = 255, EXC_FUNC_CODE = 1, EXC_ADDR_RANGE = 2, EXC_REGS_QUANT = 3, EXC_EXECUTE = 4 } |
Variables | |
const unsigned char | fctsupported [] |
Arduino library for communicating with Modbus devices over RS232/USB/485 via RTU protocol.
Further information: http://modbus.org/ http://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License.
This library 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file ModbusRtu.h.
#define MAX_BUFFER 64 |
maximum size for the communication buffer in bytes
Definition at line 133 of file ModbusRtu.h.
#define T35 5 |
Definition at line 132 of file ModbusRtu.h.
anonymous enum |
Enumerator | |
---|---|
RESPONSE_SIZE | |
EXCEPTION_SIZE | |
CHECKSUM_SIZE |
Definition at line 57 of file ModbusRtu.h.
anonymous enum |
Enumerator | |
---|---|
NO_REPLY | |
EXC_FUNC_CODE | |
EXC_ADDR_RANGE | |
EXC_REGS_QUANT | |
EXC_EXECUTE |
Definition at line 113 of file ModbusRtu.h.
enum COM_STATES |
Enumerator | |
---|---|
COM_IDLE | |
COM_WAITING |
Definition at line 99 of file ModbusRtu.h.
enum ERR_LIST |
Enumerator | |
---|---|
ERR_NOT_MASTER | |
ERR_POLLING | |
ERR_BUFF_OVERFLOW | |
ERR_BAD_CRC | |
ERR_EXCEPTION |
Definition at line 105 of file ModbusRtu.h.
enum MB_FC |
Modbus function codes summary. These are the implement function codes either for Master or for Slave.
Definition at line 87 of file ModbusRtu.h.
enum MESSAGE |
Indexes to telegram frame positions.
Definition at line 68 of file ModbusRtu.h.
const unsigned char fctsupported[] |
Definition at line 121 of file ModbusRtu.h.