Reputation: 110
I want to read 2nd bit of a tag byte in 'VBA' Code in wincc. how do it?
Upvotes: 0
Views: 62
Reputation: 3230
In VBA, bit masks can be used to isolate or set specific bits within a byte. For example, to check if the second bit is set:
If (tag And 2) > 0 Then '2 = 0000 0010 = bit mask for 2nd bit
' Second bit is set (1)
Else
' Second bit is not set (0)
End If
Upvotes: 1