Frequently Asked Questions


NckValue

Under which conditions is the NckValue.Change event raised?

NckValue and derivates like NckInt16, NckInt32, NckBoolean or NckBooleanArray 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 NckValue instances (executed using a NckDeviceConnection) 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 NckValue instances (executed using a NckDeviceConnection) 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 NckValue 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.