ClearResultsBuffer

Clears any buffered results from a factory protocol results buffer after a specified event. When the function receives the specified event, the following occurs: 

  • All the results queued in the results buffer will be removed (if results buffering is enabled).
  • The current results being reported over the currently enabled factory protocol will be cleared (including the result ID, result code and all result data).
  • The results valid bit will be cleared.

After the ClearResultsBuffer function executes, additional results may be queued, using the WriteResultsBuffer function. For more information, see WriteResultsBuffer.

Note: While clearing the results buffer, the vision object will be locked, therefore any communications between the In-Sight vision system and the PLC over the factory communication protocol will be delayed until the action of clearing the results is complete.

ClearResultsBuffer Inputs

Syntax: ClearResultsBuffer(Event)

Parameter Description

Event

Specifies the spreadsheet event that triggers the data to be cleared from the results buffer. This parameter must be a reference to one of the following:

  • The Image data structure in cell A0, containing the AcquireImage function. For more information, see AcquireImage.
  • A cell containing an Event function. For more information, see Event.
  • A cell containing a Button function. For more information, see Button.

ClearResultsBuffer Outputs

Returns

A value of 1; returns #ERR if the input parameter is invalid.

ClearResultsBuffer Example

The ClearResultsBuffer function is used to clear the results buffer of the PROFINET factory communication protocol, when the In-Sight vision system transitions from Offline to Online.

  1. To begin, the PLC enables results buffering.

  2. Next, the PLC triggers an acquisition.

  3. The In-Sight vision system responds by acquiring the image and sending the results into the Results Buffer using the WriteResultsBuffer function.

  4. The PLC triggers another acquisition.

  5. Again, the In-Sight vision system responds by acquiring the image and sending the results into the Results Buffer using the WriteResultsBuffer function.

  6. Something occurs on the line and the production machine needs to be reset.

  7. The PLC triggers an Event in the spreadsheet to reset the state of the In-Sight vision system.

    Note: There are also two possible variations. In one of the variations, the PLC triggers an Online -> Offline -> Online transition to reset the state of the vision system. In this scenario, the spreadsheet must be programmed with an Online event that triggers the ClearResultsBuffer function. In the second variation, the PLC triggers a soft event to reset the state of the vision system. In this scenario, the spreadsheet must be programmed with an Event function that triggers the ClearResultsBuffer function when the soft event is triggered.
  8. The vision system clears the results buffer, using the ClearResultsBuffer function, and the results queued in step number 5 are removed from the queue.
  9. All of the result values are reset to 0, including data, result code and result ID.