Controlling Your QuickBuild Application With Discrete I/OCognex VisionPro

Your QuickBuild application can use the discrete input and output capabilities of a Cognex frame grabber or Measurement Computing board to communicate with the external equipment of your production environment. QuickBuild can accept the discrete input signals necessary to control the application from remote sources, as well as generate the discrete output signals necessary to transmit tool results and other result data to the devices necessary to complete the overall vision task.

See the topic Using I/O Lines for more information on how VisionPro maps input and output lines to the physical connections on various Cognex frame grabbers. When you are ready to configure discrete I/O for a QuickBuild application, use the Communications Explorer as described in the topic Using the Communications Explorer.

This topic provides the background information about the discrete I/O signals that QuickBuild supports.

Setting the Correct I/O Configuration in the VisionPro.ini File

QuickBuild uses the definitions contained in the file VisionPro.ini to define the I/O hardware you use to communicate with external equipment. To successfully receive and send discrete I/O signals through your Cognex frame grabber or Measurement Computing board, the settings in VisionPro.ini must match the I/O hardware you plan to use.

The VisionPro.ini file contains default settings which might or might not match the I/O hardware you have installed. For example, if you use a Cognex MVS-8504 frame grabber, the default setting in VisionPro.ini defines a reference to the external opto-isolated I/O module 800-5712-3 as shown:

;******************************************************************************
; This section specifies the configuration of 8504 frame
; grabbers.  Additional sections should be added if there are more
; than two 8504 boards installed.  The possible settings are:
;
;     IOConfig = Standard     : Pass-through TTL connection module 
;                               800-5818-1 with cable 300-0390 
;     IOConfig = External     : External opto-isolated I/O module
;                               800-5712-3 with cable 300-0389
;     IOConfig = Split        : External opto-isolated I/O module
;                               800-5712-3 and TTL terminal block
;                               with cable 300-0399
;
[CogFrameGrabber8504 #0]
IOConfig = External

If you plan to use the pass-through TTL connection module 800-5818-1 with your Cognex 8504, you must edit this reference to IOConfig, as shown:

[CogFrameGrabber8504 #0]
IOConfig = Standard

See the topic Configuring VisionPro.ini for information on modifying the file, which by default is located in the Windows folder.

Online and Offline

As a QuickBuild application executes it accepts image acquisition triggers and uses the vision tools it contains to analyze each image and generate results. While analyzing each acquired image, the ability of the application to respond to input signals and generate output signals depends on whether QuickBuild I/O functions are Online or Offline.

While Online, a QuickBuild application can interact with external equipment configured to send outgoing signals or accept incoming data. QuickBuild supports a variety of discrete input signals that perform an assortment of tasks including the ability to run all the Jobs within the application once or continuously, perform an emergency stop of all Jobs, or even toggle the current Online/Offline status of the application. The discrete output signals that a QuickBuild application can generate include tool results, the signal that an image acquisition has completed, or a pulsed signal that simply indicates that the application is currently Online. See the section Signal Types for a list of all valid incoming and outgoing signals a QuickBuild application can use. Deployed QuickBuild applications typically operate Online.

While Offline, a QuickBuild application cannot generate any output signals and disregards incoming signals that would control the application, with two exceptions:

  • The input signal that switches QuickBuild to Online
  • The signal that forces all Jobs within the application to stop executing

An application that is currently Offline can still run the Jobs it contains, but it cannot be switched Online while any Job is running. In addition, the state of output signals cannot be defined while an application is Offline, and are likely to exist in whatever state they were in when the application switched from Online to Offline. You typically use QuickBuild in an Offline status as you develop your application and run your Jobs without interacting with external devices.

There are several ways to switch the status of your application between Online and Offline:

  • Click the Online button on the QuickBuild button bar:

    Framework PhysicalIO Theory Controlling The Application Online Button On Bar

  • Choose Configure: Online I/O enabled from the QuickBuild Configuration menu.

    Framework PhysicalIO Theory Controlling The Application Online From Configuration Menu

  • Send your application an Online input signal.

    See the section Signal Types for a list of all input signals a QuickBuild application can receive.

The QuickBuild button bar and status bar will indicate when QuickBuild is Online. Finally, be aware that the QuickBuild application can still respond to incoming acquisition triggers, activate connected strobe lights, and run the Jobs it contains regardless of whether the application is Online or Offline.

Signal Types

Your QuickBuild application can accept and generate a variety of discrete I/O signals and communicate with external equipment attached to your Cognex frame grabber or Measurement Computing board.

Line Polarity

As you configure your QuickBuild application to accept an input signal or generate an output signal, you must select the polarity the line must use to indicate the signal is present. Some signals require the discrete line switch from a Low to High or High to Low state, as illustrated in the following figure:

Framework PhysicalIO Theory Controlling The Application Line Transition Graphic

The cycle time, or pulse width, and the choice of which transition you want to use to identify the signal can depend on the external equipment communicating with your QuickBuild application.

Other discrete signals require an active line state to indicate their presence, as illustrated in the following figure:

Framework PhysicalIO Theory Controlling The Application Active Line State Graphic

Signal Parameters

Each input signal you want to accept or output signal you want to transmit can be described by the following parameters:

  • Line: The specific discrete I/O line on your output hardware
  • Usage: Some lines are bidirectional so you must specify each line as an output line or an input line explicitly.
  • Owner: Each signal belongs to a specific Job or to the entire QuickBuild application.
  • Field: The specific signal type
  • Pulse Width: The length of an outgoing pulse signal
  • Polarity: The transition from Low to High or High to Low, or the active line state of High or Low
  • Description: Your description of the outgoing signal
Output Signals

A QuickBuild application can generate any of the output signals listed in the following table:

Table 1. Output Signals
Signal TypeDescription

System Heartbeat

A System Heartbeat is a square wave signal used by various programmable logic controllers (PLCs) in many production environments. A QuickBuild application, regardless of how many jobs it contains, can only generate one System Heartbeat.

QuickBuild generates a configured System Hearbeat signal any time the application is Online. See the section Online and Offline for more information. When the application is Offline, it does not generate a System Heartbeat.

Be aware of the following usage notes regarding a System Heartbeat:

  • Any signal length you specify will have a millisecond or two of uncertainty, and that pulse timing becomes less accurate as the pulse width decreases
  • If other processes operating on the PC divert the CPU away from the QuickBuild application, an individual heartbeat pulse might halt at its current level until QuickBuild is given the CPU again. This might cause an uneven pulse in the Heartbeat Signal.
  • When you switch the application from Online to Offline, the state of the line being used for the System Hearbeat will remain at a Low or High state. QuickBuild does not reset the line.
  • If you configure a System Hearbeat and use external equipment to monitor it, the lack of the signal indicates either the application is Offline, not running, or that the QuickBuild software has stopped executing altogether.
  • The output level from all other output signals are valid on the asserted edge of each heartbeat pulse. If you are using other equipment to sample a level signal, the System Heartbeat is the easiest method for determining when to time the sampling.

Pulsed Signals

Your QuickBuild application can send a variety of pulsed signals, configured in milliseconds, to indicate the following job events which occur during the vision processing cycle:

  • Acquisition Complete: An image acquisition has completed for the associated Job.
  • Move Part: The object under inspection for the associated Job can be moved without affecting the image currently being acquired.

    A QuickBuild job generates the Move Part signal before the Acquisition Complete signal.

  • Job Running: Indicates that the associated Job is analyzing its latest image.

    Be aware of the following usage notes regarding a pulsed Job Running signal:

    • The signal has the same timing and pulse width as the System Heartbeat.
    • The signal changes state periodically while the Job runs.
    • In some situations the signal might require 3x the pulse width of the Heartbeat Signal for an asserted edge to appear after the Job starts running.
    • The signal stops pulsing when the Job stops.
  • Data Ready: Indicates that the status of a tool property, such as its Accept/Reject status, has been asserted on another output line.

    You must configure a Data Ready signal on one output line if you want to send the status of a tool property over a different output line. QuickBuild asserts the Data Ready signal after all output lines carrying any tool property for this Job have been asserted.

    Be aware of the following usage notes regarding a Data Ready signal:

    • If you do not enable any tool result to be sent over a discrete output line, QuickBuild does not assert the Data Ready signal.
    • QuickBuild enforces a line state opposite in polarity and equal in duration to the configured pulse width.

      For example, if you configure a Data Ready to go High for a duration of 50 milliseconds, then the same output line will return to a Low state for a minimum of 50 milliseconds. Your QuickBuild application will not support an interval between pulses that is shorter than the pulse duration.

    • The output line carrying the tool result is valid on the asserted edge of the Data Ready signal.

    The following timing diagram illustrates the timing relationship between an output signal carrying a tool result and the Data Ready signal:

    Framework PhysicalIO Theory Controlling The Application Data Ready Timing Diagram

Level Signals

Your QuickBuild application can generate different types of level signals to indicate the current status of a particular Job or the application as a whole:

  • Job Running: Indicates that the associated Job is analyzing its latest image.

    Be aware of the following usage notes regarding a level Job Running signal:

    • The signal remains asserted as long as the Job is running.

      If the Job runs continuously, the signal remains asserted.

    • The signal level is valid whenever an optional Heartbeat Signal is active.

      If you are using external equipment to monitor the Job Running signal, it should be polled on the asserted edge of the Heartbeat Signal.

    • The signal changes polarity if the application is Online and the Job stops running.
  • Application Running: Indicates that at least one Job in the application is analyzing its latest image.

    Be aware of the following usage notes regarding a level Application Running signal:

    • The signal remains asserted as long as any Job is running.

      As long as a single Job within the application is running, the signal remains asserted.

    • The signal level is valid whenever an optional Heartbeat Signal is active.

      If you are using external equipment to monitor the Application Running signal, it should be polled on the asserted edge of the Heartbeat Signal.

    • The signal changes polarity if the application is Online and all Jobs stop running.

    The following timing diagram illustrates the timing relationship between two Job Running signals and the Application Running signal:

    Framework PhysicalIO Theory Controlling The Application App Running Timing Diagram

Tool Properties

QuickBuild can send the Accept/Warning/Reject/Error result or the True/False result of any tool within any job. For example you might transmit the Result status for a specific QuickBuild job, or just the True/False result of a single expression within a Results Analysis tool.

When you configure an output signal to carry a tool property, QuickBuild will assert the output line when the tool property matches the property you configured. For example, if the property is False at the time you configure the output line, QuickBuild will only assert the output signal when the same tool property is False each time the Job runs.

Input Signals

A QuickBuild application can respond to a variety of input signals. QuickBuild does not enforce a minimum time period that an input signal must be asserted in order to be recognized, but it must be asserted long enough for QuickBuild to recognize the change of state in the input line. As you develop and test your application, you might choose to mirror any input signal with its corresponding output signal in order to verify that the input signal has sufficient duration and level to trigger the desired event. For example, the outgoing System Heartbeat is active anytime QuickBuild is Online. If you want to confirm that your QuickBuild application received an input signal to go Online, you can configure a System Heartbeat and then monitor its output line to ensure the application acknowledges the signal to go Online.

In general, a Cognex frame grabber can recognize a change of state for a span of 1 millisecond. If you are using a Measurement Computing board to generate an input signal, the signal should be held in the desired state for double the specified polling period. Refer to your Measurement Computing documentation for details on the recommended polling time.

A QuickBuild application can respond to any of the following input signals:

Table 2. Input Signals
Signal TypeDescription

Online

An Online signal switches the QuickBuild application from Offline to Online, where it can respond to all input signals and generate any output signals it has been configured to send. See the section Online and Offline for more information. The Online signal performs the same function as the Online option from the Configuration menu or the Online button on the tool bar:

Framework PhysicalIO Theory Controlling The Application Just The Online Button

Be aware of the following usage notes regarding an Online signal:

  • If the QuickBuild application is already Online, an Online signal has no effect.
  • QuickBuild responds to the asserted edge of the signal to go Online, and will take the application Offline on the non-asserted edge of the signal.
  • If you configure an input line to carry the Online signal in an Active High polarity, and the input line is already in an Active High polarity, then a change in the active line state must occur for QuickBuild to recognize the request to go Online.
  • Switching the application to Online will automatically start an outgoing System Heartbeat, if configured.
  • QuickBuild cannot go Online while any Job is running

    While an application is Offline, there is no way to check the status of any Job Running signals. QuickBuild must wait for all Jobs to stop running before it can successfully receive the Online signal.

  • You cannot switch the application to Online while the Emergency Stop signal has been asserted.

    You must clear an Emergency Stop signal before QuickBuild will accept an Online signal.

  • The Online signal has no effect on hardware triggers that generate image acquisitions.
  • If you use a Run Continuous signal to run a single Job or all Jobs in the application continuously, Cognex recommends you de-assert the Run Continuous signal before switching the application Offline.

Emergency Stop

An Emergency Stop signal stops all running Jobs and switches QuickBuild to Offline status. The QuickBuild application discards any result data currently stored in the I/O queue.

Use an Emergency Stop signal to block all output signals in a production environment where you might need to prevent equipment from receiving a signal such as Move Part signal or the Reject result of a tool property.

Be aware of the following usage notes regarding the Emergency Stop signal:

  • Cognex strongly recommends you do not configure any line to accept an Emergency Stop signal without an actual device connected to that input line.

    If you configure an Emergency Stop signal but do not drive the input line to its de-asserted state, it is possible for QuickBuild to read a floating signal and act as if the Emergency signal had been asserted.

  • You cannot run the QuickBuild application or any Jobs it contains while the input line carrying the Emergency Stop signal is asserted.

    The input line carrying the Emergency Stop signal must be set to its non-asserted state before you can continue.

  • QuickBuild will respond to an Emergency Stop signal regardless of whether it is Online or Offline.
  • Unlike other input and output signals, an Emergency Stop signal prevents the QuickBuild application from firing connected strobe lights.
  • Any output lines configured to send a Job Running or Data Ready signal will be left in their non-asserted state after the Emergency Stop signal has been cleared.

Run Once

A Run Once signal can be issued to the entire QuickBuild application to run all the Jobs it contains once, or it can be targeted at a single Job within the application. A Run Once signal performs the same function as the Run Once button:

Framework PhysicalIO Theory Controlling The Application Run Once Button

Be aware of the following usage notes regarding the Run Once signal:

  • QuickBuild must be Online to respond to a Run Once signal.
  • QuickBuild responds to the asserted edge of the Run Once signal to run a single Job or all the Jobs it contains.
  • If QuickBuild receives a Run Once signal and the desired Job/Jobs are already running, QuickBuild logs an I/O error and will not run the Job(s) later.
  • If configured, a Job Running signal will assert as the Job(s) execute and then switch to its non-asserted state.
  • If the Run Once signal is asserted longer than the Job(s) require to run, the Job(s) will not run again.

Run Continuously

A Run Continuous signal can be issued to the entire QuickBuild application to run all the Jobs it contains continuously, or it can be targeted at a single Job within the application.

Use the Run Continuous signal when you want to acquire and inspect images in a continuous manner, which is typical of a deployed application. The Run Continuous signal performs the same function as the Run Continuous button:

Framework PhysicalIO Theory Controlling The Application Just Run Continuous Button

Be aware of the following usage notes regarding the Run Continuous signal:

  • QuickBuild must be Online to respond to a Run Continuous signal.
  • QuickBuild responds to the asserted edge of the Run Continuous signal to run a single Job or all the Jobs it contains, and will stop running continuously on the non-asserted edge of the signal.
  • If configured, a Job Running signal will assert as the Job(s) execute and then switch to its non-asserted state on the non-asserted edge of the Run Continuous signal.
  • The button for Run Continuous takes precedence over the Run Continuous signal.

    Pressing the button will start or stop the Job(s) running continuously, regardless of the state of the Run Continuous signal.

  • QuickBuild does not respond to the Run Continuous signal if the application has stopped due to an error, such as an image queue overflow.

    To restart one or more Jobs after an error, the Run Continuous signal needs to be switched to its non-asserted state and then activated again.

Use Cases

The following diagram illustrates how multiple Jobs in a QuickBuild application can use the discrete I/O signals from a combination of Cognex frame grabbers and Measurement Computing boards:

Framework PhysicalIO Theory Controlling The Application Just For Lou Palmieri

The following table describes several use cases for Discrete I/O and the I/O signals you can use.

Table 3. Discrete I/O Use Cases
TaskDiscrete I/O Signals

Signal all Jobs in a QuickBuild application to run continuously

  • Send the QuickBuild application an Online signal.
  • Confirm the application is Online by monitoring the Heartbeat Signal (if configured).
  • Send the QuickBuild application a Run Continuous signal.
  • Monitor the Job Running signal (if configured) to confirm Jobs are running.

Collect a tool result

  • Confirm the application is Online by monitoring the Heartbeat Signal (if configured).
  • Monitor the Data Ready signal.
  • Poll the output line carrying the tool result on the asserted edge of the Data Ready signal.

Stop the QuickBuild application from running all Jobs

  • De-assert the Run Continuous signal
  • Monitor the Job Running signal (if configured) to confirm Jobs are not running.

Disable all output signals but allow the QuickBuild application to continue running

  • Send the QuickBuild application an Offline signal.
  • Confirm the application is Offline by monitoring the Heartbeat Signal (if configured).

Stop the QuickBuild application from running all Jobs and disable all output signals from QuickBuild, include the signals to activate strobe lights

  • Send the QuickBuild application an Emergency Stop signal.

    The input line carrying the Emergency Stop signal must be set to its non-asserted state before you can continue.