- Код: Выделить всё
- short status,result,tmp,statusInt =0
- GetData(statusInt, "PLC_MB_TCP", "AI_VU_1.StatWordInt", 1)
- GetData(status, "PLC_MB_TCP", "AI_VU_1.StatWord", 1)
- // 1 = yellow
- // 2 = orang
- // 3 = red
- // 4 = white
- // 5 = white
- // 6 = green
- if statusInt==-2 or statusInt==3 then
- tmp = 3
- SetData(tmp, "Local HMI", "AI_1.Status", 1)
- else if statusInt==-1 or statusInt==1 then
- tmp = 1
- SetData(tmp, "Local HMI", "AI_1.Status", 1)
- else if statusInt==2 then
- tmp = 2
- SetData(tmp, "Local HMI", "AI_1.Status", 1)
- else
- tmp = 6
- SetData(tmp, "Local HMI", "AI_1.Status", 1)
- end if
- GETBIT(status, result, 0)
- if result==0 then
- tmp = 4
- SetData(tmp, "Local HMI", "AI_1.Status", 1)
- end if
- GETBIT(status, result, 7)
- if result==1 then
- tmp = 5
- SetData(tmp, "Local HMI", "AI_1.Status", 1)
- end if
Вот пример кода, этот участок еще 40 раз скопирован в скрипте. Может есть какая нибудь оптимизация или доп. настройка