younthue
級別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 17 個(gè)
工控威望: 141 點(diǎn)
下載積分: 558 分
在線時(shí)間: 11(小時(shí))
注冊時(shí)間: 2014-05-14
最后登錄: 2022-04-21
查看younthue的 主題 / 回貼
樓主  發(fā)表于: 2016-09-18 16:11

我定義的WinCC內(nèi)部二進(jìn)制變量ILR.ILR25 和ILR.ILR26,外部無符號16位變量PbSlvCommSts1和外部布爾變量DI007EMO。其中外部變量分別關(guān)聯(lián)到PLC內(nèi)的一個(gè)int和bool數(shù),測試時(shí),ILR.ILR25相關(guān)聯(lián)的WinCC IO域反應(yīng)是正常的,但I(xiàn)LR.ILR26相關(guān)聯(lián)的IO域一直是“0”,不會變化。

這段代碼是很簡單的,麻煩大神指教一下,謝謝!


Dim ILRILR25
Set ILRILR25 = HMIRuntime.Tags("ILR.ILR25")
Dim PbSlvCommSts1
Set PbSlvCommSts1 = HMIRuntime.Tags("PbSlvCommSts1")
PbSlvCommSts1.Read
ILRILR25.value=PbSlvCommSts1.Value And &h0002
ILRILR25.Write

Dim ILRILR26
Set ILRILR26 = HMIRuntime.Tags("ILR.ILR26")
Dim DI007EMO
Set DI007EMO = HMIRuntime.Tags("DI007EMO")
DI007EMO.Read
ILRILR26.Value=DI007EMO.Value
ILRILR26.Write