EasyModbusTCP .NET - Client

Download from "sourceforge.net": http://sourceforge.net/projects/easymodbustcp/

Download "Implementation guide": http://sourceforge.net/projects/easymodbustcp/files/V1.0/ImplementationGuide.pdf/download

 

Modbus TCP and Modbus UDP client library. 


Supports read and write Operations 

- Read Coils (FC1)
- Read Discrete Inputs (FC2)
- Read Holding Registers (FC3)
- Read Input Registers (FC4)
- Write Single Coil (FC5)
- Write Single Register (FC6)
- Write Multiple Coils (FC15)
- Write Multiple Registers (FC16)

EasyModbusTCP .NET - Client - Library documentation

Name of class: ModbusTCP

Name of Namespace: SRModbusTCP

Methods

ModbusTCP(string ipAddress, int port)

Constructor - Executed when object is created
Parameter ipAddress: IP-Address of Modbus-TCP Server Parameter port: Port of Modbus-TCP Server listening

void Connect()

Connects to the Modbus-TCP Server

void Connect(string ipAddress, int port)

Connects to the Modbus-TCP Server with a different IP-Address or Port as specified in constructor Parameter ipAddress: IP-Address of Modbus-TCP Server
Parameter port: Port of Modbus-TCP Server listening

bool[] ReadDiscreteInputs(int startingAddress, int quantity)

Read discrete Inputs from Server (Function Code 2)

bool[] ReadCoils(int startingAddress, int quantity)

Read coils from Server (Function Code 1)

int[] ReadHoldingRegisters(int startingAddress, int quantity)

Read holding registers from Server (Function Code 3)

int[] ReadInputRegisters(int startingAddress, int quantity)

Read Input registers from Server (Function Code 4)

void WriteSingleCoil(int startingAddress, bool value)

Write single Coil to Server (Function Code 5)

void WriteSingleRegister(int startingAddress, int value)

Write single Register to Server (Function Code 6)

void WriteMultipleCoils(int startingAddress, bool[] values)

Write multiple coils to Server (Function Code 15)

void WriteMultipleRegisters(int startingAddress, int[] values)

Write multiple registers to server (Function Code 16)

void Disconnect()

close connection to Server

 

Properties

bool Connected

returns "TRUE" if client is connected to Server and "FALSE" if not

string IPAddress

gets or sets the IP-Address were the Modbus-TCP Server is reachable

int Port

gets or sets the port of the Modbus-TCP Server (Standard is 502)

bool UDPFlag

Enables Modbus UDP (Modbus TCP will be disabled)