当前位置: 首页 > news >正文

[Codesys]常用功能块应用分享-BMOV功能块功能介绍及其使用实例说明

官方说明

 

功能说明

参数

类型

功能

 pbyDataSrcPOINTER TO BYTE指向源数组指针
uiSizeUINT要移动数据的BYTE数
pbyDataDesPOINTER TO BYTE指向目标数组指针

实例应用-ST

IF SYSTEM_CLOCK.AlwaysTrue THENCASE iAutoState OF0:  //读写完成信号在下次读写信号的上升沿或复位信号的下降沿清除ClearRtrig(CLK:=(ReadCmd OR WriteCmd)AND OPMODE.User_Interface_OUT.Reset=FALSE,Q=>TrigClearQ);IF TrigClearQ THENRW_Done:=FALSE;RFID_ReadCmd_Mid:=FALSE;RFID_WriteCmd_Mid:=FALSE;iStartAddrChangebale:=0;RfidBaseReset:=TRUE;END_IFIF RW_Done=FALSE AND iRfidBaseState=10 AND iStartAddrChangebale=0 THENRfidBaseReset:=FALSE;iAutoState:=5;END_IF	5:IF ReadCmd=TRUE AND WriteCmd=FALSE AND TagPresent=TRUE AND RWHeadNotConnected=FALSE AND RfidErr=FALSE  THENRFID_ReadCmd_Mid:=TRUE;RFID_WriteCmd_Mid:=FALSE;iAutoState:=10;ELSIF ReadCmd=FALSE AND WriteCmd=TRUE  AND TagPresent=TRUE AND RWHeadNotConnected=FALSE AND RfidErr=FALSE THENiAutoState:=100;ELSIF (ReadCmd=TRUE OR WriteCmd=TRUE)  AND TagPresent=FALSE THENRFID_ReadCmd_Mid:=FALSE;RFID_WriteCmd_Mid:=FALSE;TagNotExitAlarm:=TRUE;iAutoState:=200;ELSIF  (ReadCmd=TRUE OR WriteCmd=TRUE)  AND RWHeadNotConnected=TRUE THENRFID_ReadCmd_Mid:=FALSE;RFID_WriteCmd_Mid:=FALSE;RfidNotHeaderAlarm:=TRUE;iAutoState:=200;END_IF10://RFID DATA READ CONTROLIF Done=TRUE AND RfidErr=FALSE THENiStartAddrChangebale:=iStartAddr;BMOV(pbyDataSrc:=pRdSrcMid , uiSize:=128 , pbyDataDes:=pRdOne);ELSIF RfidErr THENGeneralAlarm:=TRUE;END_IFIF Done=TRUE AND GeneralAlarm =FALSE THENiAutoState:=20;ELSIF GeneralAlarm=TRUE THEN iAutoState:=200;END_IF20:IF GeneralAlarm=FALSE AND RFID_ReadCmd_Mid=TRUE AND RFID_WriteCmd_Mid=FALSE THENRFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;ELSIF GeneralAlarm=FALSE AND  RFID_ReadCmd_Mid=FALSE AND RFID_WriteCmd_Mid=FALSE THEN iAutoState:=30;END_IF30:IF AutoRdCmd=TRUE AND AutoWrCmd=FALSE AND TagPresent=TRUE AND RfidErr=FALSE  THENRFID_ReadCmd_Mid:=TRUE;RFID_WriteCmd_Mid:=FALSE;iAutoState:=40;END_IF40:IF Done=TRUE AND RfidErr=FALSE THENiStartAddrChangebale:=iStartAddr+128;BMOV(pbyDataSrc:=pRdSrcMid , uiSize:=128 , pbyDataDes:=pRdTwo);ELSIF RfidErr THENGeneralAlarm:=TRUE;END_IFIF Done=TRUE AND GeneralAlarm =FALSE THENiAutoState:=50;ELSIF GeneralAlarm=TRUE THEN iAutoState:=200;END_IF50:IF GeneralAlarm=FALSE AND RFID_ReadCmd_Mid=TRUE AND RFID_WriteCmd_Mid=FALSE THENRFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;ELSIF GeneralAlarm=FALSE AND  RFID_ReadCmd_Mid=FALSE AND RFID_WriteCmd_Mid=FALSE THEN iAutoState:=60;END_IF60:IF AutoRdCmd=TRUE AND AutoWrCmd=FALSE AND TagPresent=TRUE AND RfidErr=FALSE  THENRFID_ReadCmd_Mid:=TRUE;RFID_WriteCmd_Mid:=FALSE;iAutoState:=70;END_IF		70:IF Done=TRUE AND RfidErr=FALSE THENiStartAddrChangebale:=iStartAddr+256;BMOV(pbyDataSrc:=pRdSrcMid , uiSize:=128 , pbyDataDes:=pRdThree);ELSIF RfidErr THENGeneralAlarm:=TRUE;END_IFIF Done=TRUE AND GeneralAlarm =FALSE THENiAutoState:=80;ELSIF GeneralAlarm=TRUE THEN iAutoState:=200;END_IF80://RFID DATA READ FINISHE RETURNIF GeneralAlarm=FALSE THENRW_Done:=TRUE;RFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;iStartAddrChangebale:=0;iAutoState:=0;END_IF100://RFID DATA WRITE CONTROLIF AutoRdCmd=FALSE AND AutoWrCmd=TRUE THENiStartAddrChangebale:=iStartAddr;BMOV(pbyDataSrc:=pWrOne , uiSize:=128 , pbyDataDes:=pWrSrcMid);RFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=TRUE;iAutoState:=105;END_IF105:IF Done=TRUE AND RfidErr=FALSE THENGeneralAlarm:=FALSE;ELSIF RfidErr THENGeneralAlarm:=TRUE;END_IFIF Done=TRUE AND GeneralAlarm =FALSE THENRFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;iAutoState:=110;ELSIF GeneralAlarm=TRUE THEN iAutoState:=200;END_IF110:IF AutoRdCmd=FALSE AND AutoWrCmd=TRUE THENiStartAddrChangebale:=iStartAddr+128;BMOV(pbyDataSrc:=pWrTwo , uiSize:=128 , pbyDataDes:=pWrSrcMid);RFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=TRUE;iAutoState:=115;END_IF115:IF Done=TRUE AND RfidErr=FALSE THENGeneralAlarm:=FALSE;ELSIF RfidErr THENGeneralAlarm:=TRUE;END_IFIF Done=TRUE AND GeneralAlarm =FALSE THENRFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;iAutoState:=120;ELSIF GeneralAlarm=TRUE THEN iAutoState:=200;END_IF120:IF AutoRdCmd=FALSE AND AutoWrCmd=TRUE THENiStartAddrChangebale:=iStartAddr+256;BMOV(pbyDataSrc:=pWrThree , uiSize:=128 , pbyDataDes:=pWrSrcMid);RFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=TRUE;iAutoState:=125;END_IF125:IF Done=TRUE AND RfidErr=FALSE THENGeneralAlarm:=FALSE;ELSIF RfidErr THENGeneralAlarm:=TRUE;END_IFIF Done=TRUE AND GeneralAlarm =FALSE THENRFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;iAutoState:=130;ELSIF GeneralAlarm=TRUE THEN iAutoState:=200;END_IF130://RFID DATA WRITE FINISHE RETURNIF GeneralAlarm=FALSE THENRW_Done:=TRUE;RFID_ReadCmd_Mid :=FALSE;RFID_WriteCmd_Mid:=FALSE;iStartAddrChangebale:=0;iAutoState:=0;END_IF200://RFID DATA WRITE OR READ ALARMIF OPMODE.User_Interface_OUT.Reset THENGeneralAlarm:=FALSE;TagNotExitAlarm:=FALSE;RfidNotHeaderAlarm:=FALSE;RFID_ReadCmd_Mid:=FALSE;RFID_WriteCmd_Mid:=FALSE;RW_Done:=FALSE;iStartAddrChangebale:=0;iAutoState:=0;END_IFEND_CASE
END_IF

实例应用-LD

 

 

数据操作功能块封装 

         功能块封装功能类似数据库读写操作,自动读写数据和手动读写数据,访问二维数组中的数据操作。可通过二维数组的行列访问目标数据或通过指针访问目标数组。

        以后有时间会抽时间分享一些TIA和Codesys的常用功能块使用方法。


http://www.mrgr.cn/news/71887.html

相关文章:

  • Git 提交的相对引用
  • 首次公开用系统审查与评估大语言模型安全性的数据集
  • [Unity Demo]从零开始制作空洞骑士Hollow Knight第二十二集:制作游戏的对话系统
  • 数据结构及算法--排序篇
  • 3.langchain中的prompt模板 (few shot examples in chat models)
  • Tomcat 与 Servlet 的关系:传统与 Spring Boot 中的差异
  • PCL 点云分割 基于CPC算法的分割
  • YOLO11 旋转目标检测 | OBB定向检测 | ONNX模型推理 | 旋转NMS
  • 程序代码设计模式之模板方法模式(1)
  • 利用服务工作线程serviceWorker缓存静态文件css,html,js,图片等的方法,以及更新和删除及版本控制
  • 力扣 LeetCode 59. 螺旋矩阵II(Day1:数组)
  • AlphaFold3中文安装教程
  • Nous Chat:AI 领域的又一惊艳之作,未来潜力不可忽视
  • 【Python Tips】Python内置函数isinstance——检测数据类型:处理多种类型的输入参数(对比type)
  • C/C++ 模板与so
  • 十六、多版本并发控制
  • 【大数据测试HBase数据库 — 详细教程(含实例与监控调优)】
  • 速盾:CDN和OBS能共用流量包吗?
  • 解决MySQL中整型字段条件判断禁用不生效的问题
  • excel常用技能
  • 电商系统表的1-n如何设计?情景分析
  • 基于Multisim温度计温度测量检测测量系统电路(含仿真和报告)
  • 【AI日记】24.11.12 东京贫困女子读后感 | 未来学习工作时间分配
  • Python模块练习2(dict)
  • arcgis for js实现popupTemplate弹窗field名称和值转义
  • MySQl基础----Linux下数据库的密码和数据库的存储引擎(内附 实操图和手绘图 简单易懂)