Ali cloud IoT + YF3300 [9]. Modbus rapid development of device drivers

       Modbus is a serial communications protocol, to a Modicon PLC protocol (programmable logic controller) designed for communication. Modbus has become the industry standard industrial communications protocols, most of the instrumentation support this communication protocol. Developed over a long time ago based on Modbus various drivers of the agreement, in 2 007 years time has also wrote " My M odbus Slave / Client development process ," the blog article .

       YFIOs is YFSoft I / O Server for short, is the lightweight embedded system configuration of an era of things. Support policy development and secondary drive, but conventional tactics and driver development somewhat cumbersome, since most things devices support modbus protocol, it provides for a fast development of modbus tools driven, it is still very necessary.

    This article will introduce a basis modbus rapid driver development process module temperature and humidity of the agreement.

    Open the "YFIOsIDE" program starts, click the "File" main menu below " Modbus Driver Development Wizard."

 

    Check the temperature and humidity sensor specification we can know, the temperature and humidity in the modbus register offset address is 0 and 1 ( . 4 0000 regions), we identifiers are set to " T " and " H ." See the description we can see, the value is not directly read the temperature and humidity, but also needs to be divided . 1 0 , we look at the configuration operation expressions as " $ the Value / 10.0", wherein $ the Value that we read from the specified address region native values.

       Drive manufacturer name and other information, can actually fill on the line, we are here to default values. Device address and serial port parameters, you can set the default parameters for the device.

     After the parameters are configured, we click "Compile" button to compile the driver files, in order to allow YFIOs management program to facilitate loading drive our new compilation, we have chosen directory YFIOsManager under the program " Driver " directory.

 

    After successful compilation, we found to occur in a specified directory dll and pe file, the file name is our configuration "drive name."

 

       我们打开YFIOsManager程序,单击“驱动列表”项,可以看到我们刚刚编译的驱动。

         好,我们测试一下刚刚编译好的驱动,看看是否能正常工作。我们添加一个用户驱动,选择我们刚刚创建好的驱动。

       YF3300RS485COM2。配置好后,数据配置里面就会自动出来对应的变量来,如下图所示:

     我们让YF3300接一个温湿度模块,把相关的组态配置部署到YF3300中去。

       YF3300采购链接(最后一个颜色分类是YF3300网关):

https://item.taobao.com/item.htm?spm=a1z10.1-c.w4004-10400358307.7.82854d48viZm7V&id=42910631014  

    部署运行后,我们在“数据监控”中看到温湿度已经可以正常读取了。

    从以上可以看成,只要知道对应的属性地址,我们可以非常迅速的开发出一款比较实用的设备驱动。另外驱动的配置可以导出为xml文件,后续可以根据需要进行修改和扩展。如果要实现的驱动比较复杂,还可以导出为Visual Studio C#项目,可以更为自由的实现对应的驱动了。

    单击“导出为C#工程”,选定好要导出的目录,然后就可以到一个完整的C#驱动程序了(一个驱动接口工程,一个驱动pe工程)。

 

想体验阿里云IoT平台的网友,可以单击如下链接https://dev.iot.aliyun.com/sale?source=deveco_partner_yefan

 

Guess you like

Origin www.cnblogs.com/yefanqiu/p/12082466.html