用户登陆 用户注册
您的位置:首页> 技术文章>内容正文
siemens 300/400编程技巧3则
[正文]:数据块拷贝function fc 100 : voidtitle =//db block copyauthor : axgname : dbbtodbbversion : 0.1var_input  sou_db : int ; //source db number  leng : int ; //how many to copy  des_db : int ; //destination db numberend_varvar_temp  source : any ;   dest : any ; end_varbeginnetworktitle =      lar1  p##source; // load the start address of the any pointers in ar1.      l     b#16#10; // load the syntax id and      t     lb [ar1,p#0.0]; // transfer it to the any pointer.       l     b#16#4; // load data type word and      t     lb [ar1,p#1.0]; // transfer it to the any pointer.      l     #leng; // load how many words and      t     lw [ar1,p#2.0]; // transfer them to the any pointer      l     #sou_db; // source is db[?], dbb0.0      t     lw [ar1,p#4.0]; //       l     p#dbx 0.0; //       t     ld [ar1,p#6.0]; //       lar1  p##dest; //load the destination address of the any pointer in ar1.       l     b#16#10; //load the syntax id and       t     lb [ar1,p#0.0]; //transfer it to the any pointer.       l     b#16#4; //load data type word and       t     lb [ar1,p#1.0]; //transfer it to the any pointer.       l     #leng; //load how many words and       t     lw [ar1,p#2.0]; //transfer them to the any pointer.       l     #des_db; //destination is db123;?125;, dbb0.0       t     lw [ar1,p#4.0];       l     p#dbx 0.0; //       t     ld [ar1,p#6.0]; //       call "blkmov" (//call the block move system function            srcblk                   := #source,//            ret_val                  := mw   210,//evaluate the br bit and mw 210           dstblk                   := #dest);// end_function使用说明:可直接调用,#source---源数据块号                      #dest------目标数据块号                       #leng----要拷贝数据的长度[color=#ff0000]s7 300400 的一些功能和技巧2[/color]单键翻转function fc 11 : voidtitle =//author : axgfamily : esuname : sdzfversion : 0.0beginnetworktitle =      a     m     0.0;       a     m     0.1;       =     m     58.0; networktitle =      a     m     58.0;       an    m     58.1;       =     m     58.2; networktitle =      a     m     58.2;       s     m     58.1;       on    m     58.0;       on    m     0.0;       r     m     58.1;       nop   0; networktitle =      a     m     58.2;       a     m     58.4;       =     m     58.3; networktitle =      a     m     58.2;       an    m     58.3;       an    m     58.4;       s     m     58.4;       o     m     58.3;       on    m     0.0;       r     m     58.4;       nop   0; end_function使用说明:m0.0----使能          m0.1----单键使m58.4翻转 [color=#ff0000]s7 300400 的一些功能和技巧3[/color]循环读模拟量入db块      l     #db_no      t     lw     0      opn   db [lw 0]      l     #piw_addr      sld   3      t     ld     4      l     #dbd_addr      sld   3      t     ld     8      l     #ch_lennext: t     lw     0      l     ld     4      lar1        l     piw [ar1,p#0.0]      t     lw     2     123; call  "read analog value 464-2"       in     :=lw2       hi_lim :=5.000000e+002       lo_lim :=-1.000000e+001      将模拟量转换成工程量       bipolar:=true       ret_val:=lw10       out    :=ld12   125;      l     ld     8      lar1        l     ld     2      t     dbd [ar1,p#0.0]      l     ld     4      +     l#16      t     ld     4      l     ld     8      +     l#32      t     ld     8      l     lw     0      loop  nextpiw_addr :模拟块通道起始地址chi_len :要读入的 通道数db_no :存储数据块dbw_addr :存储在数据块中的字地址


网站首页 培训课程 维修指南
技术文章 家电专栏 供应信息
求购信息 培训资讯 展会信息
电脑专栏 教程下载 资料下载
常用软件 PLC教程 PLC资料
变频伺服 低压电器 维修资料
人机界面 自控仪表 工控机类
文章标题: 搜文章
中国工控资源网手机版 2012
电话:010-67577139 13811659603
培训咨询QQ:657167934 471895637 销售咨询QQ:623769457
联系邮箱:zggkzyw@163.com
 京ICP备11002135号
报时(2026-04-03 12:42:51) 流量统计