Offered AS IS.
Intended as a quick testing tool.
Can be tested as they are, see reply #3.
Moved here from the other category and topic (
https://www.advancedhmi.com/forum/index.php?topic=765.15) for better visibility.
Both apps are based on 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 ) and included in the Project.
Modbus Slave SimulatorThis is a new version of the Modbus Slave Simulator previously discussed in the topic mentioned above.
Now supporting RTU, TCP, UDP and ASCIIoverRTU protocols.
For RTU/ASCIIoverRTU protocols, on a single PC, AHMI can communicate with this simulator with the help of the tty0tty (Linux) / com0com (Windows) program which would provide virtual serial port pairs.
Since the DataGridView controls, used to display boolean/register values within the simulator window, seem to require rather fast computer, all instances were limited to initially have only 20 rows showing thus limiting the number of visible addresses (which should still be sufficient for simulation but can be changed and increased via the "Row Count" combo box). This has improved the speed of loading of the program in Mono on slower PCs.
The simulator will still accept ALL the Read/Write requests for ALL the registers and keep the values stored in the slave's dataStore. They will just not be visible in the data grid view, unless you choose to have all the rows visible.There is also a TextBox added to allow for manual input of the serial port to be used (intended for Linux so tty0tty virtual ports could be accessed).
All the simulation was tested in:
- Windows 7/10
- Kubuntu 14.04 Linux on an old HP TC1100 Tablet PC, with 1.2GHz Pentium-M CPU and 1.25GB RAM.
- Raspbian Buster on RaspberryPi 2
The library supports Masked Bit Write, function code 22 (0x16H).
Modbus MasterIt has the library built in support for RTU, TCP, UDP, RTUoverTCP, RTUoverUDP, ASCIIoverRTU, ASCIIoverTCP and ASCIIoverUDP protocols (not all of them were tested).
It also supports F, L, U, UL and S modifiers as well as bit/character Reading/Writing.
For bit/character operation, you can select to have it either as consecutive bits/characters within a single element or the exact individual bit/character from each of the multiple elements.
Either a single value or the exact number of comma separated values will be required for writing if Points number > 1.
A support for 64-bit values was added - Double (Float64), signed and unsigned Integer64 (Long and ULong).
Modifiers of FQ, LQ and UQ were added to the Master app, where "Q" stands for Quad Word.
A support for 128-bit values was added - signed and unsigned Integer128.
Modifiers of LO and UO were added to the Master app, where "O" stands for Octa Word.
SwapWords option, 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 or any of the 7 options provided for 128-bit values word order (theoretically, there should be far more than 7 options available but I didn't bother going through all of them).
The library supports Masked Bit Write, function code 22 (0x16H), but the app also includes the built-in code for slave devices that don't support FC22.
The built-in code will read register - modify the bit - write register, which could affect the bit values that changed during this operation.
Either of these apply to all values (16-bit, 32-bit, 64-bit, 128-bit).
Addresses do NOT have offset of +1.
The "Auto" checkbox allows for
Automatic Readings with poll interval specified in the "Interval" box.
If you add a new address to read after the "Auto" box is checked then you will have to uncheck it and check it again.
It is intended for quick testing but always try using AdvancedHMI as a Modbus Master instead, since it offers far more features and functionality.
Read the comments inside the form and also hover the mouse over the labels since most of them do provide hints.
This post has VB Master solutions attached (for Windows and Mono).