Expressions cannot be put in the property fields directly. It is actually easier to do the calculation in the PLC. However with a little bit a coding, you can do calculations from multiple tags. The DataSubscriber2 can be used for this. For example, let's say you want to add MyTag1 and MyTag2 and put it in the ValueLimitUpper property of an AnalogValueDisplay:
- Add an AnalogValueDisplay to the form
- Add a DataSubscriber2 to the form
- In the properties windows, click in the PLCAddressItems property, then click the ellipsis (3 dots) button to open the Collection Editor Window
- Click the Add button and for the PLCAdress enter MyTag1
- Click the Add button again and enter MyTag2 for the PLCAddress
- Click OK to close the window
- Double click the DataSubscriber2 in the component tray. This will take you to the code view
- Enter this code:
Private Sub DataSubscriber21_DataChanged_1(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
Try
AnalogValueDisplay1.ValueLimitUpper = DataSubscriber21.PLCAddressValueItems(0).LastValue + DataSubscriber21.PLCAddressValueItems(1).LastValue
Catch ex As Exception
End Try
End Sub