You are on page 1of 1

Sub OutputValue_OnPropertyChanged(Byval Item, Byval value)

'dwInp = SmartTags("Properties\dwInp")
'"overflow" if bit 31 is set
If value > 2^31 Then
value = value - 2^31 'reset bit 31, if bit 31 is set
End If
'to mask a bit pattern the following code is using bit 31 "&H80000000"
'because it is necessary to define an 32-Bit mask otherwise the bits 16..31 will
Not be masked!
'State (0=Stop, 1=Starting , 2=Run, 3=Stopping)
SmartTags("dwStateM")=(value And &H8000000F)
'operating mode (MANUAL, AUTO) ==> extract bit 16
SmartTags("bMANAUT")=(value And &H80010000)
'operating mode (LOCAL/REMOTE) ==> extract bit 17
SmartTags("bREMOTE")=(value And &H80020000)
'operating mode (PROCESS, SIMULATION) ==> extract bit 18
SmartTags("bSIM")= (value And &H80040000)
'Displaying Error ==> extract bit 24
SmartTags("bERR") = (value And &H81000000)
'Displaying Interlock ==> extract bit 26 and 27
SmartTags("byLOCK")= (value And &H8C000000) \ (2^26)
End Sub

You might also like