ModbusTools

Menu > Home
> Products

   • Modbus Poll
   • Modbus Slave
   • Modbus TCP/IP .NET
   • Modbus RTU/ASCII .NET
   • Modbus ActiveX
> Download
> Order
> Contact Info.
> Links

> Modbus

WSMBS Quick start guide

 

Add the component to the toolbox

1. In the Tools menu select Choose Toolbox Items.

 

 

2. In the "Choose toolbox Items" dialog box press browse.

 

 

3. Select the wsmbs.dll

 

 

4. Press ok in the "Choose toolbox Items" dialog box.

 

 

5. Now you can find the WSMBS component in the toolbox.

 

 

6. Add the WSMBSControl  to you form like you add a timer.

 

7. 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());

8. 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());

Copyright © 2012 ModbusTools - All rights reserved. Modbus is trademark of Modicon.