# Load a Job or Recipe Through a PROFINET PLC

Perform the following steps to change the job or recipe running on the vision system through a PROFINET 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.

   Module | ID | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   Acquisition Control | 0x101 | 0 | Set Paused | Reserved | Clear Exposure Complete | Trigger | Trigger Enable
   Acquisition Status | 0x201 | 0 | Online | Paused | Reserved | Acquisition Error | Exposure Complete | Trigger Acknowledge | Trigger Ready
   1 .. 2 | Acquisition ID
   Inspection Control | 0x102 | 0 | Clear Error | Reserved | Execute Command | Set User Data | Inspection Results Acknowledge | Buffer Results Enable
   Inspection Status | 0x203 | 0 | Set User Data Acknowledge | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   1 | Error | Reserved | Results Passed
   2 .. 3 | Error ID
   Command Control Input | 0x108 | 0 .. 1 | Command ID (16-bit)
   Command Control Output | 0x108 | 0 .. 1 | Command Result Code (16-bit)
   2 .. 3 | Reserved (16-bit)
   External Event Control Input | 0x106 | 0 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   External Event Control Output | 0x106 | 0 | 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
   User Data | 0x301 (16) 0x302 (32) 0x302 (64) 0x304 (128) 0x305 (254) | 0 .. | User Data
   Inspection Results | 0x401 (16) 0x402 (32) 0x403 (64) 0x404 (128) 0x405 (250) | 0 .. 1 | Inspection ID
   2 .. 3 | Inspection Result Code
   4 .. | Inspection Results

2. Write the appropriate job/recipe command to invoke the change. The available commands are listed below:

   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 bytes 0-1 of the Command Control Input module:

   Module | ID | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   Acquisition Control | 0x101 | 0 | Set Paused | Reserved | Clear Exposure Complete | Trigger | Trigger Enable
   Acquisition Status | 0x201 | 0 | Online | Paused | Reserved | Acquisition Error | Exposure Complete | Trigger Acknowledge | Trigger Ready
   1 .. 2 | Acquisition ID
   Inspection Control | 0x102 | 0 | Clear Error | Reserved | Execute Command | Set User Data | Inspection Results Acknowledge | Buffer Results Enable
   Inspection Status | 0x203 | 0 | Set User Data Acknowledge | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   1 | Error | Reserved | Results Passed
   2 .. 3 | Error ID
   Command Control Input | 0x108 | 0 .. 1 | Command ID (16-bit)
   Command Control Output | 0x108 | 0 .. 1 | Command Result Code (16-bit)
   2 .. 3 | Reserved (16-bit)
   External Event Control Input | 0x106 | 0 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   External Event Control Output | 0x106 | 0 | 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
   User Data | 0x301 (16) 0x302 (32) 0x302 (64) 0x304 (128) 0x305 (254) | 0 .. | User Data
   Inspection Results | 0x401 (16) 0x402 (32) 0x403 (64) 0x404 (128) 0x405 (250) | 0 .. 1 | Inspection ID
   2 .. 3 | Inspection Result Code
   4 .. | Inspection Results

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

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

   Write the job/recipe name starting from bytes 0 of the User Data block as shown in the below table.

   Module | ID | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   Acquisition Control | 0x101 | 0 | Set Paused | Reserved | Clear Exposure Complete | Trigger | Trigger Enable
   Acquisition Status | 0x201 | 0 | Online | Paused | Reserved | Acquisition Error | Exposure Complete | Trigger Acknowledge | Trigger Ready
   1 .. 2 | Acquisition ID
   Inspection Control | 0x102 | 0 | Clear Error | Reserved | Execute Command | Set User Data | Inspection Results Acknowledge | Buffer Results Enable
   Inspection Status | 0x203 | 0 | Set User Data Acknowledge | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   1 | Error | Reserved | Results Passed
   2 .. 3 | Error ID
   Command Control Input | 0x108 | 0 .. 1 | Command ID (16-bit)
   Command Control Output | 0x108 | 0 .. 1 | Command Result Code (16-bit)
   2 .. 3 | Reserved (16-bit)
   External Event Control Input | 0x106 | 0 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   External Event Control Output | 0x106 | 0 | 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
   User Data | 0x301 (16) 0x302 (32) 0x302 (64) 0x304 (128) 0x305 (254) | 0 .. | User Data
   Inspection Results | 0x401 (16) 0x402 (32) 0x403 (64) 0x404 (128) 0x405 (250) | 0 .. 1 | Inspection ID
   2 .. 3 | Inspection Result Code
   4 .. | Inspection Results

4. Set the Execute Command bit by setting the Bit 3 of the Inspection Control module.

   Module | ID | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   Acquisition Control | 0x101 | 0 | Set Paused | Reserved | Clear Exposure Complete | Trigger | Trigger Enable
   Acquisition Status | 0x201 | 0 | Online | Paused | Reserved | Acquisition Error | Exposure Complete | Trigger Acknowledge | Trigger Ready
   1 .. 2 | Acquisition ID
   Inspection Control | 0x102 | 0 | Clear Error | Reserved | Execute Command | Set User Data | Inspection Results Acknowledge | Buffer Results Enable
   Inspection Status | 0x203 | 0 | Set User Data Acknowledge | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   1 | Error | Reserved | Results Passed
   2 .. 3 | Error ID
   Command Control Input | 0x108 | 0 .. 1 | Command ID (16-bit)
   Command Control Output | 0x108 | 0 .. 1 | Command Result Code (16-bit)
   2 .. 3 | Reserved (16-bit)
   External Event Control Input | 0x106 | 0 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   External Event Control Output | 0x106 | 0 | 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
   User Data | 0x301 (16) 0x302 (32) 0x302 (64) 0x304 (128) 0x305 (254) | 0 .. | User Data
   Inspection Results | 0x401 (16) 0x402 (32) 0x403 (64) 0x404 (128) 0x405 (250) | 0 .. 1 | Inspection ID
   2 .. 3 | Inspection Result Code
   4 .. | Inspection Results

5. Wait for the Command Completed or Command Failed bit of the System Output module to be set (bits 6 and 5 of the Inspection Status module, respectively).

   Module | ID | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   Acquisition Control | 0x101 | 0 | Set Paused | Reserved | Clear Exposure Complete | Trigger | Trigger Enable
   Acquisition Status | 0x201 | 0 | Online | Paused | Reserved | Acquisition Error | Exposure Complete | Trigger Acknowledge | Trigger Ready
   1 .. 2 | Acquisition ID
   Inspection Control | 0x102 | 0 | Clear Error | Reserved | Execute Command | Set User Data | Inspection Results Acknowledge | Buffer Results Enable
   Inspection Status | 0x203 | 0 | Set User Data Acknowledge | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   1 | Error | Reserved | Results Passed
   2 .. 3 | Error ID
   Command Control Input | 0x108 | 0 .. 1 | Command ID (16-bit)
   Command Control Output | 0x108 | 0 .. 1 | Command Result Code (16-bit)
   2 .. 3 | Reserved (16-bit)
   External Event Control Input | 0x106 | 0 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   External Event Control Output | 0x106 | 0 | 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
   User Data | 0x301 (16) 0x302 (32) 0x302 (64) 0x304 (128) 0x305 (254) | 0 .. | User Data
   Inspection Results | 0x401 (16) 0x402 (32) 0x403 (64) 0x404 (128) 0x405 (250) | 0 .. 1 | Inspection ID
   2 .. 3 | Inspection Result Code
   4 .. | Inspection Results

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. The Set Paused bit is Bit 7 of the Acquisition Control module, while Execute Command is Bit 3 of the Inspection Control module, respectively.

   Module | ID | Byte | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
   --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
   Acquisition Control | 0x101 | 0 | Set Paused | Reserved | Clear Exposure Complete | Trigger | Trigger Enable
   Acquisition Status | 0x201 | 0 | Online | Paused | Reserved | Acquisition Error | Exposure Complete | Trigger Acknowledge | Trigger Ready
   1 .. 2 | Acquisition ID
   Inspection Control | 0x102 | 0 | Clear Error | Reserved | Execute Command | Set User Data | Inspection Results Acknowledge | Buffer Results Enable
   Inspection Status | 0x203 | 0 | Set User Data Acknowledge | Command Failed | Command Completed | Command Executing | Results Valid | Results Buffer Overrun | Inspection Completed | System Ready
   1 | Error | Reserved | Results Passed
   2 .. 3 | Error ID
   Command Control Input | 0x108 | 0 .. 1 | Command ID (16-bit)
   Command Control Output | 0x108 | 0 .. 1 | Command Result Code (16-bit)
   2 .. 3 | Reserved (16-bit)
   External Event Control Input | 0x106 | 0 | External Event 7 | External Event 6 | External Event 5 | External Event 4 | External Event 3 | External Event 2 | External Event 1 | External Event 0
   External Event Control Output | 0x106 | 0 | 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
   User Data | 0x301 (16) 0x302 (32) 0x302 (64) 0x304 (128) 0x305 (254) | 0 .. | User Data
   Inspection Results | 0x401 (16) 0x402 (32) 0x403 (64) 0x404 (128) 0x405 (250) | 0 .. 1 | Inspection ID
   2 .. 3 | Inspection Result Code
   4 .. | Inspection Results