检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:陈小飞 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.
分 类 号:TN305[电子电信—物理电子学]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.7