是不是整个宏语句如下:
macro_command main()
int time_current,time_history,time_run
int day[4]
bool flag
GetData(time_current, "Local HMI", LW, 9030, 1)
GetData(flag, "Local HMI", LB, 0, 1)
if flag==false then
GetData(time_history, "Local HMI", RW, 0, 1)
time_history=time_history-time_current/10
flag=true
SetData(flag, "Local HMI", LB, 0, 1)
end if
time_current=time_current/10
time_run=time_history+time_current
day[0]=time_run/86400 //days
day[1]=(time_run-day[0]*86400)/3600 //hours
day[2]=(time_run-day[0]*86400-day[1]*3600)/60 //minutes
day[3]=time_run-day[0]*86400 //seconds
day[3]=day[3]-day[1]*3600 //seconds
day[3]=day[3]-day[2]*60 //seconds
SetData(time_run, "Local HMI", RW, 0, 1)
SetData(day[0], "Local HMI", LW, 0, 4)
end macro_command
下载到人机里面还是显示0啊?时间不会累加显示! |