Author Topic: nModbus Multi-in-1 Driver (experimental)  (Read 2970 times)

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
nModbus Multi-in-1 Driver (experimental)
« on: October 30, 2019, 01:59:51 AM »
Strictly offered as experimental/testing driver, maybe for those who might need RTUoverTCP/UDP or ASCIIoverTCP/UDP protocol.

The addresses use offset of +1 (so start with 00001, 10001, 30001, 40001).

It seems to work fine but is not as optimized as Archie's drivers are and also strings are stored as 1 character per register (instead of 2).

It supports F, L, U, UL, FQ, LQ, UQ, @ and S modifiers and bit/character reading/writing (16-bit, 32-bit and 64-bit values).

The library also supports Masked Bit Writing, function code 22 (0x16H), which is currently applied in the driver.
This is also done in the code ( read the value - change the bit - write it back ) for those devices that don't support FC22.
Check the new property "SlaveSupportsFC22" which controls this feature.

SwapWords option for 64-bit values, if enabled, might present a challenge for some devices since these things don't seem to be officially defined.
Just try either of the 3 options provided for 64-bit values word order (under the SwapWords64Type property which is only active when the SwapWords property is set to True).

For a simple test, the driver did allow on-the-fly changing of the IP address or Protocol Type (back and forth from TCP to RTU type). This was done with 2 Modbus simulators running locally at the same time and 1 Modbus simulator running on a remote computer.

For those who would like to try it, create a new folder inside the AdvancedHMI (or the AdvancedHMIcs) project and add to it, as existing items, all the dlls & License & corresponding VB (or C#) driver files.
Add references to all 3 dll files to the same project, close all open forms and rebuild the solution.
Don't do this in the AdvancedHMIDrivers project since it might conflict with the Modbus namespace.

If you subscribe to the "OnConnectionEstablished" and "OnComError" events then you might see some messages as to what the current status is.
This is generally applicable to TCP protocol variants.

Have no high expectations from it. Might have bugs so do report them back.

Always try to download the latest file since I do update it but don't make an announcement about it.

Disclaimer:

This driver is just another implementation of Modbus protocol, supporting:
RTU / TCP / UDP / RTUoverTCP / RTUoverUDP / ASCIIoverRTU / ASCIIoverTCP / ASCIIoverUDP.

It is using modified nModbus .NET 3.5 libraries, Copyright (c) 2006 Scott Alexander ( https://code.google.com/p/nmodbus/ ),
licensed under MIT license ( http://opensource.org/licenses/mit-license.php ).
See the included README.txt file.

Adapted for use within AdvancedHMI application with some modified code from existing AdvancedHMI drivers.

Read the comments inside the files.
« Last Edit: May 12, 2021, 05:02:44 AM by Godra »