C#与PLC结构体变量通讯实现  

Implementation of Communication Between C#and PLC Structure Variables

在线阅读下载全文

作  者:陈小飞 CHEN Xiao-fei(Anhui Zhonghe Semiconductor Technology Co.,Ltd.,Anhui,Hefei 230000)

机构地区:[1]安徽众合半导体科技有限公司,安徽合肥230000

出  处:《电子技术与软件工程》2024年第4期21-25,共5页ELECTRONIC TECHNOLOGY & SOFTWARE ENGINEERING

基  金:安徽省科技攻坚计划项目(重点项目)(No.202423i08050045)

摘  要:C#语言在实现多种数据类型的结构体整体通讯、打包和解包不如其他语言方便。以可以标签式编程的欧姆龙NJ系列的PLC为例,与上位机进行通讯,介绍了C#与PLC结构体变量通讯的详细实现方案。以案例和具体代码方式呈现,详细给出了PLC和上位机结构体的定义、数组长度的分配、任一结构体变量对应的PLC地址查找、PLC整个结构体数据的读取及快速解包、整个结构体的写以及单个变量的读写,解决了C#不能进行结构体和联合体嵌套的通讯实现的难点,同时为C#与其他通讯介质之间的不同类型变量的结构体通讯提供了参考。C#is not as convenient as other languages in implementing overall communication,packaging,and unpacking of structures with multiple data types.Taking the Omron NJ series PLC that can be programmed by tag as an example,this article introduces a detailed implementation scheme for communication between C#and PLC structure variables with the upper computer.Presented in the form of case studies and specific code,this paper provides detailed definitions of PLC and upper computer structures,allocation of array lengths,searching for PLC addresses corresponding to any structure variable,reading and quick unpacking of the entire structure data of PLC,writing of the entire structure,and reading and writing of individual variables.It solves the difficulty of C#'s inability to implement nested communication between structures and consortia,and provides reference for structure communication of different types of variables between C#and other communication media.

关 键 词:PLC通讯 C# 数据解包 托管 

分 类 号:TN305[电子电信—物理电子学]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象