先上注册机 点击下载
How to add the WSMBT control to the toolbox:
  1. On the Tools menu, click Choose Toolbox Items.
  2. Click browse. The open dialog appears.
  3. Browse for the wsmbt.dll
  4. Click ok in the "Choose toolbox Items" dialog box.
  5. Now you can find the WSMBT control in the toolbox.
  6. 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();

最新文章

  1. 浅谈Java的匿名类
  2. 关于学习JavaScript 的 高三编程 一些心得
  3. POJ 3415 Common Substrings 后缀数组+并查集
  4. 使用javascript打开一个新页而不被浏览器屏蔽
  5. php的<?php ?>标签匹配
  6. JavaScript Patterns 5.8 Chaining Pattern
  7. [转]MongoDB密码设置(基于windows)
  8. HDU1796 How many integers can you find(容斥原理)
  9. 单位px 转换成 rem
  10. 使用cmd来起一个服务器
  11. className.class.getResourceAsStream与ClassLoader.getSystemResourceAsStream区别
  12. vue中的 ref 和 $refs
  13. 从PRISM开始学WPF(番外)共享上下文 RegionContext-更新至Prism7.1
  14. centos 踩坑集锦
  15. 线程安全(上)--彻底搞懂volatile关键字
  16. d3生成的树状图
  17. 【Django】HTTP status code must be an integer.
  18. a标签打开设置
  19. spring boot1.5以上版本@ConfigurationProperties取消location注解后的替代方案 cannot resolve method location
  20. OpenGL ES3.0

热门文章

  1. [转] 如何用BSP树生成游戏地图
  2. Vue 内联样式的数据绑定
  3. 让32位应用程序不再为2G内存限制苦恼
  4. Dubbo各种协议详解
  5. 二叉搜索树的结构(30 分) PTA 模拟+字符串处理 二叉搜索树的节点插入和非递归遍历
  6. js实现大文件分片上传的方法
  7. 实验吧CTF题库-安全杂项
  8. ES6相关实用特性
  9. 什么是Scatter/Gather?
  10. 【277】◀▶ Python 列表/元组/字典说明