時(shí)間鎖,我在8000里做的很成功!
macro_command main()
int on,a,Y,M,D,y1,m1,d1,m8034
short i,e,t
GetData(Y, "本機(jī) 觸摸屏", LW, 100, 1)
GetData(y1, "本機(jī) 觸摸屏", LW, 9022, 1)
GetData(M, "本機(jī) 觸摸屏", LW, 200, 1)
GetData(m1, "本機(jī) 觸摸屏", LW, 9021, 1)
GetData(D, "本機(jī) 觸摸屏", LW, 300, 1)
GetData(d1, "本機(jī) 觸摸屏", LW, 9020, 1)
SetData(Y, "本機(jī) 觸摸屏", LW, 101, 1)
SetData(M, "本機(jī) 觸摸屏", LW, 201, 1)
SetData(D, "本機(jī) 觸摸屏", LW, 301, 1)
SetData(y1, "本機(jī) 觸摸屏", LW, 103, 1)
SetData(m1, "本機(jī) 觸摸屏", LW, 203, 1)
SetData(d1, "本機(jī) 觸摸屏", LW, 303, 1)
i=Y-y1
e=M-m1
t=D-d1
if i<0 then
on=0
m8034=1
else
if e<0 then
on=0
m8034=1
else
if t<=0 then
on=0
m8034=1
else
on=1
m8034=0
end if
end if
end if
SetData(i, "本機(jī) 觸摸屏", LW, 102, 1)
SetData(on, "本機(jī) 觸摸屏", LB, 100, 1)
SetData(e, "本機(jī) 觸摸屏", LW, 202, 1)
SetData(t, "本機(jī) 觸摸屏", LW_Bit, 302, 1)
SetData(m8034, "MITSUBISHI FX0n/FX2", M, 8034, 1)
end macro_command
設(shè)定屏里的年月日時(shí)間限制后,當(dāng)當(dāng)前時(shí)間到達(dá)設(shè)定時(shí)間后,強(qiáng)制三菱PLCM8034置位。PLC停止工作。還要制作一個(gè)宏執(zhí)行命令。(可以用PLC控制功能來(lái)執(zhí)行)用RB20 執(zhí)行宏運(yùn)行---在屏幕開(kāi)始第一個(gè)畫(huà)面里制作一個(gè)隱形的位狀態(tài)設(shè)定,工作條件設(shè)為 窗口打開(kāi)時(shí)執(zhí)行即可
。(經(jīng)過(guò)實(shí)際上機(jī)測(cè)試,此程序還存在邏輯關(guān)系沒(méi)有完善,不能達(dá)到要求),此例只是引導(dǎo)一下,還望大家一起完善時(shí)間鎖程序![ 此帖被toutianjian在2009-06-02 12:24重新編輯 ]