前辈们 帮忙解释下 大体是什么意思 只要个大概意思就行 下面这些多是一起的
1.
macro_command main()
short a
bool zero=0
GetData(a, "Local HMI", LW, 9200, 1)
SetData(a, "Local HMI", RW, 1000, 1)
end macro_command
2.
macro_command main()
short a
bool zero=0
GetData(a, "Local HMI", LW, 9200, 1)
a=a+10
SetData(a, "Local HMI", RW, 1000, 1)
end macro_command
3.
macro_command main()
short a
bool zero=0
GetData(a, "Local HMI", LW, 9200, 1)
a=a+20
SetData(a, "Local HMI", RW, 1000, 1)
end macro_command
4.
macro_command main()
short m,c[10],i[180],name[5],index,temp,index1=0,count=0
bool zero=0
GetData(index, "Local HMI", RW, 1000, 1)
temp=index+10
count=180-index
GetData(i[0], "Local HMI", RW, index, count)
SetData(i[0], "Local HMI", RW, temp, count)
FILL(c[0], 0, 10)
SetData(c[0], "Local HMI", RW, index, 10)
for m=0 to 17
GetData(name[0], "Local HMI", RW, 0+index1, 5)
SetData(name[0], "Local HMI", LW, 3000+index1, 5)
index1=index1+10
next
SetData(zero, "Local HMI", LB, 3, 1)
end macro_command
5.
macro_command main()
short m,c[180],name[5],index,temp,index1=0,count=0
short clear[10]={0,0,0,0,0,0,0,0,0,0}
bool zero=0
GetData(index, "Local HMI", RW, 1000, 1)
temp=index+10
count=180-index
SetData(clear[0], "Local HMI", RW, 180, 10)
GetData(c[0], "Local HMI", RW, temp, count)
SetData(c[0], "Local HMI", RW, index, count)
for m=0 to 17
GetData(name[0], "Local HMI", RW, 0+index1, 5)
SetData(name[0], "Local HMI", LW, 3000+index1, 5)
index1=index1+10
next
SetData(zero, "Local HMI", LB, 4, 1)
end macro_command
6.
macro_command main()
short a,b[10],name[5],i,index=0
bool zero=0
GetData(a, "Local HMI", RW, 1000, 1)
a=a+5
GetData(b[0], "Local HMI", RW, a, 5)
SetData(b[0], "Local HMI", RW, 1100, 5)
SetData(zero, "Local HMI", LB, 5, 1)
for i=0 to 17
GetData(name[0], "Local HMI", RW, 0+index, 5)
SetData(name[0], "Local HMI", LW, 3000+index, 5)
index=index+10
next
end macro_command
7.
macro_command main()
short a,b[10],name[5], i,index=0
bool zero=0
GetData(a, "Local HMI", RW, 1000, 1)
a=a+5
GetData(b[0], "Local HMI", RW, 1100, 5)
SetData(b[0], "Local HMI", RW, a, 5)
SetData(zero, "Local HMI", LB, 6, 1)
for i=0 to 17
GetData(name[0], "Local HMI", RW, 0+index, 5)
SetData(name[0], "Local HMI", LW, 3000+index, 5)
index=index+10
next
end macro_command
8.
macro_command main()
short a,b[3]
bool OFF
GetData(a, "Local HMI", LW, 9200, 1)
b[0]=1+a/10
b[1]=b[0]+1
b[2]=b[1]+1
SetData(b[0], "Local HMI", RW, 2000, 3)
SetData(OFF, "Local HMI", LB, 10, 1)
end macro_command
9.
macro_command main()
short name[5],temp[5]
short i,var=0,b[5]
bool ON=true,OFF,flag=false
GetData(name[0], "Local HMI", LW, 0, 5) // get name strings
for i=0 to 17 step 1
GetData(temp[0], "Local HMI", RW, var, 5)
if name[0]==temp[0] and name[1]==temp[1] and name[2]==temp[2] and name[3]==temp[3] and name[4]==temp[4] then
GetData(b[0], "Local HMI", RW, var+5, 5)
SetData(b[0], "Local HMI", LW, 5, 5)
flag=true
SetData(flag, "Local HMI", LB, 10, 1)
else
var=var+10
end if
SetData(i, "Local HMI", LW, 100, 1)
SetData(var, "Local HMI", LW, 101, 1)
next i
SetData(ON, "Local HMI", LB, 9, 1)
SetData(OFF, "Local HMI", LB, 7, 1)
end macro_command
10.
macro_command main()
char a[10]
bool OFF=false
GetData(a[0], "Local HMI", LW, 0, 10)
SetData(a[0], "Local HMI", LW, 200, 10)
SetData(OFF, "Local HMI", LB, 8, 1)
end macro_command
11.
macro_command main()
bool alarm=true,OFF=false,flag
GetData(flag, "Local HMI", LB, 10, 1)
if flag==false then
SetData(alarm, "Local HMI", LB, 11, 1)
end if
SetData(OFF, "Local HMI", LB, 10, 1)
SetData(OFF, "Local HMI", LB, 9, 1)
end macro_command
12.
macro_command main()
bool OFF=false
char name[10]
GetData(name[0], "Local HMI", LW, 200, 10)
SetData(name[0], "Local HMI", LW, 0, 10)
SetData(OFF, "Local HMI", LB, 12, 1)
end macro_command
13.
macro_command main()
short name[5],temp[5]
short i,j,m,var=0,index
bool OFF=false,flag=false
GetData(index, "Local HMI", LW, 9200, 1)
GetData(name[0], "Local HMI", LW, 3000+index, 5)
for i=0 to 17 step 1
GetData(temp[0], "Local HMI", RW, var, 5)
if name[0]==temp[0] and name[1]==temp[1] and name[2]==temp[2] and name[3]==temp[3] and name[4]==temp[4] then
flag=true
SetData(flag, "Local HMI", LB, 20, 1)
SetData(name[0], "Local HMI", LW, 100, 5)
else
var=var+10
end if
next i
if flag==false then
SetData(name[0], "Local HMI", RW, 0+index, 5)
end if
SetData(OFF, "Local HMI", LB, 21, 1)
end macro_command
14.
macro_command main()
short name[5]
short i,index=0
for i=0 to 17
GetData(name[0], "Local HMI", RW, 0+index, 5)
SetData(name[0], "Local HMI", LW, 3000+index, 5)
index=index+10
next
end macro_command
15.
macro_command main()
char a[10],b[10],c[10]
bool OFF=false
short index
GetData(index, "Local HMI", LW, 9200, 1)
GetData(a[0], "Local HMI", RW, 0+index, 10)
GetData(b[0], "Local HMI", RW, 10+index, 10)
GetData(c[0], "Local HMI", RW, 20+index, 10)
SetData(a[0], "Local HMI",LW, 3000+index, 10)
SetData(b[0], "Local HMI", LW, 3010+index, 10)
SetData(c[0], "Local HMI", LW, 3020+index, 10)
SetData(OFF, "Local HMI", LB, 33, 1)
end macro_command
16.
macro_command main()
short name[5],oldname[5],temp[5]
short i,var=0,index
bool OFF=false,flag=false
GetData(index, "Local HMI", LW, 9200, 1)
GetData(name[0], "Local HMI", LW, 3010+index, 5)
for i=0 to 17 step 1
GetData(temp[0], "Local HMI", RW, var, 5)
if name[0]==temp[0] and name[1]==temp[1] and name[2]==temp[2] and name[3]==temp[3] and name[4]==temp[4] then
flag=true
SetData(flag, "Local HMI", LB, 20, 1)
SetData(name[0], "Local HMI", LW, 100, 5)
else
var=var+10
end if
next i
if flag==false then
SetData(name[0], "Local HMI", RW, 10+index, 5)
end if
SetData(OFF, "Local HMI", LB, 22, 1)
end macro_command
17.
macro_command main()
short name[5],oldname[5],temp[5]
short i,var=0,index
bool OFF=false,flag=false
GetData(index, "Local HMI", LW, 9200, 1)
GetData(name[0], "Local HMI", LW, 3020+index, 5)
for i=0 to 17 step 1
GetData(temp[0], "Local HMI", RW, var, 5)
if name[0]==temp[0] and name[1]==temp[1] and name[2]==temp[2] and name[3]==temp[3] and name[4]==temp[4] then
flag=true
SetData(flag, "Local HMI", LB, 20, 1)
SetData(name[0], "Local HMI", LW, 100, 5)
else
var=var+10
end if
next i
if flag==false then
SetData(name[0], "Local HMI", RW, 20+index, 5)
end if
SetData(OFF, "Local HMI", LB, 23, 1)
end macro_command
18.
macro_command main()
short name[5]
short i,index=0,number[3]={1,2,3}
bool ON=true
for i=0 to 17
GetData(name[0], "Local HMI", RW, 0+index, 5)
SetData(name[0], "Local HMI", LW, 3000+index, 5)
index=index+10
next
SetData(number[0], "Local HMI", RW, 2000, 3)
SetData(ON, "Local HMI", LB, 0, 1)
end macro_command
我没有用过威伦宏指令,不过应该不难看懂:
macro_command main()
char a[10],b[10],c[10]
bool OFF=false
short index
GetData(index, "Local HMI", LW, 9200, 1)
GetData(a[0], "Local HMI", RW, 0+index, 10)
GetData(b[0], "Local HMI", RW, 10+index, 10)
GetData(c[0], "Local HMI", RW, 20+index, 10)
SetData(a[0], "Local HMI",LW, 3000+index, 10)
SetData(b[0], "Local HMI", LW, 3010+index, 10)
SetData(c[0], "Local HMI", LW, 3020+index, 10)
SetData(OFF, "Local HMI", LB, 33, 1)
end macro_command
红色,是程序段或过程区域。绿色为定义段。。。。。程序都有这两部分。。中间getdata是读数,setdata是写数。。。