Example for Checking the Command Result Code or Error Bits
The following image shows an example PLC logic for checking the Command Result Code or Error bits, in this case specifically a Rockwell ControlLogix PLC:
The signals used are the following:
| Signal Name | Vision System Defined Signal or Tag | PLC User Defined Tag | Notes |
|---|---|---|---|
| CommandCompleted | Yes | - | This bit signals that the job load completed (successful or failed). |
| CommandFailed | Yes | - | This bit signals that the job load fialed, check the ErrorID and CommandResultCode fields. |
| CommandResultCode | Yes | - | This fields holds the result code of the job change operation, 0 if successful and non-zero if there was a problem. |
| JobChangeResultCode | - | Yes | This internal memory tag holds the last unsuccessful command result code when a job failed to load. |
| Error | Yes | - | This bit is set when an error occurs loading the job. |
| ErrorID | Yes | - | This filed holds an error code when an error occurs loading the job. |
| JobChangeErrorID | - | Yes | This internal memory tag holds the last error code when a job failed to load. |
To check for errors or status of the job load, the rung above can be added to the logic of the PLC. This logic is valid for both the job change by ID and job change by name scenarios.
The output instructions run when the CommandCompleted bit is set to 1 and the CommandFailed bit is set to 1, both by the vision system. When these conditions are met the current CommandResultCode is moved into the JobChangeResultCode PLC tag. If the Error bit is set to 1 the current ErrorID is moved to the JobChangeErrorID PLC tag.
The vision system updates CommandResultCode even when the command does not fail, it just does not get copied into the JobChangeResultCode PLC tag, since the value is 0 when it is successful and there is no reason to save that value.