All Projects → sontx → Modbus

sontx / Modbus

Licence: apache-2.0
Modbus RTU and TCP support for C#

Projects that are alternatives of or similar to Modbus

Mbusd
Open-source Modbus TCP to Modbus RTU (RS-232/485) gateway.
Stars: ✭ 233 (+913.04%)
Mutual labels:  modbus, modbus-tcp
node-drivers
Industrial protocol drivers in node.js
Stars: ✭ 20 (-13.04%)
Mutual labels:  protocol, modbus
EasyModbusTCP.Java
EasyModbusTCP library for Java implementation
Stars: ✭ 76 (+230.43%)
Mutual labels:  modbus, modbus-tcp
J2mod
Enhanced Modbus library implemented in the Java programming language
Stars: ✭ 155 (+573.91%)
Mutual labels:  modbus, modbus-tcp
Hslcommunication
An industrial IoT underlying architecture framework, focusing on the underlying technical communications and cross-platform, cross-language communication functions, to achieve a variety of mainstream PLC data reading and writing, to achieve modbus of various protocols read and write, and so on, to support the rapid construction of industrial upper computer software, configuration software, SCADA software, factory mes system, To help enterprise Industry 4.0 take-off, to achieve intelligent manufacturing, smart factory goals. The main PLC contains Siemens, Mitsubishi, Omron, Panasonic, Modbus, AB-PLC, Redis
Stars: ✭ 816 (+3447.83%)
Mutual labels:  modbus, modbus-tcp
Modbustool
A modbus master and slave test tool with import and export functionality, supports TCP, UDP and RTU.
Stars: ✭ 187 (+713.04%)
Mutual labels:  modbus, modbus-tcp
huawei solar
Home Assistant integration for Huawei Solar inverters via Modbus
Stars: ✭ 126 (+447.83%)
Mutual labels:  modbus, modbus-tcp
Modbus Tcp Client
PHP client for Modbus TCP and Modbus RTU over TCP (can be used for serial)
Stars: ✭ 89 (+286.96%)
Mutual labels:  modbus, modbus-tcp
rodbus
Rust implementation of Modbus with idiomatic bindings for C, C++, .NET, and Java
Stars: ✭ 34 (+47.83%)
Mutual labels:  modbus, modbus-tcp
go-modbus
modbus write in pure go, support rtu,ascii,tcp master library,also support tcp slave.(WIP new implement<old: https://github.com/thinkgos/gomodbus >)
Stars: ✭ 124 (+439.13%)
Mutual labels:  modbus, modbus-tcp
Jlibmodbus
JLibModbus is an implementation of the Modbus protocol v1.1b in java language.
Stars: ✭ 149 (+547.83%)
Mutual labels:  modbus, modbus-tcp
Node Modbus
Modbus TCP Client/Server implementation for Node.JS
Stars: ✭ 313 (+1260.87%)
Mutual labels:  modbus, modbus-tcp
Genmon
Generac Generator Monitoring using a Raspberry Pi and WiFi
Stars: ✭ 143 (+521.74%)
Mutual labels:  modbus, modbus-tcp
Pyscada
PyScada is a open source scada system that uses the Django framework as backend
Stars: ✭ 233 (+913.04%)
Mutual labels:  modbus, modbus-tcp
Modbuspp
A C++ Library for Modbus TCP Protocol
Stars: ✭ 108 (+369.57%)
Mutual labels:  modbus, modbus-tcp
modbus-esp8266
Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.
Stars: ✭ 332 (+1343.48%)
Mutual labels:  modbus, modbus-tcp
Modbridge
Bridge between modbus and MQTT
Stars: ✭ 20 (-13.04%)
Mutual labels:  modbus, modbus-tcp
Pymodbus
A full modbus protocol written in python
Stars: ✭ 1,225 (+5226.09%)
Mutual labels:  modbus, modbus-tcp
ModbusMechanic
Cross platform GUI MODBUS TCP/RTU simulator & gateway. Interprets data types including ascii float and int.
Stars: ✭ 63 (+173.91%)
Mutual labels:  modbus, modbus-tcp
solaredge modbus
SolarEdge Modbus data collection library
Stars: ✭ 49 (+113.04%)
Mutual labels:  modbus, modbus-tcp

Modbus

Modbus library supports for Modbus Protocol.

Install

You can clone/download source code from this repository and then add to your project. Or install via Nuget:

Install-Package Modbus

Usage

Easiest way.

// use modbus rtu
var session = ModbusSessionFactory.CreateRtuSession(serialPort);
// arguments are slave id, data address and number of registers
var builder = RequestBuilderFactory.CreateRequest03<RtuRequest>(1, 0, 4);
// send request and wait for response
var response = await session.SendRequestAsync<ResponseFunc03>(builder);

But! wait, where is ResponseFunc03, it's just a use-defined structure. You should define what you want to receive by a strucutre.

[StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct ResponseFunc03
{
    public byte numberOfBytes;

    [Endian(Endianness.BigEndian)]
    public short value;

    [Endian(Endianness.BigEndian)]
    public ushort dotPosition;

    public short padding1;
    public short padding2;
    
    //[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.U2, SizeConst = 4)]
    //[Endian(Endianness.BigEndian)]
    //public ushort[] bytes;
}

Current version supports function code 01, 02, 03, 04, 05 and 06. Also, the library supports both modbus RTU and modbus TCP. Of couse, you can make your owner request and response types by create Builder from RtuRequest or TcpRequest classes.

 var builder = new RtuRequest.Builder()
    .SetSlaveAddress(0x01)
    .SetFunctionCode(0x09)
    .AddInt16(33)
    .AddInt16(93);
    //.SetObject(requestDataStruct)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].