Frequently Asked Questions


PlcValue

Under which conditions is the PlcValue.Change event raised?

PlcValue and derivates like PlcInt16, PlcInt32, PlcBoolean or PlcBooleanArray raise the Changed event to notify value changes. This event is raised whenever the Value property has been changed.

This event is raised under the following conditions:

  • User code changes the value of the Value property to a different value as the value provided before.
  • A read operation using PlcValue instances (executed using a PlcDeviceConnection) results into a different value as the value provided before. In case of an Array the event is raised if at least one item in the array has been changed.

This event isn't raised under the following conditions:

  • User code changes the vlaue of the Value property to the same value as the value provided before.
  • Adding EventHandlers to the Changed event. This includes the first EventHandler as well.
  • The value has been red through a read operation using PlcValue instances (executed using a PlcDeviceConnection) and results into the same value as the value provided before. This includes the first read operation as well.

If it is necessary to be informed about every change to the process image in the PLC, it is possible to carry out an initial read operation of the PlcValue instances. If the EventHandler is then registered to the Changed event and relevant changes (e.g. through polling) are read regularly, the EventHandler is also executed with every change.