First on the registration machine click Download How to add the Wsmbt control to the Toolbox:
- On the Tools menu, click Choose Toolbox Items.
- Click Browse. The open dialog appears.
- Browse for the Wsmbt.dll
- Click OK in the "Choose Toolbox Items" dialog box.
- Now you can find the WSMBT control in the Toolbox.
- Add the Wsmbtcontrol to your form as you add a timer.
Example code How to make a connection.
= Wsmbtcontrol1.connect ("127.0.0.1") 502); if (Result ! = wsmbt. result.success) MessageBox.Show (wsmbtcontrol1.getlasterrorstring ());
Example code to read holding registers.
Int16[] Registers =Newint16[Ten]; Wsmbt. result result; Result= Wsmbtcontrol1.readholdingregisters (1,0,Ten, registers);if(Result! =WSMBT. result.success) MessageBox.Show (wsmbtcontrol1.getlasterrorstring ());BOOLVaild = Mbsserial.licensekey ("661366411818111882382891650b3"); if(!vaild) {MessageBox.Show ("you are not registered successfully! "); } int16[] Registers=Newint16[ -]; Wsmbs. result result; Result=Mbsserial.open (); if(Result! =Wsmbs. result.success) {return; } Result= Mbsserial.readholdingregisters (2,2, -, registers); // byte[] x = Parsehex ("0x4481"); MessageBox.Show (X.length.tostring ()); //MessageBox.Show (Mbsserial.registerstofloat (0x4841, 0x0000). ToString ()); //MessageBox.Show (result.tostring () + registers. Length.tostring ());Mbsserial.close ();
WSMBT Modbus & wsmbs Modbus control and registration machine