Latch.Result Shared Method

Returns a Latch object containing the next result from a latch queue. Returns Nothing if the queue is empty.

Latch.Result( robot, no_exception )

Prerequisites

Requires that the Encoder Latching or Advanced Controls or Conveyor Tracking License be installed on the controller.

Parameters

robot

An optional numeric expression that specifies the robot queue to be accessed. If not specified, a default value of 1 is assumed.

no_exception

An optional numeric expression that determines whether or not this method will throw an exception if a latch related error occurs. If zero or omitted, latch related errors throw exceptions. If non-zero, no exceptions are thrown.

Remarks

This method removes the next latched result from the latch queue associated with the specified robot. A new Latch object is returned. This object contains the latch result information. If the latch queue is empty, this method returns a Nothing value, so the caller should test for Nothing unless it is known that the queue is not empty. Latch results are returned by the Latch.Result method in the order that they were received, with the oldest results returned first. If a latch related error is encountered, and the no_exception parameter is 0 or omitted, this method throws an exception. If this parameter is non-zero, no exception is thrown and a latch object is returned with its ErrorCode property set to the appropriate negative error number. If no error occurs or if no_exception is 0 or omitted, the ErrorCode property is always set to zero.

The table below shows latch related errors that may be generated: .

 
Code Text Description

-203

Fifo overflowed

Latch events were generated faster than the GPL program removed them from the FIFO using this method. You can increase the FIFO size by increasing the value of DataID 16101, (Latch queue max).

-525

Latch input overrun

The hardware latch circuit has detected that edges in the latch input signal are occurring too quickly to be processed. One or more latch edges have been lost. The latch circuit cannot handle duplicate latch edges in the same direction more often than once every 1.2 milliseconds. There may be noise on the latch input signal.

-526

Latch data overrun

Latch events are occurring too quickly for the Precise Controller to service them. If a continuous stream of latch events occurs at a rapid rate, the controller may run out of time to process them. This error is more likely to occur in a servo network system. Reduce the rate of latch events or reduce the number of latch signals being used.

 

Examples

Dim lat As Latch 
lat = Latch.Result(1)
While Not lat Is Nothing
Console.WriteLine(CStr(lat.Signal) & ": " & _
CStr(lat.Timestamp) & ", " & _
CStr(lat.Angle(1)))
lat = Latch.Result(1)
End While

lat = Latch.Result(1, True)
If (Not lat Is Nothing) Then
If (lat.ErrorCode < 0) Then
Console.WriteLine("Error " & CStr(lat.ErrorCode))
End If
End If

See Also

Latch Class | latch_object.ErrorCode