# Operation

This section describes how certain processes work in theory and in practice.

## Theory of Operation

Enabling Buffered Results is typically for ensuring the results are not missed being read into the PLC due to fluctuations in job inspection times, faster triggering rates causing overlapped acquisitions or inspections and applications needing results later in the process. There are also other scenarios to use this functionality.

When the Buffer Results Enable bit is set, the Inspection Result Set fields are held constant until the Inspection Results Ack field has been set to 1 to acknowledge them. The vision system responds to the acknowledgment by clearing the Results Valid bit. Once the Inspection Results Ack field is cleared to 0 and there is a new set of results sent to the PLC, the Results Valid bit gets set to 1 when the new results are loaded. If the Inspection Results Ack bit is cleared and there are no more results in the buffer of the vision system that are to be sent to the PLC, the Results Valid bit remains cleared.

Up to 16 sets of result sets are held in the results buffer.

Reading buffered inspection results into a PLC after an image is acquired consists of setting control bits and reading status bits. As with trigger or acquisition, these bits work together to form a 4-way handshake to keep the PLC and the vision system in sync. The handshaking diagram from How to Acquire an Image applies to the reading of results into the PLC although the event source and acknowledgement are reversed in this case.

1. The Results Valid event signal sent from the vision system needs only to be set when the Inspection Results acknowledgement signal is set low in the PLC.

2. The Inspection Results Acknowledgement is set in the PLC when the Event Results Valid signal has been received and Inspection Result set has processed.

3. The Results Valid event is held high in the vision system until the Inspection Results Ack signal is received from the PLC.

4. The Inspection Results Ack signal must be held high in the PLC until the Event Results Valid signal is cleared in the vision system.

5. Once the Inspection Results Ack signal is cleared, the Results Valid bit is set to 1 if there are more results in the buffer.

   1. This pattern in steps 2 - 5 keeps occurring until the Results Valid bit remains low, meaning the results buffer is empty and all results in the buffer have been read into the PLC.

6. If results are read too slowly and the results buffer fills up (all 16 slots are used) the Results Buffer Overrun bit is set to 1.

7. Once the buffer overrun occurs and no results are read out, no new results are added to the buffer (they are dropped) until results are acknowledged out of the buffer so there is space for a new set(s).

## Process

1. The Results Valid bit is set to 1 when the inspection completes in the vision system.

2. Once the PLC sees the Results Valid bit is set to 1:

   - It reads the new results set from the vision system.

   - It sets the Inspection Results Ack bit to 1.

3. The vision system sees that the Inspection Results Ack bit is set to 1 and sets the Results Valid bit to 0.

4. The PLC then sees the Results Valid bit is 0 and sets the Inspection Results Ack bit to 0.

Steps above (except the first bullet in step 2), correlate to the 4 steps above describing the 4-way handshake.

In the buffered results case steps 1-4 continue driven by the PLC logic until there are no more results to read from the buffer. f the 4-way handshaking is not used, the Results Valid bit just stays set with the last set of results being the most current in the last slot in the buffer, new results are dropped once the buffer is full.

Also note that Buffered Results data can be sent to the PLC from the vision system using manual triggering when the vision system is in offline mode. This is useful for testing and debugging purposes.

Note: If the Buffer Results Enable bit is cleared (set to 0) while result sets still populate the buffer, the Results Valid is cleared and those remaining results are lost. It is best to enable or disable the Buffer Results Enable bit while the vision system is not being triggered or the results could be lost.