首先制作一个锁屏画面,这里建立一个密码输入框:LW9220,画面可以输入密码,正确就恢复进主界面。
RW1000设置天,RW1002设置小时,RW1004设置为分钟,RW1006设置秒。
macro_command main()
short page
int current_time,setting_time
int day,hour,minute,second,temp_day,temp_hour,temp_minute,temp
GetData(day, “Local HMI”, RW, 1000, 1)
GetData(hour, “Local HMI”, RW, 1002, 1)
GetData(minute, “Local HMI”, RW, 1004, 1)
GetData(second, “Local HMI”, RW, 1006, 1)
temp_day=day*86400
temp_hour=hour*3600
temp_minute=minute*60
temp=temp_day
temp=temp+temp_hour
temp=temp+temp_minute
setting_time=temp+second
GetData(current_time, “Local HMI”, RW, 1100, 1)
if current_time>=setting_time then
page=20
SetData(page, “Local HMI”, LW, 0, 1)
end if
SetData(setting_time, “Local HMI”, LW, 100, 1)
end macro_command
在该程序中,plc控制元件有两个窗口控制,一个是切换窗口,一个是将窗口编号写入地址将窗口编号写入地址有什么作用