MCGS触摸屏设置Modbus通讯地址及串口参数的方法.docx

MCGS触摸屏设置Modbus通讯地址及串口参数的方法.docx

550KBDOCX

《MCGS触摸屏设置Modbus通讯地址及串口参数详解》

MCGS触摸屏,全称为“昆仑通态”工业组态软件,广泛应用于自动化领域的监控与数据采集系统。在使用MCGS进行Modbus通信时,需要对触摸屏进行特定的设置,包括Modbus通讯地址和串口参数,以便与其它设备进行有效的数据交换。本文将详细讲解如何在MCGS中设置这两个关键参数。

一、原版驱动与第三方定制驱动的差异

MCGS的原版Modbus驱动并不支持通过画面组态直接调整Modbus通信的相关参数,如站号、波特率、数据位、停止位和校验位。然而,通过采用第三方定制驱动,我们可以实现这些参数的动态配置。这种方法经过实际验证,是可行的。

二、作为Modbus主站的设置步骤

1. 安装第三方定制驱动:首先需要下载并安装这个定制驱动,它将提供更灵活的参数设置功能。

2. 新建工程与画面:创建一个新的MCGS测试工程,然后在画面上添加相应的元素,如文本框和按钮,用于显示和输入通讯参数。

3. 数据变量的创建:在实时数据库中创建用于存储参数的变量,例如nAddr、nBaudrate等,分别对应Modbus站号、波特率等。

4. 组态界面关联:将文本框与对应的变量进行绑定,以显示或输入设置值。

5. 脚本编写:在设置按钮的按下脚本中,使用`SetDevice`函数来设定设备的地址和串口参数,如`SetDevice(设备 1,6,”SetAddress(nAddr)”)`和`SetDevice(设备 1,6,”SetCommPara(nBaudrate,nDatabit,nStopbit,nParity,nReturn)”)`,确保参数正确传递。

三、作为Modbus从站的设置

当MCGS触摸屏作为Modbus从站时,需要在同一串口父设备下添加数据转发设备,并将初始状态设为停止,以避免干扰主站通讯。设置按钮的脚本应相应地修改,例如仅改变设备2的站号。

四、设备组态注意事项

1. 添加通用串口父设备:这是所有串口通信的基础,需先进行配置。

2. 用户定制设备的选择:在成功安装第三方驱动后,会多出这个选项,需要正确识别并选用。

3. 设备区别:为避免混淆,可以双击设备查看驱动位置以确认。

五、操作步骤总结

1. 安装定制驱动。

2. 创建工程,构建界面。

3. 创建和关联数据变量。

4. 编写设置脚本。

5. 根据角色(主站/从站)配置设备。

通过以上步骤,MCGS触摸屏就能根据实际需求,灵活地进行Modbus通讯地址和串口参数的设置了。这种定制化的方式极大地提高了MCGS在实际应用中的适应性和灵活性,使得在各种工控场景下的通信变得更加便捷和可靠。

Resource DownloadThe download price for this resource is6.0Gold coins, please first
Resource Download
Download Prices6.0 gold coin

Resource Disclaimer (Purchase is deemed to be agreement with this statement):
1. Any operation on the website platform is considered to have read and agreed to the registration agreement and disclaimer at the bottom of the website, this site resources have been ultra-low price, and does not provide technical support
2. Some network users share the net disk address may be invalid, such as the occurrence of failure, please send an e-mail to customer service code711cn#qq.com (# replaced by @) will be made up to send
3. This site provides all downloadable resources (software, etc.) site to ensure that no negative changes; but this site can not guarantee the accuracy, security and integrity of the resources, the user downloads at their own discretion, we communicate to learn for the purpose of not all the source code is not 100% error-free or no bugs; you need to have a certain foundation to be able to read and understand the code, be able to modify the debugging yourself! code and solve the error. At the same time, users of this site must understand that the Source Code Convenience Store does not own any rights to the software provided for download, the copyright belongs to the legal owner of the resource.
4. All resources on this site only for learning and research purposes, please must be deleted within 24 hours of the downloaded resources, do not use for commercial purposes, otherwise the legal disputes arising from the site and the publisher of the collateral liability site and will not be borne!
5. Due to the reproducible nature of the resources, once purchased are non-refundable, the recharge balance is also non-refundable

充值送金币,用余额购买,低至6.7折!Recharge Now

Show CAPTCHA
Don't have an account? enrollment  Forgot your password?