Giter VIP home page Giter VIP logo

sharpmodbus's Introduction

SharpModbus

C# Modbus Tools

Quick Start

var settings = new SerialSettings()
{
    PortName = "COM3",
    BaudRate = 57600,
};
//Modbus RTU over serial
using (var master = ModbusMaster.RTU(settings))
{
    master.WriteCoil(1, 3000, false);
    master.WriteCoils(1, 3001, false, true);
}
//Modbus RTU over isolated serial
using (var master = ModbusMaster.IsolatedRTU(settings))
{
    master.WriteCoil(1, 3000, false);
    master.WriteCoils(1, 3001, false, true);
}
//Modbus TCP over socket
using (var master = ModbusMaster.TCP("10.77.0.2", 502))
{
    master.WriteCoils(1, 4, false, true);
}

Documentation

No documentation yet. Resort to tests at SharpModbus.Test and SharpModbus.Test.Special subprojects for guidance. A couple of real device communication samples are available there.

SharpMaster uses SharpModbus too.

Development Setup

  • Windows 10 Pro 64x (Windows only)
  • VS Code (bash terminal from Git4Win)
  • Net Core SDK 3.1.201
  • com0com-2.2.2.0-x64-fre-signed COM98/99
  • For Comfile Modport Test
    • FTDI USB-RS485-WE-1800-BT COM3
    • Comfile MD-H485+MD-DOSO8+5SlotBoard
    • CUI SWI25-24-N-P5
    • B&B BB-UH401

Development CLI

#packing for nuget
dotnet clean SharpModbus -c Release
dotnet pack SharpModbus -c Release
#cross platform test cases
dotnet test SharpModbus.Test
#console output for test cases
dotnet test SharpModbus.Test -v n
#com0com test cases need COM98 and COM99
dotnet test SharpModbus.Test.Special --filter FullyQualifiedName~Com0ComSlaveTest
#comfile modport connected on COM10 see details inside
dotnet test SharpModbus.Test.Special --filter FullyQualifiedName~ComfileModportTest
#opto22 snappac connected on 10.77.0.2:502 see details inside
dotnet test SharpModbus.Test.Special --filter FullyQualifiedName~Opto22SnapPacTest
#compile check special tests
dotnet build SharpModbus.Test.Special

TODO

  • Support Linux / macOS
  • Improve documentation and samples
  • Support Modbus ASCII

sharpmodbus's People

Contributors

samuelventura avatar pieterh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.