The OPC specification has a note about Boolean values:
"Note that the internal storage type of VT_BOOL is ‘short’, which must have the values VARIANT_TRUE (0xFFFF – i.e., ‘-1’ when stored in a ‘short’) and VARIANT_FALSE (0). When converting TO bool, any nonzero value converts to VARIANT_TRUE. Converting FROM bool to any signed numeric type, VARIANT_TRUE converts to ‘-1’ or ‘-1.0’. For unsigned types it converts to the maximum value. The recommended OPC standard for conversion of bool to BSTR is '0' or '-1', rather than ‘True' or 'False'..."
So, you should get a -1 if using any of the signed data types for the OPC Read block. This is the behavior for doubles and for int8. For uint8 data types, the behavior is to output the maximum value (255) as dictated by the OPC specification.
Using a unary minus block will work, but if you want a boolean, insert a Data Type Conversion block, and set the data type to "boolean".
Best Answer