# Load a Job or Recipe Through an Ethernet/IP PLC

Perform the following steps to change the job or recipe running on the vision system through an RSLogix PLC.

1. If you are loading a new job, then first place the vision system to a Paused state by setting the Set Paused bit high.

   Note: You can skip this step when changing recipes.

   Instance | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   23 | 0 | Set Paused | Reserved | Execute Command | Inspection Results Acknowledge | Buffer Results Enable | Trigger | Trigger Enable
   1 | Reserved
   2 | Reserved | Clear Exposure Complete | Clear Error | Reserved | Set User Data
   3 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   4 .. 5 | Command ID
   6 .. 7
   8 .. 495 | User Data 0 - 487
   Instance | Byte
   23 | 0
   1 | Reserved

2. Use the applicable Command ID in the command block to initiate the job/recipe change.

   Name | Command ID (Hex) | Command ID (Dec)
   --- | --- | ---
   Load Job by Name | 0x4000 | 16384
   Load Job by ID | 0x0-0x3E7 | 0-999
   Load Recipe by Name | 0x4001 | 16385
   Load Recipe by ID | 0x3E8-0x7CF | 1000-1999

   Write the Command ID of the selected action into bytes 4-5 or 6-7 as shown in the below table.

   Instance | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   23 | 0 | Set Paused | Reserved | Execute Command | Inspection Results Acknowledge | Buffer Results Enable | Trigger | Trigger Enable
   1 | Reserved
   2 | Reserved | Clear Exposure Complete | Clear Error | Reserved | Set User Data
   3 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   4 .. 5 | Command ID
   6 .. 7
   8 .. 495 | User Data 0 - 487
   Instance | Byte
   23 | 0
   1 | Reserved

3. If you perform the Load Job by Name or Load Recipe by Name action, then write the job name (without the *.jobx extension) or the recipe name into the User Data command block.

   Note: The job/recipe name needs to be null terminated (that is, a 0 must be added in the byte immediately following the job/recipe name).

   Write the job/recipe name into bytes 8-495 (User Data) of the command block as shown in the below table.

   Instance | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   23 | 0 | Set Paused | Reserved | Execute Command | Inspection Results Acknowledge | Buffer Results Enable | Trigger | Trigger Enable
   1 | Reserved
   2 | Reserved | Clear Exposure Complete | Clear Error | Reserved | Set User Data
   3 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   4 .. 5 | Command ID
   6 .. 7
   8 .. 495 | User Data 0 - 487
   Instance | Byte
   23 | 0
   1 | Reserved

4. Set the Execute Command bit in the command block by triggering Bit 4 of Byte 0, as shown below.

   Instance | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   23 | 0 | Set Paused | Reserved | Execute Command | Inspection Results Acknowledge | Buffer Results Enable | Trigger | Trigger Enable
   1 | Reserved
   2 | Reserved | Clear Exposure Complete | Clear Error | Reserved | Set User Data
   3 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   4 .. 5 | Command ID
   6 .. 7
   8 .. 495 | User Data 0 - 487
   Instance | Byte
   23 | 0
   1 | Reserved

5. Wait for the Command Completed or Command Failed bit to be set (Bit 6 or 5 of Byte 1, respectively).

   Instance | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   14 | 0 | Online | Paused | Reserved | Acquisition Error | Reserved | Trigger Acknowledge | Trigger Ready
   1 | Error | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   2 | Reserved | Results Passed | Exposure Complete | Reserved | Set User Data Acknowledge
   3 | External Event Acknowledge 7 | External Event Acknowledge 6 | External Event Acknowledge 5 | External Event Acknowledge 4 | External Event Acknowledge 3 | External Event Acknowledge 2 | External Event Acknowledge 1 | External Event Acknowledge 0
   4 .. 5 | Error ID (16-bit integer)
   6 .. 7 | Command Result Code (16-bit integer)
   8 .. 9 | Reserved (16-bit integer)
   10 .. 11 | Acquisition ID (16-bit integer)
   12 .. 13 | Inspection ID (16-bit integer) Note: OPC/UA does not support Inspection ID.
   14 .. 15 | Inspection Result Code (16-bit integer)
   16 .. 499 | Inspection Results 0 - 483

6. Once either the Command Completed or Command Failed bit is detected, clear the Execute Command bit. Also, if you previously set the vision system to a Paused state, then clear the Set Paused bit as well to set the vision system Online.

   Instance | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   23 | 0 | Set Paused | Reserved | Execute Command | Inspection Results Acknowledge | Buffer Results Enable | Trigger | Trigger Enable
   1 | Reserved
   2 | Reserved | Clear Exposure Complete | Clear Error | Reserved | Set User Data
   3 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   4 .. 5 | Command ID
   6 .. 7
   8 .. 495 | User Data 0 - 487
   Instance | Byte
   23 | 0
   1 | Reserved