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.
ClearResultsBuffer Inputs
Syntax: ClearResultsBuffer(Event)
| Parameter | Description |
|---|---|
|
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:
|
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.
-
To begin, the PLC enables results buffering.
-
Next, the PLC triggers an acquisition.
-
The In-Sight vision system responds by acquiring the image and sending the results into the Results Buffer using the WriteResultsBuffer function.
-
The PLC triggers another acquisition.
-
Again, the In-Sight vision system responds by acquiring the image and sending the results into the Results Buffer using the WriteResultsBuffer function.
-
Something occurs on the line and the production machine needs to be reset.
-
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. - The vision system clears the results buffer, using the ClearResultsBuffer function, and the results queued in step number 5 are removed from the queue.
- All of the result values are reset to 0, including data, result code and result ID.