WSMBS Quick start guide

How to add the WSMBS control to the toolbox:

  1. On the Tools menu, click Choose Toolbox Items.

    Choose toolbox item


  2. Click browse. The open dialog appears.

    Browse


  3. Browse for the wsmbs.dll

    Select DLL


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

    Select control


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

    WSMBS in toolsbox


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

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

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