![]() |
modbus-arduino
1.0.0
Modbus library for Arduino
|
Modbus over serial line Class. More...
#include <ModbusSerial.h>

Public Member Functions | |
| bool | config (HardwareSerial *port, long baud, byte parity=MB_PARITY_EVEN, int txenPin=-1) |
| Connect an ModbusSerial object to a hardware serial port. More... | |
| bool | config (SoftwareSerial *port, long baud, int txenPin=-1) |
| Connect an ModbusSerial object to a software serial port. More... | |
| bool | config (Serial_ *port, long baud, byte parity=MB_PARITY_EVEN, int txenPin=-1) |
| Connect an ModbusSerial object to a hardware serial port Variant in the case of an ATMEGA32U4 (Leonardo). More... | |
| byte | getSlaveId () |
| Return slave identifier. More... | |
| ModbusSerial () | |
| Default constructor. More... | |
| bool | setSlaveId (byte slaveId) |
| Change the value of slave identifier. More... | |
| void | task () |
| Task that performs all operations on MODBUS. More... | |
Public Member Functions inherited from Modbus | |
| void | addCoil (word offset, bool value=false) |
| Add a coil. More... | |
| void | addHreg (word offset, word value=0) |
| Add a holding register to the list. More... | |
| void | addIreg (word offset, word value=0) |
| Add a input register. More... | |
| void | addIsts (word offset, bool value=false) |
| Add a discrete input. More... | |
| bool | Coil (word offset, bool value) |
| Change the value of a coil This value will be returned when bus read, the master can also modify it. More... | |
| bool | Coil (word offset) |
| Return the value of a coil. More... | |
| bool | Hreg (word offset, word value) |
| Change the value of a holding register This value will be returned when bus read, the master can also modify it. More... | |
| word | Hreg (word offset) |
| Return the value of a holding register. More... | |
| bool | Ireg (word offset, word value) |
| Change the value of an input register This value will be returned when bus read. More... | |
| word | Ireg (word offset) |
| Return the value of an input register. More... | |
| bool | Ists (word offset, bool value) |
| Change the value of a discrete input This value will be returned when bus read,. More... | |
| bool | Ists (word offset) |
| Return the value of a discrete input. More... | |
| Modbus () | |
| Default constructor. More... | |
Protected Member Functions | |
| bool | receive (byte *frame) |
| bool | send (byte *frame) |
| bool | sendPDU (byte *pduframe) |
Modbus over serial line Class.
Definition at line 54 of file ModbusSerial.h.
| ModbusSerial::ModbusSerial | ( | ) |
Default constructor.
| bool ModbusSerial::config | ( | HardwareSerial * | port, |
| long | baud, | ||
| byte | parity = MB_PARITY_EVEN, |
||
| int | txenPin = -1 |
||
| ) |
Connect an ModbusSerial object to a hardware serial port.
| port | pointer on serial port to use, &Serial most of the time, or &Serial1, &Serial2 ... if available |
| baud | baudrate |
| parity | parity |
| txenPin | if an RS485 circuit is used, this corresponds to the pin number connected to the transmit enable (DE) and receive disable (/RE) pin. -1 if not used. |
| bool ModbusSerial::config | ( | SoftwareSerial * | port, |
| long | baud, | ||
| int | txenPin = -1 |
||
| ) |
Connect an ModbusSerial object to a software serial port.
| port | pointer on serial port to use |
| baud | baudrate |
| txenPin | if an RS485 circuit is used, this corresponds to the pin number connected to the transmit enable (DE) and receive disable (/RE) pin. -1 if not used. |
| bool ModbusSerial::config | ( | Serial_ * | port, |
| long | baud, | ||
| byte | parity = MB_PARITY_EVEN, |
||
| int | txenPin = -1 |
||
| ) |
Connect an ModbusSerial object to a hardware serial port Variant in the case of an ATMEGA32U4 (Leonardo).
| port | pointer on serial port to use, &Serial most of the time, or &Serial1, &Serial2 ... if available |
| baud | baudrate |
| parity | parity |
| txenPin | if an RS485 circuit is used, this corresponds to the pin number connected to the transmit enable (DE) and receive disable (/RE) pin. -1 if not used. |
| byte ModbusSerial::getSlaveId | ( | ) |
Return slave identifier.
|
protected |
|
protected |
|
protected |
| bool ModbusSerial::setSlaveId | ( | byte | slaveId | ) |
Change the value of slave identifier.
| slaveId | identifier 1-247 |
| void ModbusSerial::task | ( | ) |
Task that performs all operations on MODBUS.
Call once inside loop(), all magic here !