short C=0
unsigned short SJS[2],MIMA[7]={0,0,0,0X11,0X26},A[4],B[4],Bb,d=0
unsigned int NY[2],JiXing,cJiXing,plc=0
sub lw10000()
//*****确定优先plc*******
for c=0 to 5 step 1
if JiXing_bit[c] then
SetData(C, "Local HMI", LW, 10000, 1)
end if
DELAY(1)
next
return
end sub
sub a50015(bool o1,bool o2 )
//*****控制plc*******
for C = 0 to 31 step 1
//while CH[0]==0
if JiXing_bit[c]then
SetData(C, "Local HMI", LW, 10000, 1)
SetDataEx(o1, "OMRON CJ/CS/CP", W_Bit, var0#015, 1)
DELAY(0)
SetDataEx(o2, "OMRON CJ/CS/CP", A_Bit, var0#50015, 1)
DELAY(0)
SetDataEx(ON, "OMRON CJ/CS/CP", CIO_Bit, var0#10215, 1)
DELAY(0)
//GetData(CH[1], "OMRON CJ/CS/CP", W_Bit, 0#015, 1)
//GetData(CH[2], "OMRON CJ/CS/CP", A_Bit, 0#50015, 1)
//GetData(CH[3],"OMRON CJ/CS/CP", CIO_Bit, 0#10215, 1)
//CH[4]=1-CH[2]
//CH[0]= CH[1] & ~CH[3] & CH[3](~按位取反运算符)
//wend
end if
next
SetDataEx(o1, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", W_Bit, 015, 1)
SetDataEx(o2, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", A_Bit, 50015, 1)
SetDataEx(ON, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", CIO_Bit, 10215,
1)
SetDataEx(o1, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", W_Bit, 015, 1)
SetDataEx(o2, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", A_Bit, 50015, 1)
SetDataEx(ON, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", CIO_Bit, 10215,
1)
SetDataEx(o1, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)插针", W_Bit, 015, 1)
SetDataEx(o2, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)插针", A_Bit, 50015, 1)
SetDataEx(ON, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)插针", CIO_Bit, 10215,
1)
SetDataEx(o1, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)插针", W_Bit, 015, 1)
SetDataEx(o2, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)插针", A_Bit, 50015, 1)
SetDataEx(ON, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)插针", CIO_Bit, 10215,
1)
return
end sub
sub rq()
SetData(B[Bb], "Local HMI", RW, 19+Bb, 1)//
SetData(ON, "Local HMI", LB, 9029, 1)//配方数据强制保存
end sub
macro_command main()
SYNC_TRIG_MACRO(4)//跳到触摸屏弹出plc未连接等
GetDataEx(LB7, "OMRON CJ/CS/CP (Ethernet - FINS/TCP)焊锡", CIO_Bit, 0, 1)
//****开机控制plc****
if(LB7==0)then //锁住
RAND(SJS[0])//随机数据
RAND(SJS[1])//随机数据
SetData(SJS[0], "Local HMI", LW, 60, 2)
SetData(MIMA[3], "Local HMI", LW, 62, 2)
SetData(ON, "Local HMI", LB, 7, 1)
SetData(ON, "Local HMI", LB, 8, 1)
a50015(Off,ON)
else if(LB7==1)then //没锁
SetData(ON, "Local HMI", LB, 6, 1)
a50015(ON,OFF)
SetData(OFF, "Local HMI", LB, 8, 1)
SetData(ON, "Local HMI", LB, 29, 1)
SetData(OFF, "Local HMI", LB, 7, 1)
end if
//end if
//*********
lw10000()
//******plc没有选择******
//GetData(JIXING, "Local HMI", "机型字", 1)
if JiXing==0 then
SetData(ON, "Local HMI", LB, 5, 1)
JiXing=1//
SetData(JiXing, "Local HMI", "机型字", 1)//
end if
//*********
SetData(ON, "Local HMI", LB, 4, 1)
end macro_command |