Modbus UA

Here are some functions you can include in the Global Script Modules section under Project -> Script Modules. I called the module bit:[code]def getBit(value, position):
return (value >> position) & 1

def setBit(value, position, newValue):
newValue = (newValue & 1) << position
mask = 1 << position
return (value & ~mask) | newValue

def writeBit(tagPath, position, value):
import system, app
currentValue = system.tag.getTagValue(tagPath)
system.tag.writeToTag(tagPath, app.bit.setBit(currentValue, position, value))[/code]To use this script just do the following:app.bit.writeBit("Path/To/Tag", 0, 1)The first argument is the tag you want to flip the bit on, the second is the bit position and the third is the value of the bit. Hope this helps.