M.J Jalali
M.J Jalali

Reputation: 110

How to read bit n'th bit of a byte tag in vba code in wincc?

I want to read 2nd bit of a tag byte in 'VBA' Code in wincc. how do it?

Upvotes: 0

Views: 62

Answers (1)

Bart McEndree
Bart McEndree

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

Related Questions