modbus-arduino  1.0.0
Modbus library for Arduino
Modbus Class Reference

Modbus base class. More...

#include <Modbus.h>

Inheritance diagram for Modbus:
Inheritance graph

Public Member Functions

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...
 

Detailed Description

Modbus base class.

Definition at line 53 of file Modbus.h.

Constructor & Destructor Documentation

Modbus::Modbus ( )

Default constructor.

Member Function Documentation

void Modbus::addCoil ( word  offset,
bool  value = false 
)

Add a coil.

Parameters
offsetcoil offset (PDU addressing: 0-9999)
valuedefault value
void Modbus::addHreg ( word  offset,
word  value = 0 
)

Add a holding register to the list.

Parameters
offsetregister offset (PDU addressing: 0-9999)
valuedefault value
void Modbus::addIreg ( word  offset,
word  value = 0 
)

Add a input register.

Parameters
offsetregister offset (PDU addressing: 0-9999)
valuedefault value
void Modbus::addIsts ( word  offset,
bool  value = false 
)

Add a discrete input.

Parameters
offsetinput offset (PDU addressing: 0-9999)
valuedefault value
bool Modbus::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.

Parameters
offsetregister offset (PDU addressing: 0-9999)
valuenew value
Returns
true, false if coil not found.
bool Modbus::Coil ( word  offset)

Return the value of a coil.

Parameters
offsetregister offset (PDU addressing: 0-9999)
Returns
coil value
bool Modbus::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.

Parameters
offsetregister offset (PDU addressing: 0-9999)
valuenew value
Returns
true, false if register not found.
word Modbus::Hreg ( word  offset)

Return the value of a holding register.

Parameters
offsetregister offset (PDU addressing: 0-9999)
Returns
register value
bool Modbus::Ireg ( word  offset,
word  value 
)

Change the value of an input register This value will be returned when bus read.

Parameters
offsetregister offset (PDU addressing: 0-9999)
valuenew value
Returns
true, false if register not found.
word Modbus::Ireg ( word  offset)

Return the value of an input register.

Parameters
offsetregister offset (PDU addressing: 0-9999)
Returns
register value
bool Modbus::Ists ( word  offset,
bool  value 
)

Change the value of a discrete input This value will be returned when bus read,.

Parameters
offsetinput offset (PDU addressing: 0-9999)
valuenew value
Returns
true, false if input not found.
bool Modbus::Ists ( word  offset)

Return the value of a discrete input.

Parameters
offsetinput offset (PDU addressing: 0-9999)
Returns
input value