<< Click to Display Table of Contents >> Navigation: Reference (Scripting) > Docklight Script Commands - The DL Object > Methods > ResetReceiveCounter |
Resets one or all Receive Sequence hit counter(s). Also resets the search algorithm which checks the character stream for a matching Receive Sequence (see example code below).
Return Value
Void
Syntax
DL.ResetReceiveCounter [nameOrIndex]
The ResetReceiveCounter method syntax has these parts:
Part |
Description |
nameOrIndex |
Optional. String containing the Name or Sequence Index of a Receive Sequence. If specified, only the corresponding counter is reset. If nameOrIndex is omitted, all counters are reset. |
Remarks
See also GetReceiveCounter and WaitForSequence
Example
See WaitForSequence for a basic example.
A second application is demonstrated below - resetting the receive sequence detection each time a new Send Sequence is transmitted. This is especially useful when Docklight is testing a serial device, and the sequence detection should not get confused by incomplete or faulty packets received earlier. See also DL_OnSend().
' Example ResetReceiveCounter
' Reset sequence detection each time a new sequence is sent
' Endless loop to prevent the script from terminating immediately
Do
DL.Pause 1 ' (the pause reduces CPU load while idle)
Loop
Sub DL_OnSend()
DL.ResetReceiveCounter
End Sub