Skip to main content

List from Bitmask

PLC integers used as bitmasks are useful for holding information by assigning each bit to a specific requirement. For example, a 16-bit integer could represent 16 different states of the process.

This function expands an integer into a list where each row represents a bit of the integer that is “set”. The expansion can also include other values.

Example

Suppose that at the end of a machine cycle, the date/time, operator, and an integer bitmask is saved to the report (the bitmask here could represent certain actions that the operator performed during the cycle.

Result

image59.png

Going a step further, if a Lookup Range function is applied, the numeric in the list can be converted to a readable text string.

Setting

image60.png