WSMBS Modbus Master RTU/ASCII Control for .NET 2.4.1.0
WSMBS Modbus Master RTU/ASCII Control for .NET 2.4.1.0 | 235 kB
WSMBS is a powerful and simple to use .Net Control that makes it easy to access data from a Modbus slave device connected to the PC's serial port. Simply drop the Control on your form and talk to your device with your VB.NET, C# or Managed C++.
Supported protocol variants:
Modbus RTU
Modbus ASCII
SUPPORTED MODBUS FUNCTIONS:
01: Read coil status
02: Read input status
03: Read holding registers
04: Read input registers
05: Force single coil
06: Preset single register
15: Force multiple coils
16: Preset multiple registers
17: Report Slave ID.
22: Mask write register
23: Read/Write registers
User defined functions:
Read User Defined Coils
Read User Defined Registers
Write User Defined Coils
Write User Defined Registers
Examples:
C#
Int16[] Registers = new Int16[10];
WSMBS.Result Result;
Result = wsmbsControl1.ReadHoldingRegisters(1, 0, 10, Registers);
Visual Basic
Dim Registers(10) As Short
Dim Result As WSMBS.Result
Result = WsmbtControl1.ReadHoldingRegisters(1, 0, 10, Registers)
C++
array^ Registers = gcnew array(10);
WSMBS::Result Result;
Result = wsmbtControl1->ReadHoldingRegisters(1, 0, 10, Registers);
Int16[] Registers = new Int16[10];
WSMBS.Result Result;
Result = wsmbsControl1.ReadHoldingRegisters(1, 0, 10, Registers);
Visual Basic
Dim Registers(10) As Short
Dim Result As WSMBS.Result
Result = WsmbtControl1.ReadHoldingRegisters(1, 0, 10, Registers)
C++
array^ Registers = gcnew array(10);
WSMBS::Result Result;
Result = wsmbtControl1->ReadHoldingRegisters(1, 0, 10, Registers);
Example code how to open a serial port.
WSMBS.Result Result;
wsmbsControl1.Mode = WSMBS.Mode.RTU;
wsmbsControl1.PortName = "COM1";
wsmbsControl1.BaudRate = 9600;
wsmbsControl1.StopBits = 1;
wsmbsControl1.Parity = WSMBS.Parity.None;
wsmbsControl1.ResponseTimeout = 1000;
Result = wsmbsControl1.Open();
if (Result != WSMBS.Result.SUCCESS)
MessageBox.Show(wsmbsControl1.GetLastErrorString());
wsmbsControl1.Mode = WSMBS.Mode.RTU;
wsmbsControl1.PortName = "COM1";
wsmbsControl1.BaudRate = 9600;
wsmbsControl1.StopBits = 1;
wsmbsControl1.Parity = WSMBS.Parity.None;
wsmbsControl1.ResponseTimeout = 1000;
Result = wsmbsControl1.Open();
if (Result != WSMBS.Result.SUCCESS)
MessageBox.Show(wsmbsControl1.GetLastErrorString());
Example code to read 10 holding registers.
Int16[] Registers = new Int16[10];
WSMBS.Result Result;
Result = wsmbsControl1.ReadHoldingRegisters(1, 0, 10, Registers);
if (Result != WSMBS.Result.SUCCESS)
MessageBox.Show(wsmbsControl1.GetLastErrorString());
WSMBS.Result Result;
Result = wsmbsControl1.ReadHoldingRegisters(1, 0, 10, Registers);
if (Result != WSMBS.Result.SUCCESS)
MessageBox.Show(wsmbsControl1.GetLastErrorString());
Only for V.I.P
Warning! You are not allowed to view this text.