WSMBT Modbus & WSMBS Modbus 控件及注册机
2024-08-21 00:12:55
先上注册机 点击下载
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 like you add a timer.
Example code how to make a connection.
WSMBT.Result Result; wsmbtControl1.Mode = WSMBS.Mode.TCP_IP; wsmbtControl1.ResponseTimeout = ; wsmbtControl1.ConnectTimeout = ; Result = wsmbtControl1.Connect("127.0.0.1", ); if (Result != WSMBT.Result.SUCCESS) MessageBox.Show(wsmbtControl1.GetLastErrorString());
Example code to read 10 holding registers.
Int16[] Registers = new Int16[]; WSMBT.Result Result; Result = wsmbtControl1.ReadHoldingRegisters(, , , Registers); if (Result != WSMBT.Result.SUCCESS) MessageBox.Show(wsmbtControl1.GetLastErrorString()); bool vaild = mbsSerial.LicenseKey("661366411818111882382891650B3"); if (!vaild) { MessageBox.Show("您未注册成功!"); } Int16[] registers = new Int16[]; WSMBS.Result Result; Result = mbsSerial.Open(); if (Result != WSMBS.Result.SUCCESS) { return; } Result = mbsSerial.ReadHoldingRegisters(, , , 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();
最新文章
- 浅谈Java的匿名类
- 关于学习JavaScript 的 高三编程 一些心得
- POJ 3415 Common Substrings 后缀数组+并查集
- 使用javascript打开一个新页而不被浏览器屏蔽
- php的<;?php ?>;标签匹配
- JavaScript Patterns 5.8 Chaining Pattern
- [转]MongoDB密码设置(基于windows)
- HDU1796 How many integers can you find(容斥原理)
- 单位px 转换成 rem
- 使用cmd来起一个服务器
- className.class.getResourceAsStream与ClassLoader.getSystemResourceAsStream区别
- vue中的 ref 和 $refs
- 从PRISM开始学WPF(番外)共享上下文 RegionContext-更新至Prism7.1
- centos 踩坑集锦
- 线程安全(上)--彻底搞懂volatile关键字
- d3生成的树状图
- 【Django】HTTP status code must be an integer.
- a标签打开设置
- spring boot1.5以上版本@ConfigurationProperties取消location注解后的替代方案 cannot resolve method location
- OpenGL ES3.0