# Job Change Signals

The Job Change signals are the following:

- [out] Execute Command:

  When set to 1 in the PLC, the vision system loads the job ID specified in the Command ID field or executes the job load by name command to load the job name given in the User Data buffer. The signal must be held high until the Command Completed signal is set to 1 in the vision system. Once the Command Completed bit is set, clearing the Execute Command bit also clears the Command Completed bit.

- [out] Command ID:

  This is a 16-bit integer that either indicates the Job ID number (0-999) of the job to load, or specifies the Job Load by Name command (16384). The job load is executed on the rising edge of the Execute Command bit is set to 1 by the PLC. The Command ID field must be held constant between the rising edge of the Execute Command signal and the rising edge of the Command Completed signal, or the results are indeterminate. If using the Job Load by Name command, the job name must be transferred to the User Data buffer before setting the Execute Command bit.

  Command ID (hex) | Command ID (dec) | Description
  --- | --- | ---
  0x0000 – 0x03E7 | 0-999 | Execute job change by Job ID.
  0x03E8 - 0x1006 | 1000 - 4102 | Reserved.
  0x1007 | 4103 | Initiate the Job Validation process.
  0x1008 - 0x3FFF | 4104 -16383 | Reserved.
  0x4000 | 16384 | Execute the job change by job name.

- [out] User Data:

  Typically the User Data buffer byte array field has data written into it by PLC logic which can then be read into the Spreadsheet using the ReadUserDataBuffer function. You can also use this command to change the job using a job name. So the PLC populates the bytes in this field with the job name to change to with or without the .jobx extension.

  Note: If the extension is not used and 2 or more jobs have most of the name the same the incorrect job could be loaded so it is recommended to use the .jobx extension with the name. The Set User Data bit does not need to be used when changing jobs by name.

- [in] Command Executing:

  This bit is set to 1 when a job load is in process. It is only set if the job load execution was initiated from the PLC and does not change states if the job change was initiated from In-Sight Vision Suite, WebHMI, or discrete inputs. The Command Completed and Command Failed bits are set prior to the falling edge of this bit.

- [in] Command Completed:

  When a Command completes, the Command Executing bit is set low to 0 and if the Execute Command bit is still set to 1, the Command Completed bit is set. If the Command did not successfully complete, the Command Failed bit is also set. The vision system clears the Command Completed bit when the Execute Command bit goes low.

- [in] Command Failed:

  This bit is set on the completion of a Command if the Command failed to execute successfully or if an unknown Command ID was set. The Command Failed is always set before the Command Completed bit is set. The Command Failed bit stays set until a successful job change is completed. This bit state is only changed when the PLC initiates the job change and is not effected if a job change is initiated from a WebHMI or In-Sight Vision Suite. Depending on the reason the command failure occurred the reason can be determined by checking the Command Result Code field or the Error ID field.

- [in] Command Result Code:

  The Command Result Code is a 16-bit integer field that indicates the reason a command failed to execute successfully (the code is specific to the command executed):

  Command Result Code (hex) | Command Result Code (dec) | Description
  --- | --- | ---
  0x0000 | 0 | Command succeeded or unknown failure.
  0x0002 | 2 | Bad command.
  0x0010 | 16 | Job Validation result is valid.
  0x0011 | 17 | Job Validation result is invalid.
  0x0012 | 18 | Job Validation result is an error.
  0x208D | 8333 | Request is incompatible with system state.

  The Command Result Code is retained until a successful command is executed.

- [in] Current Job ID:

  A 16-bit integer that denotes the job ID number of the currently loaded and running job on the vision system, or 65535 (-1) if the currently loaded job does not have an ID number. This field is updated when the job is changed on the vision system, regardless of method of job change (In-Sight Vision Suite, WebHMI, PLC, discrete inputs).

- [in] Error:

  The Error bit is set when an error has occurred, which is defined in the Error ID field. Note that this bit along with the Error ID are a 16 deep buffer holding the last 16 errors that occurred. It is a FIFO buffer with the newest error at the end of the buffer. Errors are cleared by setting or clearing the Clear Error bit until the Error bit remains cleared and the Error ID is 0.

- [in] Error ID:

  The Error ID is a 16-bit integer field holding a numeric representation of the error that has occurred.

  The following table summarizes Error ID codes:

  Error ID (hex) | Error ID (dec) | ID Code | Description
  --- | --- | --- | ---
  0x0000 | 0 | No Error | No error occurred.
  0x0100 | 256 | Trigger set while disabled | Occurs when the Trigger bit is set while the Trigger Enable bit is cleared and the Trigger Type parameter of the Acquisition Settings is set to Single and Trigger Source parameter includes the Factory Protocols checkbox checked.
  0x0101 | 257 | Trigger set while Offline | Occurs when the Trigger bit is set while the vision system is Offline.
  0x0400 | 1024 | Already Executing Error | Occurs when the Execute Command bit is set again while the Command Executing bit is still set to 1.
  0x0401 | 1025 | Job load requested while Online | Occurs when a Job Load command (by ID or name) is issued while the vision system is Online.
  0x0402 | 1026 | Job load requested does not exist on the camera | Occurs when a Command ID sent in the Command field does not exist as a prefix for any job in the file system of the vision system. For example, if you send Command ID = 123, but there is no job on the camera which contains 123xxxxx.jobx.
  0x0403 | 1027 | Job Validation requested when Online | Occurs when a job validation command is issued while the vision system is Online
  0x0404 | 1028 | Job Validation not configured | Occurs when the vision system is not configured to run a job validation. Most likely System Validation is not enabled.
  0x0405 | 1029 | Job Validation is already in progress | Occurs when a job validation command is issued when another is already in progress. You need to monitor the Command Executing and Command Completed bit states before initiating another command.

- [out] Clear Error:

  When the Clear Error bit is set, it clears the Error and Error ID signals. The Clear Error bit needs to remain set until the PLC sees the Error bit being cleared then the Clear Error bit needs to be cleared. This is another example of the 4-way handshaking between the PLC and the vision system. This process needs to be repeated until the Error bit stays cleared since the Error or Error ID are stored in a 16 deep buffer and each time the Clear Error bit is set and then cleared the next Error ID is read by the PLC.