Modbus Master and Slave for Arduino  1.2
Arduino library for implementing a Modbus Master or Slave through Serial port
Functions
Modbus Object Instantiation/Initialization

Functions

 Modbus::Modbus ()
 Default Constructor for Master through Serial. More...
 
void Modbus::begin (long u32speed)
 Initialize class object. More...
 
void Modbus::setID (uint8_t u8id)
 write new ID for the slave More...
 
uint8_t Modbus::getID ()
 get slave ID between 1 and 247 More...
 
void Modbus::setTimeOut (uint16_t u16timeout)
 write communication watch-dog timer More...
 

Detailed Description

Function Documentation

void Modbus::begin ( long  u32speed)

Initialize class object.

Sets up the serial port using specified baud rate. Call once class has been instantiated, typically within setup().

See Also
http://arduino.cc/en/Serial/Begin#.Uy4CJ6aKlHY
Parameters
speedbaud rate, in standard increments (300..115200)
configdata frame settings (data length, parity and stop bits)

Definition at line 250 of file ModbusRtu.h.

uint8_t Modbus::getID ( )

get slave ID between 1 and 247

Method to read current slave ID address.

Returns
u8id current slave address between 1 and 247

Definition at line 323 of file ModbusRtu.h.

Modbus::Modbus ( )

Default Constructor for Master through Serial.

Definition at line 204 of file ModbusRtu.h.

void Modbus::setID ( uint8_t  u8id)

write new ID for the slave

Method to write a new slave ID address.

Parameters
u8idnew slave address between 1 and 247

Definition at line 310 of file ModbusRtu.h.

void Modbus::setTimeOut ( uint16_t  u16timeOut)

write communication watch-dog timer

Initialize time-out parameter.

Call once class has been instantiated, typically within setup(). The time-out timer is reset each time that there is a successful communication between Master and Slave. It works for both.

Parameters
time-outvalue (ms)

Definition at line 338 of file ModbusRtu.h.