# Example for Inspection

The following image shows an example PLC logic for reading the results of an inspection from the vision system to a PLC, 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
--- | --- | --- | ---
ResultsValid | Yes | - | This bit is set when results are ready for PLC to read.
InspectionResultsAck | Yes | - | PLC sets this bit after it has read the results from the vision system.
RV_ONS | - | Yes | This bit is for detecting the rising edge of ResultsValid and enabling the rung outputs for one program scan (internal bit, it is set or unset automatically by the PLC).
InspectionResults | Yes | Yes | Tool results as defined the in the vision system job copied into a data array.
Saved_Results | - | Yes | Copy of the results read for PLC to operate on as needed depending on the application.

When the vision system finishes the inspection of the acquired image after being triggered, it sends the result set to the PLC along with the state of ResultsValid bit set to 1.

The ResultsValid bit in rung 0 is read in and set to 1 (and the InspectionResultsAck bit is not set or 0), so the RV_ONS bit becomes set for 1 PLC scan and enables the COP instruction to run.

The COP instruction is a copy instruction that copies multiple bytes of data from one source tag to another tag. So the Results array bytes of the vision system are copied to the Saved_Results tag for the PLC to evaluate and act on as needed for the application. More in depth PLC logic can be written to save the Inspection ID (using a MOV instruction), Inspection Result Code (using a MOV instruction) and JobPass bit (setting a bit output) as needed for the application.

After the results are copied, rung 1 sees that ResultsValid is still set and the InspectionResultsAck bit then sets to 1 and sent to the vision system. The vision system sees this and then resets or 0 out the ResultsValid bit and send that back to the PLC. This then causes the InspectionResultsAck to be reset to 0 in rung 1 of the PLC logic.