beautypg.com

Bit position data type workaround, Bit position data type, Workaround – Rockwell Automation Migrating PanelView Enhanced Terminal Applications User Manual

Page 80: Ge 80

background image

80

Publication 2711P-QS001A-EN-P - October 2007

Chapter 6 Review Unsupported Features and Implement Workarounds for Migration Issues

Bit Position Data Type
Workaround

If a bit position data type does not reference a single bit, it is
converted to an HMI memory tag. An error is recorded in the
conversion log.

If the object using this data type is an indicator (read operation),
there is a workaround.

If the object using this data type is a button (write operation),
the feature is unsupported.

The workaround for the bit position data type in an indicator object
(read operation) is to use this expression in the object.

If ((YourTagHere) & 1) ==1 Then 1
Else If ((YourTagHere >> 1) & 1) ==1 Then 2
Else if ((YourTagHere >> 2) & 1) ==1 Then 3
Else if ((YourTagHere >> 3) & 1) ==1 Then 4
Else if ((YourTagHere >> 4) & 1) ==1 Then 5
Else if ((YourTagHere >> 5) & 1)==1 Then 6
Else if ((YourTagHere >> 6) & 1) ==1 Then 7
Else if ((YourTagHere >> 7) & 1) == 1 Then 8
Else if ((YourTagHere >> 8) & 1) ==1 Then 9
Else if ((YourTagHere >> 9) & 1) ==1 Then 10
Else if ((YourTagHere >> 10) & 1) ==1 Then 11
Else if ((YourTagHere >> 11) & 1) ==1 Then 12
Else if ((YourTagHere >> 12) & 1) ==1 Then 13
Else if ((YourTagHere >> 13) & 1) ==1 Then 14
Else if ((YourTagHere >> 14) & 1) ==1 Then 15
Else if ((YourTagHere >> 15) & 1) ==1 Then 16
Else 0

Simply, replace YourTagHere with your bit position tag and the
expression will determine what LSB is high and return its value to the
indicator object.

The expression uses a series of Bit Shift and AND commands to
determine if the LSB is high. If the LSB is high, then depending on the
number of the bit shifts completed, the expression will return a value
associated with the bit location.

For example, if the value of your tag is 500 (111110100 in binary), the
expression will return the value 3 because it is the high LSB.