Arduino class library for communicating with Modbus devices over USB/RS232/485 (via RTU protocol).
More...
#include <ModbusRtu.h>
|
void | buildException (uint8_t u8exception) |
| This method builds an exception message. More...
|
|
uint16_t | calcCRC (uint8_t u8length) |
| This method calculates CRC. More...
|
|
void | get_FC1 () |
|
void | get_FC3 () |
|
int8_t | getRxBuffer () |
| This method moves Serial buffer data to the Modbus au8Buffer. More...
|
|
void | init (uint8_t u8id) |
|
void | init (uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin) |
|
int8_t | process_FC1 (uint16_t *regs, uint8_t u8size) |
| This method processes functions 1 & 2 This method reads a bit array and transfers it to the master. More...
|
|
int8_t | process_FC15 (uint16_t *regs, uint8_t u8size) |
| This method processes function 15 This method writes a bit array assigned by the master. More...
|
|
int8_t | process_FC16 (uint16_t *regs, uint8_t u8size) |
| This method processes function 16 This method writes a word array assigned by the master. More...
|
|
int8_t | process_FC3 (uint16_t *regs, uint8_t u8size) |
| This method processes functions 3 & 4 This method reads a word array and transfers it to the master. More...
|
|
int8_t | process_FC5 (uint16_t *regs, uint8_t u8size) |
| This method processes function 5 This method writes a value assigned by the master to a single bit. More...
|
|
int8_t | process_FC6 (uint16_t *regs, uint8_t u8size) |
| This method processes function 6 This method writes a value assigned by the master to a single word. More...
|
|
void | sendTxBuffer () |
| This method transmits au8Buffer to Serial line. Only if u8txenpin != 0, there is a flow handling in order to keep the RS485 transceiver in output state as long as the message is being sent. This is done with UCSRxA register. The CRC is appended to the buffer before starting to send it. More...
|
|
uint8_t | validateAnswer () |
| This method validates master incoming messages. More...
|
|
uint8_t | validateRequest () |
| This method validates slave incoming messages. More...
|
|
Arduino class library for communicating with Modbus devices over USB/RS232/485 (via RTU protocol).
Definition at line 152 of file ModbusRtu.h.
◆ Modbus() [1/3]
Modbus::Modbus |
( |
uint8_t |
u8id, |
|
|
uint8_t |
u8serno |
|
) |
| |
◆ Modbus() [2/3]
Modbus::Modbus |
( |
uint8_t |
u8id, |
|
|
uint8_t |
u8serno, |
|
|
uint8_t |
u8txenpin |
|
) |
| |
◆ Modbus() [3/3]
Modbus::Modbus |
( |
uint8_t |
u8id | ) |
|
◆ begin()
◆ clearError()
void Modbus::clearError |
( |
| ) |
|
◆ end()
finish any communication and release serial communication port
◆ getTimeOut()
uint16_t Modbus::getTimeOut |
( |
| ) |
|
get communication watch-dog timer value
◆ init() [1/2]
void Modbus::init |
( |
uint8_t |
u8id | ) |
|
|
private |
◆ init() [2/2]
void Modbus::init |
( |
uint8_t |
u8id, |
|
|
uint8_t |
u8serno, |
|
|
uint8_t |
u8txenpin |
|
) |
| |
|
private |
◆ isLocked()
bool Modbus::isLocked |
( |
| ) |
|
◆ au16regs
uint16_t* Modbus::au16regs |
|
private |
◆ au8Buffer
◆ currentQuery
◆ debugSend
◆ port
HardwareSerial* Modbus::port |
|
private |
Pointer to Serial class object.
Definition at line 155 of file ModbusRtu.h.
◆ rxBuffer
◆ rxSize
◆ softPort
SoftwareSerial* Modbus::softPort |
|
private |
Pointer to SoftwareSerial class object.
Definition at line 156 of file ModbusRtu.h.
◆ u16errCnt
uint16_t Modbus::u16errCnt |
|
private |
◆ u16InCnt
uint16_t Modbus::u16InCnt |
|
private |
◆ u16OutCnt
uint16_t Modbus::u16OutCnt |
|
private |
◆ u16timeOut
uint16_t Modbus::u16timeOut |
|
private |
◆ u32time
◆ u32timeOut
uint32_t Modbus::u32timeOut |
|
private |
◆ u8BufferSize
uint8_t Modbus::u8BufferSize |
|
private |
◆ u8id
0=master, 1..247=slave number
Definition at line 157 of file ModbusRtu.h.
◆ u8lastError
uint8_t Modbus::u8lastError |
|
private |
◆ u8lastRec
uint8_t Modbus::u8lastRec |
|
private |
◆ u8regsize
uint8_t Modbus::u8regsize |
|
private |
◆ u8serno
serial port: 0-Serial, 1..3-Serial1..Serial3; 4: use software serial
Definition at line 158 of file ModbusRtu.h.
◆ u8state
◆ u8txenpin
uint8_t Modbus::u8txenpin |
|
private |
flow control pin: 0=USB or RS-232 mode, >0=RS-485 mode
Definition at line 159 of file ModbusRtu.h.
The documentation for this class was generated from the following file: