NDM Notification Functions

You call the NDM notification functions to raise or lower a signal state in the NDM (and by extension, on the PLC). In some cases, you also supply some additional data which is stored in the NDM (and by extension, available to your PLC application).

Note: Within a Task, the Notify PLC can also be used to generate notifications.

The following table summarizes the available NDM notification functions. For information on function arguments and return values, refer to the VisionPro programming reference documentation, starting with the Cognex.VisionPro.Comm.CogNdm class. Many of the functions listed below take a cameraIndex argument. This argument indicates which of the four acquisition and inspection engines, each of which corresponds to a physical camera, the notification refers to. Some functions also take an acquisitionID argument. This argument serves as a unique identifier so that multiple overlapping image acquisitions from multiple cameras can be managed.

NotifyAcquisitionComplete

Notify the PLC that an acquisition has completed.

This function is used to inform the PLC that an acquisition has been completed. Calling this function will automatically re-enable the trigger ready bit on the PLC. You call this function to inform the PLC that an acquisition that it requested is complete and to inform it that a locally triggered acquisition is complete.

Before calling NotifyInspectionComplete(), it is required to call this function as well.

Note: Calling NotifyAcquisitionComplete sets the Exposure Complete bit on the PLC (if the bit has not already been set by calling the optional NotifyAcquisitionMovePart function).
NotifyAcquisitionDisabled Optionally notify the PLC that the Vision System is unable to receive acquisition triggers.
NotifyAcquisitionError Notify the remote device that an acquisition error has occurred.
NotifyAcquisitionMovePart

Optionally notify the remote device that the exposure is complete or the strobe has fired and it is now safe to move the part from the field of view.

You can use this notification function to tell the PLC that the acquisition (but not the inspection) is complete.

NotifyAcquisitionReady

Notify the PLC that the Vision System is ready to receive acquisition triggers. You must call this function to enable the PLC to send a trigger using the TriggerAcquisition event.

Note:
  • The NotifyAcquisitionReady method should be used in the following manner:

    1. In a typical configuration, the application has just been started, and it is ready to accept the first acquisition trigger signal.
    2. The PLC then sets the Trigger Enabled bit, which enables triggering by the PLC.
    3. Next, Designer will use the NotifyAcquisitionMethod (indexes are specified when there are more than one camera to trigger) to enable triggering by the PLC.
    4. Once both the PLC and Designer are set, triggering is enabled.
    5. Setting the Trigger Enabled to false, or calling the NotifyAcquisitionDisabled method, will result in trigger signals being ignored.
  • Calling NotifyAcquisitionComplete() automatically re-enables triggers for a particular camera, so calling NotifyAcquisitionReady() is only required to enable the very first acquisition. After the first acquisition you must call NotifyAcquisitionComplete() for the trigger ready signal to be sent back to the remote device or PLC.
NotifyAcquisitionStarted Optionally notify the remote device that an acquisition has started.
NotifyAsyncSoftEventComplete Notify the remote device that an asynchronous soft event has completed.
NotifyError Notify the remote device (PLC) that the Vision System has encountered an error.
NotifyInspectionComplete(CogNdmInspectionResult result)

Notify the PLC that an inspection has finished.

This overload is not available through the Notify PLC; it can only be called from script. The CogNdmInspection result argument to this function provides information, including which engine and which images were used to generate the result.

Note: The InspectionIndex member of the CogNdmInspection object corresponds to the cameraIndex argument used in other functions. It is the engine number.
NotifyInspectionComplete(Int32 inspectionIndex, CogNdmUsedAcquisitionIDCollection usedAcquisitionIDs, Boolean inspectionPassed, Int32 resultCode, Byte[] resultData, Int32 resultDataOffset)

Notify the PLC that an inspection has finished.

This overload is available through the Notify PLC or it can be called from script. All of the supplied arguments are written to the signal table for use by your PLC application.

Note: The inspectionIndex argument corresponds to the cameraIndex argument used in other functions. It is the engine number and must be in the range 0-3.
NotifyJobState Notify the remote device which job is loaded.
NotifyRunning Notify the PLC that the Vision System is running or "online".
NotifyStopped Notify the PLC that the Vision System stopped running or gone "offline".
NotifySystemStatus Notifies the PLC of the Vision System status.

You can invoke NDM notification functions directly from script code using the standard VisionPro programming interface.

Here is an example of a notification function called from script:

//Acquire an image
$Devices.myCam.Acquire();
//Perform the inspection
$Tasks.Task.Run();
//Increment the inspection number
++$ResultCount;
//Construct results objects
CogNdmUsedAcquisitionIDCollection acqIDcoll = new CogNdmUsedAcquisitionIDCollection();
CogNdmUsedAcquisitionID usedID = new CogNdmUsedAcquisitionID($AcqID, 0);
acqIDcoll.Add(usedID);
//Call notification function on Engine 0 (set the result data to 0x2021)
$Devices.myCC24.NotifyInspectionComplete(0, acqIDcoll, true, 32,new byte[] {0x20, 0x21 }, 0);