Sub TDS_TimeOfDayCalcPLC (VarName)
'This function calculates actual Time of the day from PLC-var TimeOfDay
'Varname: VarName with number of miliseconds since 00:00:00.000 (from PLC)
' The Name of the calling name must be equal to the VarName
'
'v 15.02.11 TDS/M.Schill
Dim sTime
Dim sHours
Dim sMinutes
Dim sSeconds
Dim i
i = HMIRuntime.Tags(VarName).Read \ 1000 'Trunc miliseconds
sHours = i \ 3600 'Hours
i = i - sHours * 3600
sMinutes = i \ 60 'Minutes
sSeconds = i - sMinutes * 60
sTime = sHours & ":" & sMinutes & ":" & sSeconds
HMIRuntime.Screens("WinWorkspace").ScreenItems(VarName).OutputValue = sTime
End Sub
这是WINCC脚本中的TDS,请各位同仁共享,特别是sTime = sHours & ":" & sMinutes & ":" & sSeconds
HMIRuntime.Screens("WinWorkspace").ScreenItems(VarName).OutputValue = sTime
不知是什么意思??其sTime = sHours & ":" & sMinutes & ":" & sSeconds中的& ":" &不知怎么理解??
最佳答案
HMIRuntime.Screens("WinWorkspace").ScreenItems(VarName).OutputValue = sTime
不知是什么意思??
__________________________________________________
这个是把变量sTime赋值给画面“WinWorkspace”里的控件(VarName表示的控件)的输出值
其sTime = sHours & ":" & sMinutes & ":" & sSeconds中的& ":" &不知怎么理解??
—————————————————————————————
&是字符串连接运算符,比如
sHours=11
sMinuter=22
sSeconds=33
那么sTime的值就是11:22:33
提问者对于答案的评价:
谢谢!
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc267370.html