Troubles making a Derived Boolean Tag work as a mask for a Short Tag

I’ve made it work using the following expressions:

Read:

(toInt({source}) >> N) & 1

Write:

if({value}, 
	toInt({source}) | (1 << N), 
	toInt({source}) & ~(1 << N))

Where N will vary based on the bit number (0-15 for a Modbus register).

You should also turn on the “OPC Optimistic Writes” flag for the scan class these tags belong to or you’re going to have a race condition if you try to write to multiple bits in the same word too quickly.

2 Likes