威纶通官方论坛

宏指令的高手来看看

[复制链接]
发表于 2016-8-21 23:57:23 | 显示全部楼层 |阅读模式
macro_command main()
short D,X,Y=1,Z=0,E=100,F=31950,G,H[4]={0,0,0},U
bool W=false
GetData(U, "Local HMI", LW, 9050, 1)
GetData(X, "Panasonic FP", DT, 99, 1)

if X==0 then
SetData(H[0], "Panasonic FP", DT, 47, 3)
SetData(H[2], "Panasonic FP", R, 21A, 1)
else
SetData(E, "Panasonic FP", DT, 47, 1)
SetData(F, "Panasonic FP", DT, 48, 1)
SetData(G, "Panasonic FP", DT, 49, 1)
SetData(Y, "Panasonic FP", R, 21A, 1)
SetData(D, "Local HMI", LW, 9200, 1)
end if

哪位老师帮忙解答一下,这是一个配方传送的宏程序,帮忙解答一下,这个数据处理过程
发表于 2016-8-22 15:13:34 | 显示全部楼层

您好
指令比较简单  就是字面理解判断传送 只是很多变量都没有来源 感觉不完整
 楼主| 发表于 2016-8-29 13:45:16 | 显示全部楼层
能讲解一下吗?
 楼主| 发表于 2016-8-29 14:21:53 | 显示全部楼层
weinview 发表于 2016-8-22 15:13
您好
指令比较简单  就是字面理解判断传送 只是很多变量都没有来源 感觉不完整

大体程序是这样的,是一个配方数据保存调用的程序,能帮忙价格注释吗?
macro_command main()
short D,X,Y=1,Z=0,E=100,F=31950,G,H[4]={0,0,0},U
bool W=false
GetData(U, "Local HMI", LW, 9050, 1)//U变量是当前窗口编号
GetData(X, "Panasonic FP", DT, 99, 1)//X变量是当前配方编号
if X==0 then
SetData(H[0], "Panasonic FP", DT, 47, 3)
SetData(H[2], "Panasonic FP", R, 21A, 1)
else
SetData(E, "Panasonic FP", DT, 47, 1)
SetData(F, "Panasonic FP", DT, 48, 1)
SetData(G, "Panasonic FP", DT, 49, 1)
SetData(Y, "Panasonic FP", R, 21A, 1)
SetData(D, "Local HMI", LW, 9200, 1)//赎值1给地址索引寄存器0#
end if


if X==1 then
G=100
D=0
SetData(Y, "Panasonic FP", R, 320, 1)
else
SetData(Z, "Panasonic FP", R, 320, 1)
end if

if X==2 then
G=200
D=100
SetData(Y, "Panasonic FP", R, 321, 1)
else
SetData(Z, "Panasonic FP", R, 321, 1)
end if

if X==3 then
G=300
D=200
SetData(Y, "Panasonic FP", R, 322, 1)
else
SetData(Z, "Panasonic FP", R, 322, 1)
end if

if X==4 then
G=400
D=300
SetData(Y, "Panasonic FP", R, 323, 1)
else
SetData(Z, "Panasonic FP", R, 323, 1)
end if

if X==5 then
G=500
D=400
SetData(Y, "Panasonic FP", R, 324, 1)
else
SetData(Z, "Panasonic FP", R, 324, 1)
end if

if X==6 then
G=600
D=500
SetData(Y, "Panasonic FP", R, 325, 1)
else
SetData(Z, "Panasonic FP", R, 325, 1)
end if

if X==7 then
G=700
D=600
SetData(Y, "Panasonic FP", R, 326, 1)
else
SetData(Z, "Panasonic FP", R, 326, 1)
end if

if X==8 then
G=800
D=700
SetData(Y, "Panasonic FP", R, 327, 1)
else
SetData(Z, "Panasonic FP", R, 327, 1)
end if

if X==9 then
G=900
D=800
SetData(Y, "Panasonic FP", R, 328, 1)
else
SetData(Z, "Panasonic FP", R, 328, 1)
end if

if X==10 then
G=1000
D=900
SetData(Y, "Panasonic FP", R, 329, 1)
else
SetData(Z, "Panasonic FP", R, 329, 1)
end if
您需要登录后才可以发帖 登录 | 注册

本版积分规则

回复帖子

Archiver|小黑屋|威纶通官网 ( 粤ICP备06054553号 )

GMT+8, 2024-11-28 04:37

Powered by Discuz! X3.4

© 2001-2023 Comsenz Inc.

快速回复 返回顶部 返回列表