FieldTalk Modbus Master PDF
FieldTalk Modbus Master PDF
Contents
1 Introduction 1
1.1 Library Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3 Design Background 9
4 Module Documentation 10
4.1 Data and Control Functions for all Modbus Protocol Flavours . . . . . . . . 10
4.2 Serial Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3 IP based Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4 Error Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.5 Device and Vendor Specific Modbus Functions . . . . . . . . . . . . . . . . 12
4.5.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.5.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Class Documentation 14
5.1 MbusRtuMasterProtocol Class Reference . . . . . . . . . . . . . . . . . . . . 14
5.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . 19
5.1.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . 19
5.1.4 Member Data Documentation . . . . . . . . . . . . . . . . . . . . . . 45
i
FieldTalk Modbus Master Library for .NET: Software manual
ii
Contents
6 License 251
7 Support 254
8 Notices 255
iii
Introduction
1 Introduction
This FieldTalk™ Modbus® Master Library for .NET provides connectivity to Modbus slave
compatible devices for VB.net and C# applications.
Industrial PC
.NET CLI
Application
Soft
PLC RTU
FieldTalk Library PLC
Typical applications are Modbus based Supervisory Control and Data Acquisition Systems
(SCADA), Modbus data concentrators, Modbus gateways, User Interfaces and Factory
Information Systems (FIS).
Features:
• Full implementation of Bit Access and 16 Bits Access Function Codes as well as a subset
of the most commonly used Diagnostics Function Codes
• Standard Modbus bit and 16-bit integer data types (coils, discretes & registers)
• Support for 32-bit integer, modulo-10000 and float data types, including Daniel/Enron
protocol extensions
• Support of Broadcasting
1
FieldTalk Modbus Master Library for .NET: Software manual
FieldTalk Library
.NET
Interop
Library
Modbus
Core
Driver
Modbus
MbusMasterFunctions
MbusSerialClientBase MbusIpClientBase
The base class MbusMasterFunctions contains all protocol unspecific functions, in partic-
ular the data and control functions defined by Modbus. All Modbus protocol flavours
inherit from this base class.
2
Introduction
The class MbusAsciiMasterProtocol implements the Modbus ASCII protocol, the class
MbusRtuMasterProtocol implements the Modbus RTU protocol. The class MbusTcp←-
MasterProtocol implements the MODBUS/TCP protocol and the class MbusRtuOverTcp←-
MasterProtocol the Encapsulated Modbus RTU master protocol (also known as RTU over
TCP or RTU/IP).
In order to use one of the four Modbus protocols, the desired Modbus protocol flavour
class has to be instantiated:
C#
VB.net
After a protocol object has been declared and opened, data and control functions can be
used:
C#
VB.net
3
FieldTalk Modbus Master Library for .NET: Software manual
Note
To utilise the multi-drop feature of Modbus, you need a multi-point network like
RS-485. In order to access a RS-485 network, you will need a protocol converter
which automatically switches between sending and transmitting operation. How-
ever some industrial hardware platforms have an embedded RS-485 line driver
and support enabling and disabling of the RS-485 transmitter via the RTS signal.
FieldTalk supports this RTS driven RS-485 mode.
4
What You should know about Modbus
5
FieldTalk Modbus Master Library for .NET: Software manual
The Modbus protocol defines these areas very loose. The distinction between inputs
and outputs and bit-addressable and register-addressable data items does not imply any
slave specific behaviour. It is very common that slave devices implement all tables as
overlapping memory area.
For each of those tables, the protocol allows a maximum of 65536 data items to be
accessed. It is slave dependant, which data items are accessible by a master. Typically a
slave implements only a small memory area, for example of 1024 bytes, to be accessed.
6
What You should know about Modbus
• Reading and Writing 32-bit integers using Daniel/Enron single register transfers
• Reading and Writing 32-bit floats using Daniel/Enron single register transfers
Modbus registers are numbered starting from 1. This is different to the conventional
programming logic where the first reference is addressed by 0.
Modbus discretes are numbered starting from 1 which addresses the most significant bit
in a 16-bit word. This is very different to the conventional programming logic where the
first reference is addressed by 0 and the least significant bit is bit 0.
The following table shows the correlation between Discrete Numbers and Bit Numbers:
When exchanging register number and discrete number parameters with FieldTalk func-
tions and methdos you have to use the Modbus register and discrete numbering scheme.
(Internally the functions will deduct 1 from the start register value before transmitting
the value to the slave device.)
7
FieldTalk Modbus Master Library for .NET: Software manual
8
Design Background
3 Design Background
FieldTalk is based on a programming language neutral but object oriented design model.
This design approach enables us to offer the protocol stack for the languages C++, C#,
Visual Basic .NET, Java and Object Pascal while maintaining similar functionality.
During the course of implementation, the usability in automation, control and other in-
dustrial environments was always kept in mind.
9
FieldTalk Modbus Master Library for .NET: Software manual
4 Module Documentation
4.1 Data and Control Functions for all Modbus Protocol Flavours
This Modbus protocol library implements the most commonly used data functions as well
as some control functions. The functions to perform PLC program download and other
device specific functions are outside the scope of this library.
All Bit Access and 16 Bits Access Modbus Function Codes have been implemented. In
addition the most frequently used Diagnostics Function Codes have been implemented.
This rich function set enables a user to solve nearly every Modbus data transfer problem.
The following table lists the supported Modbus function codes:
Remarks
When passing register numbers and discrete numbers to FieldTalk library functions
you have to use the the Modbus register and discrete numbering scheme. See
Register and Discrete Numbering Scheme. (Internally the functions will deduct 1
from the start register value before transmitting the value to the slave device.)
10
Module Documentation
11
FieldTalk Modbus Master Library for .NET: Software manual
In addition to MODBUS/TCP, the library offers implementations of both serial protocols R←-
TU and ASCII transported over TCP streams. These are implemented in the classes Mbus←-
RtuOverTcpMasterProtocol and MbusAsciiOverTcpMasterProtocol.
Also an implementation for MODBUS/TCP packets transported via UDP is available in form
of the class MbusUdpMasterProtocol.
All classes provide functions to establish and to close a TCP/IP connection to the slave as
well as data and control functions which can be used after a connection to a slave device
has been established successfully. For a more detailed description of the data and control
functions see section Data and Control Functions for all Modbus Protocol Flavours.
Using multiple instances of a MbusTcpMasterProtocol class enables concurrent protocol
transfers using multiple TCP/IP sessions. They should be executed in separate threads.
See section The MODBUS/TCP Protocol for some background information about MOD←-
BUS/TCP.
12
Module Documentation
Sends an ADAM 5000/6000 ASCII command to the device and receives the reply as ASCII
string. (e.g. ”$01M” to retrieve the module name)
Note
No broadcast supported
Parameters
command Command string. Must not be longer than 255 characters.
response Response string. A possible trailing CR is removed.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sends an ADAM 5000/6000 ASCII command to the device and receives the reply as ASCII
string. (e.g. ”$01M” to retrieve the module name)
Note
No broadcast supported
Parameters
command Command string. Must not be longer than 255 characters.
response Response string. A possible trailing CR is removed.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
13
FieldTalk Modbus Master Library for .NET: Software manual
5 Class Documentation
5.1 MbusRtuMasterProtocol Class Reference
Modbus RTU Master Protocol class
Public Attributes
• const Int32 SER_DATABITS_7 = 7
7 data bits
• const Int32 SER_DATABITS_8 = 8
8 data bits
• const Int32 SER_STOPBITS_1 = 1
1 stop bit
• const Int32 SER_STOPBITS_2 = 2
2 stop bits
• const Int32 SER_PARITY_NONE = 0
No parity
• const Int32 SER_PARITY_ODD = 1
14
Class Documentation
Odd parity
• const Int32 SER_PARITY_EVEN = 2
Even parity
Properties
• string portName [get, set]
Serial port identifier property
• Int32 baudRate [get, set]
Baud rate property in bps
• Int32 dataBits [get, set]
Data bits property
• Int32 stopBits [get, set]
Stop bits property
• Int32 parity [get, set]
Parity property
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32 numCoils)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32
numDiscretes)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 writeCoil (Int32 slaveAddr, Int32 bitAddr, bool bitVal)
Modbus function 5 (05 hex), Force Single Coil/Write Coil.
• Int32 forceMultipleCoils (Int32 slaveAddr, Int32 startRef, bool[ ] bitArr)
Modbus function 15 (0F hex), Force Multiple Coils.
• Int32 forceMultipleCoils (Int32 slaveAddr, Int32 startRef, bool[ ] bitArr, Int32 numCoils)
Modbus function 15 (0F hex), Force Multiple Coils.
15
FieldTalk Modbus Master Library for .NET: Software manual
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
16
Class Documentation
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
• Int32 readExceptionStatus (Int32 slaveAddr, out byte statusByte)
Modbus function 7 (07 hex), Read Exception Status.
• Int32 returnQueryData (Int32 slaveAddr, byte[ ] queryArr, out byte[ ] echoArr)
Modbus function code 8, sub-function 00, Return Query Data.
• Int32 restartCommunicationsOption (Int32 slaveAddr, Int32 clearEventLog)
Modbus function code 8, sub-function 01, Restart Communications Option
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
17
FieldTalk Modbus Master Library for .NET: Software manual
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
Configures 32-bit int data type functions to do a word swap
• Int32 configureBigEndianInts (Int32 slaveAddr)
Configures 32-bit int data type functions to do a word swap on a per slave basis
• void configureSwappedFloats ()
Configures float data type functions to do a word swap
• Int32 configureSwappedFloats (Int32 slaveAddr)
Configures float data type functions to do a word swap on a per slave basis
• void configureLittleEndianInts ()
Configures 32-bit int data type functions NOT to do a word swap
• Int32 configureLittleEndianInts (Int32 slaveAddr)
18
Class Documentation
Configures 32-bit int data type functions NOT to do a word swap on a per slave basis
• void configureIeeeFloats ()
Configures float data type functions NOT to do a word swap
• Int32 configureIeeeFloats (Int32 slaveAddr)
Configures float data type functions NOT to do a word swap on a per slave basis
• Int32 onfigureCountFromZero (Int32 slaveAddr)
Configures the reference counting scheme to start with zero for a slave.
Exceptions
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
19
FieldTalk Modbus Master Library for .NET: Software manual
This function opens the serial port with a specific port settings. After a port has been
opened, data and control functions can be used.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
Parameters
portName Serial port identifier (eg ”COM1”)
baudRate The port baud rate in bps (1200 - 115200, higher on some platforms)
dataBits SER_DATABITS_7: 7 data bits (ASCII protocol only), SER_DATABITS_8: 8
data bits
stopBits SER_STOPBITS_1: 1 stop bit, SER_STOPBITS_2: 2 stop bits
parity SER_PARITY_NONE: no parity, SER_PARITY_ODD: odd parity,
SER_PARITY_EVEN: even parity
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
In RS485 mode the RTS signal can be used to enable and disable the transmitter of a
RS232/RS485 converter. The RTS signal is asserted before sending data. It is cleared after
the transmit buffer has been emptied and in addition the specified delay time has elapsed.
The delay time is necessary because even the transmit buffer is already empty, the UART's
FIFO will still contain unsent characters.
The use of RTS controlled RS232/RS485 converters should be avoided if possible. It is
difficult to determine the exact time when to switch off the transmitter with non real-
time operating systems like Windows and Linux. If it is switched off to early characters
might still sit in the FIFO or the transmit register of the UART and these characters will be
lost. Hence the slave will not recognize the message. On the other hand if it is switched
off too late then the slave's message is corrupted and the master will not recognize the
message.
20
Class Documentation
Note
The delay value is indicative only and not guaranteed to be maintained. How precise
it is followed depends on the operating system used, it's scheduling priority and it's
system timer resolution.
A protocol must be closed in order to configure it.
Parameters
rtsDelay Delay time in ms (Range as 0 - 100000) which applies after the transmit
buffer is empty. 0 disables this mode.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
21
FieldTalk Modbus Master Library for .NET: Software manual
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
22
Class Documentation
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
23
FieldTalk Modbus Master Library for .NET: Software manual
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
24
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
25
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
26
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
27
FieldTalk Modbus Master Library for .NET: Software manual
Int32 slaveAddr,
Int32 regAddr,
UInt16 regVal ) [inline], [inherited]
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
28
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
29
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
30
Class Documentation
Int32 readRef,
[In,Out] Int16 [ ] readArr,
Int32 readCnt,
Int32 writeRef,
Int16 [ ] writeArr,
Int32 writeCnt ) [inline], [inherited]
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
31
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
32
Class Documentation
Int32 slaveAddr,
Int32 startRef,
[In,Out] Int32 [ ] int32Arr ) [inline], [inherited]
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
33
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
34
Class Documentation
Int32 startRef,
Int32 [ ] int32Arr,
Int32 numRegs ) [inline], [inherited]
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
35
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
36
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
37
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
38
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Delay time in ms, 0 if poll delay is switched off
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
39
FieldTalk Modbus Master Library for .NET: Software manual
Returns
Counter value
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
40
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
41
FieldTalk Modbus Master Library for .NET: Software manual
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
42
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
43
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
44
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
Returns
Package version string
45
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
46
Class Documentation
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
A protocol must be closed in order to configure it.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
47
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Public Attributes
• const Int32 SER_DATABITS_7 = 7
7 data bits
• const Int32 SER_DATABITS_8 = 8
8 data bits
• const Int32 SER_STOPBITS_1 = 1
48
Class Documentation
1 stop bit
• const Int32 SER_STOPBITS_2 = 2
2 stop bits
• const Int32 SER_PARITY_NONE = 0
No parity
• const Int32 SER_PARITY_ODD = 1
Odd parity
• const Int32 SER_PARITY_EVEN = 2
Even parity
Properties
• string portName [get, set]
Serial port identifier property
• Int32 baudRate [get, set]
Baud rate property in bps
• Int32 dataBits [get, set]
Data bits property
• Int32 stopBits [get, set]
Stop bits property
• Int32 parity [get, set]
Parity property
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32 numCoils)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32
numDiscretes)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 writeCoil (Int32 slaveAddr, Int32 bitAddr, bool bitVal)
49
FieldTalk Modbus Master Library for .NET: Software manual
50
Class Documentation
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
51
FieldTalk Modbus Master Library for .NET: Software manual
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
• Int32 setRetryCnt (Int32 retryCnt)
Configures the automatic retry setting
• Int32 getRetryCnt ()
Returns the automatic retry count
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
52
Class Documentation
Exceptions
53
FieldTalk Modbus Master Library for .NET: Software manual
This function opens the serial port. After a port has been opened, data and control
functions can be used.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This function opens the serial port with a specific port settings. After a port has been
opened, data and control functions can be used.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
Parameters
portName Serial port identifier (eg ”COM1”)
baudRate The port baud rate in bps (1200 - 115200, higher on some platforms)
dataBits SER_DATABITS_7: 7 data bits (ASCII protocol only), SER_DATABITS_8: 8
data bits
stopBits SER_STOPBITS_1: 1 stop bit, SER_STOPBITS_2: 2 stop bits
parity SER_PARITY_NONE: no parity, SER_PARITY_ODD: odd parity,
SER_PARITY_EVEN: even parity
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
In RS485 mode the RTS signal can be used to enable and disable the transmitter of a
RS232/RS485 converter. The RTS signal is asserted before sending data. It is cleared after
the transmit buffer has been emptied and in addition the specified delay time has elapsed.
54
Class Documentation
The delay time is necessary because even the transmit buffer is already empty, the UART's
FIFO will still contain unsent characters.
The use of RTS controlled RS232/RS485 converters should be avoided if possible. It is
difficult to determine the exact time when to switch off the transmitter with non real-
time operating systems like Windows and Linux. If it is switched off to early characters
might still sit in the FIFO or the transmit register of the UART and these characters will be
lost. Hence the slave will not recognize the message. On the other hand if it is switched
off too late then the slave's message is corrupted and the master will not recognize the
message.
Note
The delay value is indicative only and not guaranteed to be maintained. How precise
it is followed depends on the operating system used, it's scheduling priority and it's
system timer resolution.
A protocol must be closed in order to configure it.
Parameters
rtsDelay Delay time in ms (Range as 0 - 100000) which applies after the transmit
buffer is empty. 0 disables this mode.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
55
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
56
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
57
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
58
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
59
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
60
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
61
FieldTalk Modbus Master Library for .NET: Software manual
Int32 slaveAddr,
Int32 regAddr,
UInt16 regVal ) [inline], [inherited]
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
62
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
63
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
64
Class Documentation
Int32 readRef,
[In,Out] Int16 [ ] readArr,
Int32 readCnt,
Int32 writeRef,
Int16 [ ] writeArr,
Int32 writeCnt ) [inline], [inherited]
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
65
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
66
Class Documentation
Int32 slaveAddr,
Int32 startRef,
[In,Out] Int32 [ ] int32Arr ) [inline], [inherited]
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
67
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
68
Class Documentation
Int32 startRef,
Int32 [ ] int32Arr,
Int32 numRegs ) [inline], [inherited]
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
69
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
70
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
71
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
72
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Delay time in ms, 0 if poll delay is switched off
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
73
FieldTalk Modbus Master Library for .NET: Software manual
Returns
Counter value
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
74
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
75
FieldTalk Modbus Master Library for .NET: Software manual
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
76
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
77
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
78
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
Returns
Package version string
79
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
80
Class Documentation
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
A protocol must be closed in order to configure it.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
81
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Public Attributes
• const Int32 SER_DATABITS_7 = 7
7 data bits
• const Int32 SER_DATABITS_8 = 8
8 data bits
• const Int32 SER_STOPBITS_1 = 1
82
Class Documentation
1 stop bit
• const Int32 SER_STOPBITS_2 = 2
2 stop bits
• const Int32 SER_PARITY_NONE = 0
No parity
• const Int32 SER_PARITY_ODD = 1
Odd parity
• const Int32 SER_PARITY_EVEN = 2
Even parity
Properties
• string portName [get, set]
Serial port identifier property
• Int32 baudRate [get, set]
Baud rate property in bps
• Int32 dataBits [get, set]
Data bits property
• Int32 stopBits [get, set]
Stop bits property
• Int32 parity [get, set]
Parity property
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32 numCoils)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32
numDiscretes)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 writeCoil (Int32 slaveAddr, Int32 bitAddr, bool bitVal)
83
FieldTalk Modbus Master Library for .NET: Software manual
84
Class Documentation
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
85
FieldTalk Modbus Master Library for .NET: Software manual
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
• Int32 setRetryCnt (Int32 retryCnt)
Configures the automatic retry setting
• Int32 getRetryCnt ()
Returns the automatic retry count
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
86
Class Documentation
Exceptions
87
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This function opens the serial port with a specific port settings. After a port has been
opened, data and control functions can be used.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
Parameters
portName Serial port identifier (eg ”COM1”)
baudRate The port baud rate in bps (1200 - 115200, higher on some platforms)
dataBits SER_DATABITS_7: 7 data bits (ASCII protocol only), SER_DATABITS_8: 8
data bits
stopBits SER_STOPBITS_1: 1 stop bit, SER_STOPBITS_2: 2 stop bits
parity SER_PARITY_NONE: no parity, SER_PARITY_ODD: odd parity,
SER_PARITY_EVEN: even parity
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
88
Class Documentation
In RS485 mode the RTS signal can be used to enable and disable the transmitter of a
RS232/RS485 converter. The RTS signal is asserted before sending data. It is cleared after
the transmit buffer has been emptied and in addition the specified delay time has elapsed.
The delay time is necessary because even the transmit buffer is already empty, the UART's
FIFO will still contain unsent characters.
The use of RTS controlled RS232/RS485 converters should be avoided if possible. It is
difficult to determine the exact time when to switch off the transmitter with non real-
time operating systems like Windows and Linux. If it is switched off to early characters
might still sit in the FIFO or the transmit register of the UART and these characters will be
lost. Hence the slave will not recognize the message. On the other hand if it is switched
off too late then the slave's message is corrupted and the master will not recognize the
message.
Note
The delay value is indicative only and not guaranteed to be maintained. How precise
it is followed depends on the operating system used, it's scheduling priority and it's
system timer resolution.
A protocol must be closed in order to configure it.
Parameters
rtsDelay Delay time in ms (Range as 0 - 100000) which applies after the transmit
buffer is empty. 0 disables this mode.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
89
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
90
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
91
FieldTalk Modbus Master Library for .NET: Software manual
Int32 bitAddr,
bool bitVal ) [inline], [inherited]
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
92
Class Documentation
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
93
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
94
Class Documentation
Parameters
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
95
FieldTalk Modbus Master Library for .NET: Software manual
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
96
Class Documentation
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
97
FieldTalk Modbus Master Library for .NET: Software manual
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
98
Class Documentation
Parameters
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
99
FieldTalk Modbus Master Library for .NET: Software manual
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
100
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
101
FieldTalk Modbus Master Library for .NET: Software manual
Int32 startRef,
[In,Out] Int32 [ ] int32Arr,
Int32 numRegs ) [inline], [inherited]
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
102
Class Documentation
Parameters
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
103
FieldTalk Modbus Master Library for .NET: Software manual
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
104
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
105
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
106
Class Documentation
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Delay time in ms, 0 if poll delay is switched off
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
107
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
Returns
Counter value
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
108
Class Documentation
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
109
FieldTalk Modbus Master Library for .NET: Software manual
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
110
Class Documentation
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
111
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
112
Class Documentation
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
113
FieldTalk Modbus Master Library for .NET: Software manual
Returns
Package version string
Note
A protocol must be closed in order to configure it.
114
Class Documentation
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
A protocol must be closed in order to configure it.
Note
The Modbus standard requires two stop bits if no parity is chosen. This library is
not enforcing this but it is a recommended configuration.
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
115
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
116
Class Documentation
Properties
• override Int16 port [get, set]
TCP port property
• string hostName [get, set]
Host name
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32 numCoils)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32
numDiscretes)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 writeCoil (Int32 slaveAddr, Int32 bitAddr, bool bitVal)
Modbus function 5 (05 hex), Force Single Coil/Write Coil.
• Int32 forceMultipleCoils (Int32 slaveAddr, Int32 startRef, bool[ ] bitArr)
Modbus function 15 (0F hex), Force Multiple Coils.
• Int32 forceMultipleCoils (Int32 slaveAddr, Int32 startRef, bool[ ] bitArr, Int32 numCoils)
Modbus function 15 (0F hex), Force Multiple Coils.
117
FieldTalk Modbus Master Library for .NET: Software manual
Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers (16-bit, 32-bit
and floating point).
• Int32 readMultipleRegisters (Int32 slaveAddr, Int32 startRef, [In, Out] System.Array
regArr, Int32 numRegs)
Modbus function 3 (03 hex), Read Holding Registers/Read Multiple Registers (16-bit, 32-bit
and floating point).
• Int32 readInputRegisters (Int32 slaveAddr, Int32 startRef, [In, Out] System.Array regArr)
Modbus function 4 (04 hex), Read Input Registers (16-bit, 32-bit and floating point).
• Int32 readInputRegisters (Int32 slaveAddr, Int32 startRef, [In, Out] System.Array regArr,
Int32 numRegs)
Modbus function 4 (04 hex), Read Input Registers (16-bit, 32-bit and floating point).
• Int32 writeSingleRegister (Int32 slaveAddr, Int32 regAddr, Int16 regVal)
Modbus function 6 (06 hex), Preset Single Register/Write Single Register.
• Int32 writeSingleRegister (Int32 slaveAddr, Int32 regAddr, UInt16 regVal)
Modbus function 6 (06 hex), Preset Single Register/Write Single Register.
• Int32 writeMultipleRegisters (Int32 slaveAddr, Int32 startRef, System.Array regArr)
Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers (16-bit, 32-
bit and floating point).
• Int32 writeMultipleRegisters (Int32 slaveAddr, Int32 startRef, System.Array regArr,
Int32 numRegs)
Modbus function 16 (10 hex), Preset Multiple Registers/Write Multiple Registers (16-bit, 32-
bit and floating point).
• Int32 maskWriteRegister (Int32 slaveAddr, Int32 regAddr, Int16 andMask, Int16 or←-
Mask)
Modbus function 22 (16 hex), Mask Write Register.
• Int32 readWriteRegisters (Int32 slaveAddr, Int32 readRef, [In, Out] Int16[ ] readArr,
Int32 writeRef, Int16[ ] writeArr)
Modbus function 23 (17 hex), Read/Write Registers.
• Int32 readWriteRegisters (Int32 slaveAddr, Int32 readRef, [In, Out] Int16[ ] readArr,
Int32 readCnt, Int32 writeRef, Int16[ ] writeArr, Int32 writeCnt)
Modbus function 23 (17 hex), Read/Write Registers.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
118
Class Documentation
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
• Int32 readExceptionStatus (Int32 slaveAddr, out byte statusByte)
Modbus function 7 (07 hex), Read Exception Status.
• Int32 returnQueryData (Int32 slaveAddr, byte[ ] queryArr, out byte[ ] echoArr)
Modbus function code 8, sub-function 00, Return Query Data.
• Int32 restartCommunicationsOption (Int32 slaveAddr, Int32 clearEventLog)
Modbus function code 8, sub-function 01, Restart Communications Option
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
• Int32 setRetryCnt (Int32 retryCnt)
Configures the automatic retry setting
• Int32 getRetryCnt ()
Returns the automatic retry count
119
FieldTalk Modbus Master Library for .NET: Software manual
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
Configures 32-bit int data type functions to do a word swap
• Int32 configureBigEndianInts (Int32 slaveAddr)
Configures 32-bit int data type functions to do a word swap on a per slave basis
• void configureSwappedFloats ()
Configures float data type functions to do a word swap
• Int32 configureSwappedFloats (Int32 slaveAddr)
Configures float data type functions to do a word swap on a per slave basis
• void configureLittleEndianInts ()
Configures 32-bit int data type functions NOT to do a word swap
• Int32 configureLittleEndianInts (Int32 slaveAddr)
Configures 32-bit int data type functions NOT to do a word swap on a per slave basis
• void configureIeeeFloats ()
Configures float data type functions NOT to do a word swap
• Int32 configureIeeeFloats (Int32 slaveAddr)
Configures float data type functions NOT to do a word swap on a per slave basis
• Int32 onfigureCountFromZero (Int32 slaveAddr)
Configures the reference counting scheme to start with zero for a slave.
120
Class Documentation
Exceptions
Usually the port number remains unchanged and defaults to 502 for Modbus/TCP and
1100 for RTU over TCP. However if the port number has to be different this function must
be called before opening the connection with openProtocol().
Note
A protocol must be closed in order to configure it.
Parameters
port←- Port number to be used when opening the connection
No
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
121
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This function establishes a logical network connection between master and slave. After
a connection has been established data and control functions can be used. A TCP/IP
connection should be closed if it is no longer needed.
Parameters
hostName String with IP address or host name (eg ”127.0.0.1”)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Currently set port number
122
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
123
FieldTalk Modbus Master Library for .NET: Software manual
Int32 startRef,
[In,Out] bool [ ] bitArr ) [inline], [inherited]
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
124
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
125
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
126
Class Documentation
Parameters
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
127
FieldTalk Modbus Master Library for .NET: Software manual
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
128
Class Documentation
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
129
FieldTalk Modbus Master Library for .NET: Software manual
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
130
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
131
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
132
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
133
FieldTalk Modbus Master Library for .NET: Software manual
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
134
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
135
FieldTalk Modbus Master Library for .NET: Software manual
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
136
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
137
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
138
Class Documentation
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
139
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Delay time in ms, 0 if poll delay is switched off
140
Class Documentation
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
Returns
Counter value
141
FieldTalk Modbus Master Library for .NET: Software manual
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
142
Class Documentation
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
143
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
144
Class Documentation
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
145
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
146
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
Returns
Package version string
Note
A protocol must be closed in order to configure it.
147
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
148
Class Documentation
Properties
• override Int16 port [get, set]
TCP port property
• string hostName [get, set]
Host name
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32 numCoils)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 readInputDiscretes (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32
numDiscretes)
Modbus function 2 (02 hex), Read Inputs Status/Read Input Discretes.
• Int32 writeCoil (Int32 slaveAddr, Int32 bitAddr, bool bitVal)
149
FieldTalk Modbus Master Library for .NET: Software manual
150
Class Documentation
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
151
FieldTalk Modbus Master Library for .NET: Software manual
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
• Int32 setRetryCnt (Int32 retryCnt)
Configures the automatic retry setting
• Int32 getRetryCnt ()
Returns the automatic retry count
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
152
Class Documentation
Exceptions
153
FieldTalk Modbus Master Library for .NET: Software manual
Defaults to 1100. Must be set before opening the connection with openProtocol().
Note
A protocol must be closed in order to configure it.
Parameters
port←- Port number to be used when opening the connection
No
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This function establishes a logical network connection between master and slave. After
a connection has been established data and control functions can be used. A TCP/IP
connection should be closed if it is no longer needed.
Parameters
hostName String with IP address or host name (eg ”127.0.0.1”)
154
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Currently set port number
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
155
FieldTalk Modbus Master Library for .NET: Software manual
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
156
Class Documentation
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
157
FieldTalk Modbus Master Library for .NET: Software manual
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
158
Class Documentation
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
159
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
160
Class Documentation
Parameters
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
161
FieldTalk Modbus Master Library for .NET: Software manual
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
162
Class Documentation
System.Array regArr,
Int32 numRegs ) [inline], [inherited]
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
163
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
164
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
165
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
166
Class Documentation
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
167
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
168
Class Documentation
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
169
FieldTalk Modbus Master Library for .NET: Software manual
byte [ ] queryArr,
out byte [ ] echoArr ) [inline], [inherited]
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
170
Class Documentation
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
171
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
172
Class Documentation
Returns
Delay time in ms, 0 if poll delay is switched off
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
173
FieldTalk Modbus Master Library for .NET: Software manual
Returns
Counter value
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
174
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
175
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
176
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
177
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
178
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
Returns
Package version string
179
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
180
Class Documentation
Properties
• override Int16 port [get, set]
TCP port property
• string hostName [get, set]
Host name
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
Modbus function 1 (01 hex), Read Coil Status/Read Coils.
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr, Int32 numCoils)
181
FieldTalk Modbus Master Library for .NET: Software manual
182
Class Documentation
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
• Int32 readExceptionStatus (Int32 slaveAddr, out byte statusByte)
Modbus function 7 (07 hex), Read Exception Status.
• Int32 returnQueryData (Int32 slaveAddr, byte[ ] queryArr, out byte[ ] echoArr)
Modbus function code 8, sub-function 00, Return Query Data.
• Int32 restartCommunicationsOption (Int32 slaveAddr, Int32 clearEventLog)
Modbus function code 8, sub-function 01, Restart Communications Option
183
FieldTalk Modbus Master Library for .NET: Software manual
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
• Int32 setRetryCnt (Int32 retryCnt)
Configures the automatic retry setting
• Int32 getRetryCnt ()
Returns the automatic retry count
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
184
Class Documentation
Exceptions
185
FieldTalk Modbus Master Library for .NET: Software manual
Defaults to 23 (Telnet port). Must be set before opening the connection with
openProtocol().
Note
A protocol must be closed in order to configure it.
Parameters
port←- Port number to be used when opening the connection
No
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This function establishes a logical network connection between master and slave. After
a connection has been established data and control functions can be used. A TCP/IP
connection should be closed if it is no longer needed.
Parameters
hostName String with IP address or host name (eg ”127.0.0.1”)
186
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Currently set port number
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
187
FieldTalk Modbus Master Library for .NET: Software manual
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
188
Class Documentation
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
189
FieldTalk Modbus Master Library for .NET: Software manual
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
190
Class Documentation
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
191
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
192
Class Documentation
Parameters
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
193
FieldTalk Modbus Master Library for .NET: Software manual
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
194
Class Documentation
System.Array regArr,
Int32 numRegs ) [inline], [inherited]
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
195
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
196
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
197
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
198
Class Documentation
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
199
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
200
Class Documentation
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
201
FieldTalk Modbus Master Library for .NET: Software manual
byte [ ] queryArr,
out byte [ ] echoArr ) [inline], [inherited]
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
202
Class Documentation
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
203
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
204
Class Documentation
Returns
Delay time in ms, 0 if poll delay is switched off
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
205
FieldTalk Modbus Master Library for .NET: Software manual
Returns
Counter value
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
206
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
207
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
208
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
209
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
210
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
Returns
Package version string
211
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
212
Class Documentation
Properties
• override Int16 port [get, set]
TCP port property
• string hostName [get, set]
Host name
• Int32 timeout [get, set]
Time-out port property
• Int32 pollDelay [get, set]
Poll delay property
• Int32 retryCnt [get, set]
Retry count property
Bit Access
Table 0:00000 (Coils) and Table 1:0000 (Input Status)
• Int32 readCoils (Int32 slaveAddr, Int32 startRef, [In, Out] bool[ ] bitArr)
213
FieldTalk Modbus Master Library for .NET: Software manual
214
Class Documentation
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readMultipleMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32←-
Arr, Int32 numRegs)
Modbus function 3 (03 hex) for 32-bit modulo-10000 long int data types, Read Holding
Registers/Read Multiple Registers as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 readInputMod10000 (Int32 slaveAddr, Int32 startRef, [In, Out] Int32[ ] int32Arr,
Int32 numRegs)
Modbus function 4 (04 hex) for 32-bit modulo-10000 long int data types, Read Input Reg-
isters as modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
• Int32 writeMultipleMod10000 (Int32 slaveAddr, Int32 startRef, Int32[ ] int32Arr, Int32
numRegs)
Modbus function 16 (10 hex) for 32-bit modulo-10000 long int data types, Preset Multiple
Registers/Write Multiple Registers with modulo-10000 long int data.
Diagnostics
• Int32 readExceptionStatus (Int32 slaveAddr, out byte statusByte)
Modbus function 7 (07 hex), Read Exception Status.
• Int32 returnQueryData (Int32 slaveAddr, byte[ ] queryArr, out byte[ ] echoArr)
Modbus function code 8, sub-function 00, Return Query Data.
• Int32 restartCommunicationsOption (Int32 slaveAddr, Int32 clearEventLog)
Modbus function code 8, sub-function 01, Restart Communications Option
215
FieldTalk Modbus Master Library for .NET: Software manual
Protocol Configuration
• Int32 setTimeout (Int32 timeOut)
Configures time-out
• Int32 getTimeout ()
Returns the current time-out setting
• Int32 setPollDelay (Int32 pollDelay)
Poll delay property
• Int32 getPollDelay ()
Returns the poll delay time
• Int32 setRetryCnt (Int32 retryCnt)
Configures the automatic retry setting
• Int32 getRetryCnt ()
Returns the automatic retry count
Slave Configuration
• void configureStandard32BitMode ()
Configures all slaves for Standard 32-bit Mode.
• Int32 configureStandard32BitMode (Int32 slaveAddr)
Configures a slave for Standard 32-bit Mode.
• void configureEnron32BitMode ()
Configures all slaves for Daniel/ENRON 32-bit Mode.
• Int32 configureEnron32BitMode (Int32 slaveAddr)
Configures a slave for Daniel/ENRON 32-bit Mode.
• void configureCountFromOne ()
216
Class Documentation
Configures the reference counting scheme to start with one for all slaves.
• Int32 configureCountFromOne (Int32 slaveAddr)
Configures the reference counting scheme to start with one for a slave.
• void configureCountFromZero ()
Configures the reference counting scheme to start with zero for all slaves.
• void configureBigEndianInts ()
Configures 32-bit int data type functions to do a word swap
• Int32 configureBigEndianInts (Int32 slaveAddr)
Configures 32-bit int data type functions to do a word swap on a per slave basis
• void configureSwappedFloats ()
Configures float data type functions to do a word swap
• Int32 configureSwappedFloats (Int32 slaveAddr)
Configures float data type functions to do a word swap on a per slave basis
• void configureLittleEndianInts ()
Configures 32-bit int data type functions NOT to do a word swap
• Int32 configureLittleEndianInts (Int32 slaveAddr)
Configures 32-bit int data type functions NOT to do a word swap on a per slave basis
• void configureIeeeFloats ()
Configures float data type functions NOT to do a word swap
• Int32 configureIeeeFloats (Int32 slaveAddr)
Configures float data type functions NOT to do a word swap on a per slave basis
• Int32 onfigureCountFromZero (Int32 slaveAddr)
Configures the reference counting scheme to start with zero for a slave.
Exceptions
217
FieldTalk Modbus Master Library for .NET: Software manual
Usually the port number remains unchanged and defaults to 502 for Modbus/TCP and
1100 for RTU over TCP. However if the port number has to be different this function must
be called before opening the connection with openProtocol().
Note
A protocol must be closed in order to configure it.
Parameters
port←- Port number to be used when opening the connection
No
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This function establishes a logical network connection between master and slave. After
a connection has been established data and control functions can be used. A TCP/IP
connection should be closed if it is no longer needed.
218
Class Documentation
Parameters
hostName String with IP address or host name (eg ”127.0.0.1”)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Currently set port number
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many coils are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
219
FieldTalk Modbus Master Library for .NET: Software manual
Int32 startRef,
[In,Out] bool [ ] bitArr,
Int32 numCoils ) [inline], [inherited]
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
numCoils Number of coils to be read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read. The length of the array
determines how many inputs are read (Range: 1-2000).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
220
Class Documentation
Reads the contents of the discrete inputs (input status, 1:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which will contain the data read.
num←- Number of inputs to be read (Range: 1-2000).
Discretes
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Sets a single discrete output variable (coil, 0:00000 table) to either ON or OFF.
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
bitAddr Coil address (Range: 1 - 65536)
bitVal true sets, false clears discrete output variable
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
221
FieldTalk Modbus Master Library for .NET: Software manual
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent. The length of the array
determines how many coils are written (Range: 1-1968).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes binary values into a sequence of discrete outputs (coils, 0:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
bitArr Buffer which contains the data to be sent.
numCoils Number of coils to be written (Range: 1-1968).
222
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of the output registers (holding registers, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
223
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[]. The length of the array
determines how many registers are read (Range: 1-125 for 16-bit, 1-62
for 32-bit and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
224
Class Documentation
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array which will be filled with the data read. Accepted array types are
Int16[], UInt16[], Int32[], UInt32[] and float[].
numRegs Number of values to be read (Range: 1-125 for 16-bit, 1-62 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as signed 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
225
FieldTalk Modbus Master Library for .NET: Software manual
Int32 slaveAddr,
Int32 regAddr,
UInt16 regVal ) [inline], [inherited]
Writes a value into a single output register (holding register, 4:00000 reference).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
regAddr Register address (Range: 1 - 65536)
regVal Data to be sent as unsigned 16-bit value
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[]. The length of the array determines how
many registers are written (Range: 1-123 for 16-bit, 1-61 for 32-bit and
floats).
226
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes values into a sequence of output registers (holding registers, 4:00000 table).
Note
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start register (Range: 1 - 65536)
regArr Array with data to be sent. Accepted array types are Int16[], UInt16[],
Int32[], UInt32[] and float[].
numRegs Number of values to be written (Range: 1-123 for 16-bit, 1-61 for 32-bit
and floats).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Masks bits according to an AND and an OR mask into a single output register (holding
register, 4:00000 reference). Masking is done as follows: retVal = (currentVal AND and←-
Mask) OR (orMask AND (NOT andMask))
Note
No broadcast supported
227
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
regAddr Register address (Range: 1 - 65536)
andMask Mask to be applied as a logic AND to the register
orMask Mask to be applied as a logic OR to the register
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start registers for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read. The length of the array
determines how many registers are read (Range: 1-125).
writeRef Start registers for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent. The length of the array determines how
many registers are written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
228
Class Documentation
Int32 readRef,
[In,Out] Int16 [ ] readArr,
Int32 readCnt,
Int32 writeRef,
Int16 [ ] writeArr,
Int32 writeCnt ) [inline], [inherited]
Combines reading and writing of the output registers in one transaction (holding regis-
ters, 4:00000 table).
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
readRef Start register for reading (Range: 1 - 65536)
readArr Buffer which will contain the data read.
writeRef Start register for writing (Range: 1 - 65536)
writeArr Buffer with data to be sent.
readCnt Number of registers to be read (Range: 1-125).
writeCnt Number of registers to be written (Range: 1-121).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
229
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive output registers (holding registers, 4:00000
table) representing a modulo-10000 long int value into 32-bit int values and performs
number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
230
Class Documentation
Int32 slaveAddr,
Int32 startRef,
[In,Out] Int32 [ ] int32Arr ) [inline], [inherited]
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read. The length of the array
determines how many values are read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the contents of pairs of consecutive input registers (3:00000 table) representing
a modulo-10000 long int value into 32-bit long int values and performs number format
conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
No broadcast supported
231
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer which will be filled with the data read.
numRegs Number of values to be read (Range: 1-62).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent. The length of the array determines how
many values are written (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
232
Class Documentation
Int32 startRef,
Int32 [ ] int32Arr,
Int32 numRegs ) [inline], [inherited]
Writes long int values into pairs of output registers (holding registers, 4:00000 table)
representing a modulo-10000 long int value and performs number format conversion.
Note
Modbus does not know about any other data type than discretes and 16-bit regis-
ters. Because a modulo-10000 value is of 32-bit length, it will be transferred as two
consecutive 16-bit registers. This means that the amount of registers transferred
with this function is twice the amount of int values passed to this function.
Broadcast supported for serial protocols
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 0 - 255)
startRef Start reference (Range: 1 - 65536)
int32Arr Buffer with the data to be sent.
numRegs Number of values to be sent (Range: 1-61).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Reads the eight exception status coils within the slave device.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255)
statusByte Slave status byte. The meaning of this status byte is slave specific and
varies from device to device.
233
FieldTalk Modbus Master Library for .NET: Software manual
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
queryArr Buffer with data to be sent. The length of the array determines how
many bytes are sent and returned
echoArr Buffer which will contain the data read
Returns
BusProtocolErrors.FTALK_SUCCESS on success, FTALK_INVALID_REPLY_ERROR if re-
ply does not match query data or error code. See BusProtocolErrors for more error
codes.
Note
No broadcast supported
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
clearEventLog Flag when set to one clears in addition the slave's communication
even log.
234
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
This method can be used to implement User Defined Function Codes. The caller has
only to pass the user data to this function. The assembly of the Modbus frame (the so
called ADU) including checksums, slave address and function code and subsequentially
the transmission, is taken care of by this method.
The modbus specification reserves function codes 65-72 and 100-110 for user defined
functions.
Note
Modbus functions usually have an implied response length and therefore the num-
ber of bytes expected to be received is known at the time when sending the request.
In case of a custom Modbus function with an open or unknown response length,
this function can not be used.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255 for
serial, 0 - 255 for TCP)
functionCode Custom function code to be used for Modbus transaction (Range:
1-127)
requestData Array with data to be sent as request (not including slave address or
function code). The length of the array determines how many
request bytes are sent (Range: 0-252).
responseData Buffer which will be filled with the response data received. The
length of the array determines how many bytes are read (Range:
0-252).
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
235
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Parameters
timeOut Timeout value in ms (Range: 1 - 100000)
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Timeout value in ms
This function sets the delay time which applies between two consecutive Modbus
read/write. A value of 0 disables the poll delay.
The delay value is indicative only and not guaranteed to be maintained. How precise it
is followed depends on the operating system used, it's scheduling priority and it's system
timer resolution.
Note
A protocol must be closed in order to configure it.
Parameters
pollDelay Delay value in ms (Range: 0 - 100000), 0 disables poll delay
236
Class Documentation
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Delay time in ms, 0 if poll delay is switched off
Configures the automatic retry setting. A value of 0 disables any automatic retries.
Note
A protocol must be closed in order to configure it.
Parameters
retryCnt Retry count (Range: 0 - 10), 0 disables retries
Returns
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors
for possible error codes.
Returns
Retry count
Returns
Counter value
237
FieldTalk Modbus Master Library for .NET: Software manual
Returns
Counter value
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
In Standard 32-bit Register Mode a 32-bit value is transmitted as two consecutive 16-bit
Modbus registers.
Note
This function call also re-configures the endianess to default little-endian for 32-bit
values!
Note
This is the default mode.
238
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Some Modbus flavours like the Daniel/Enron protocol represent a 32-bit value using one
32-bit Modbus register instead of two 16-bit registers.
Note
This function call also re-configures the endianess to big-endian for 32-bit values
as defined by the Daniel/ENRON protocol!
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
239
FieldTalk Modbus Master Library for .NET: Software manual
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
This renders the reference range to be 1 to 65536 (0x10000) and register #0 is an illegal
register.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Modbus is using little-endian word order for 32-bit values. The data transfer functions
operating upon 32-bit int data types can be configured to do a word swap which enables
them to read 32-bit data correctly from a big-endian slave.
240
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Most platforms store floats in IEEE 754 little-endian order which does not need a word
swap.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
241
FieldTalk Modbus Master Library for .NET: Software manual
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Note
This is the default mode.
The data functions operating upon 32-bit float data types can be configured to do a word
swap.
Note
This is the default mode.
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
242
Class Documentation
Parameters
slaveAddr Modbus address of slave device or unit identifier (Range: 1 - 255) A value
of zero configures the behaviour for broadcasting.
Returns
BusProtocolErrors.FTALK_SUCCESS on success or BusProtocolErrors.FTALK_ILLEGAL_ARGUMENT
if argument out of range
Returns
True = open, False = closed
Returns
Package version string
243
FieldTalk Modbus Master Library for .NET: Software manual
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
Note
A protocol must be closed in order to configure it.
244
Class Documentation
Public Attributes
• const Int32 FTALK_SUCCESS = 0
Operation was successful
• const Int32 FTALK_ILLEGAL_ARGUMENT_ERROR = 1
Illegal argument error
• const Int32 FTALK_ILLEGAL_STATE_ERROR = 2
Illegal state error
• const Int32 FTALK_EVALUATION_EXPIRED = 3
Evaluation expired
• const Int32 FTALK_IO_ERROR_CLASS = 0x40
IO error class
• const Int32 FTALK_IO_ERROR = (FTALK_IO_ERROR_CLASS | 1)
IO error
• const Int32 FTALK_OPEN_ERR = (FTALK_IO_ERROR_CLASS | 2)
Port or socket open error
• const Int32 FTALK_PORT_ALREADY_OPEN = (FTALK_IO_ERROR_CLASS | 3)
Serial port already open
• const Int32 FTALK_TCPIP_CONNECT_ERR = (FTALK_IO_ERROR_CLASS | 4)
TCPIP connection error
• const Int32 FTALK_CONNECTION_WAS_CLOSED = (FTALK_IO_ERROR_CLASS | 5)
Remote peer closed TCPIP connection
• const Int32 FTALK_SOCKET_LIB_ERROR = (FTALK_IO_ERROR_CLASS | 6)
Socket library error
• const Int32 FTALK_PORT_ALREADY_BOUND = (FTALK_IO_ERROR_CLASS | 7)
TCP port already bound
• const Int32 FTALK_LISTEN_FAILED = (FTALK_IO_ERROR_CLASS | 8)
Listen failed
• const Int32 FTALK_FILEDES_EXCEEDED = (FTALK_IO_ERROR_CLASS | 9)
File descriptors exceeded
• const Int32 FTALK_PORT_NO_ACCESS = (FTALK_IO_ERROR_CLASS | 10)
No permission to access serial port or TCP port
• const Int32 FTALK_PORT_NOT_AVAIL = (FTALK_IO_ERROR_CLASS | 11)
TCP port not available
• const Int32 FTALK_BUS_PROTOCOL_ERROR_CLASS = 0x80
Fieldbus protocol error class
• const Int32 FTALK_CHECKSUM_ERROR = (FTALK_BUS_PROTOCOL_ERROR_CLASS | 1)
Checksum error
245
FieldTalk Modbus Master Library for .NET: Software manual
Parameters
errCode FieldTalk error code
246
Class Documentation
Returns
Error text string
247
FieldTalk Modbus Master Library for .NET: Software manual
Signals that the TCPIP connection was closed by the remote peer or is broken.
Signals that a received frame does not correspond either by structure or content to the
specification or does not match a previously sent query frame. A poor data link typically
causes this error.
248
Class Documentation
Signals that a fieldbus data transfer timed out. This can occur if the slave device does not
reply in time or does not reply at all. A wrong unit adress will also cause this error. In
some occasions this exception is also produced if the characters received don't constitute
a complete frame.
Signals that a fieldbus data send timed out. This can only occur if the handshake lines
are not properly set.
Signals that a Modbus exception response was received. Exception responses are sent
by a slave device instead of a normal response message if it received the query message
correctly but cannot handle the query. This error usually occurs if a master queried an
invalid or non-existing data address or if the master used a Modbus function, which is
not supported by the slave device.
Signals that an Illegal Function exception response (code 01) was received. This exception
response is sent by a slave device instead of a normal response message if a master sent
a Modbus function, which is not supported by the slave device.
Signals that an Illegal Data address exception response (code 02) was received. This
exception response is sent by a slave device instead of a normal response message if a
master queried an invalid or non-existing data ess.
Signals that a Illegal Value exception response was (code 03) received. This exception
response is sent by a slave device instead of a normal response message if a master sent
a data value, which is not an allowable value for the slave device.
249
FieldTalk Modbus Master Library for .NET: Software manual
Signals that a Slave Device Failure exception response (code 04) was received. This ex-
ception response is sent by a slave device instead of a normal response message if an
unrecoverable error occured while processing the requested action. This response is also
sent if the request would generate a response whose size exceeds the allowable data
size.
250
License
6 License
Library License
proconX Pty Ltd, Brisbane/Australia, ACN 104 080 935
Definitions
"Software" refers to the collection of files and any part hereof,
including, but not limited to, source code, programs, binary
executables, object files, libraries, images, and scripts, which are
distributed by proconX.
License Terms
251
FieldTalk Modbus Master Library for .NET: Software manual
it on.
4. You are not required to accept this License, since You have not
signed it. However, nothing else grants You permission to use or
distribute the Software or its derivative works. These actions are
prohibited by law if You do not accept this License. Therefore, by
using or distributing the Software (or any work based on the
Software), You indicate your acceptance of this License to do so,
and all its terms and conditions for copying, distributing or
using the Software or works based on it.
5. You may not use the Software to develop products which can be used
as a replacement or a directly competing product of this Software.
6. Where source code is provided as part of the Software, You may
modify the source code for the purpose of improvements and defect
fixes. If any modifications are made to any the source code, You
will put an additional banner into the code which indicates that
modifications were made by You.
7. You may not disclose the Software's software design, source code
and documentation or any part thereof to any third party without
the expressed written consent from proconX.
8. This License does not grant You any title, ownership rights,
rights to patents, copyrights, trade secrets, trademarks, or any
other rights in respect to the Software.
9. You may not use, copy, modify, sublicense, or distribute the
Software except as expressly provided under this License. Any
attempt otherwise to use, copy, modify, sublicense or distribute
the Software is void, and will automatically terminate your rights
under this License.
10. The License is not transferable without written permission from
proconX.
11. proconX may create, from time to time, updated versions of the
Software. Updated versions of the Software will be subject to the
terms and conditions of this agreement and reference to the
Software in this agreement means and includes any version update.
12. THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING PROCONX,
THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
13. ANY LIABILITY OF PROCONX WILL BE LIMITED EXCLUSIVELY TO REFUND OF
PURCHASE PRICE. IN ADDITION, IN NO EVENT UNLESS REQUIRED BY
APPLICABLE LAW OR AGREED TO IN WRITING WILL PROCONX OR ITS
PRINCIPALS, SHAREHOLDERS, OFFICERS, EMPLOYEES, AFFILIATES,
CONTRACTORS, SUBSIDIARIES, PARENT ORGANIZATIONS AND ANY COPYRIGHT
HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN
IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
14. IN ADDITION, IN NO EVENT DOES PROCONX AUTHORIZE YOU TO USE THIS
SOFTWARE IN APPLICATIONS OR SYSTEMS WHERE IT'S FAILURE TO PERFORM
CAN REASONABLY BE EXPECTED TO RESULT IN A SIGNIFICANT PHYSICAL
INJURY, OR IN LOSS OF LIFE. ANY SUCH USE BY YOU IS ENTIRELY AT
YOUR OWN RISK, AND YOU AGREE TO HOLD PROCONX HARMLESS FROM ANY
CLAIMS OR LOSSES RELATING TO SUCH UNAUTHORIZED USE.
15. This agreement constitutes the entire agreement between proconX
252
License
and You in relation to your use of the Software. Any change will
be effective only if in writing signed by proconX and you.
16. This License is governed by the laws of Queensland, Australia,
excluding choice of law rules. If any part of this License is
found to be in conflict with the law, that part shall be
interpreted in its broadest meaning consistent with the law, and
no other parts of the License shall be affected.
_________________________________________________________________
253
FieldTalk Modbus Master Library for .NET: Software manual
7 Support
We provide electronic support and feedback for our FieldTalk products.
Please use the Support web page at: http://www.modbusdriver.com/support
Your feedback is always welcome. It helps improving this product.
254
Notices
8 Notices
Disclaimer:
proconX Pty Ltd makes no warranty for the use of its products, other than those expressly
contained in the Company's standard warranty which is detailed in the Terms and Condi-
tions located on the Company's Website. The Company assumes no responsibility for any
errors which may appear in this document, reserves the right to change devices or speci-
fications detailed herein at any time without notice, and does not make any commitment
to update the information contained herein. No licenses to patents or other intellectual
property of proconX are granted by the Company in connection with the sale of proconX
products, expressly or by implication. proconX products are not authorized for use as
critical components in life support devices or systems.
This FieldTalk™ library was developed by:
proconX Pty Ltd, Australia.
Copyright © 2005-2018. All rights reserved.
proconX and FieldTalk are trademarks of proconX Pty Ltd. Modbus is a registered trade-
mark of Schneider Automation Inc. All other product and brand names mentioned in this
document may be trademarks or registered trademarks of their respective owners.
255