LatchPos Function

Returns the robot position latched using the R-I/O input signal.

Syntax
LatchPos ([WithToolArm | WithoutToolArm], Latch Number)

Parameters

WithToolArm | WithoutToolArm
Specify whether to return positional data based on Tool and Arm settings, or to return the Tool 0, Arm 0 position. While optional, set this parameter when specifying a latch number. If omitted, WithToolArm is used.

  • WithToolArm: 0
  • WithoutToolArm: 1
WithToolArm
A constant whose value is 0. Returns the position according to the Tool and Arm settings at function call.
WithoutToolArm
Constant value of 0.1. Returns the position of Tool 0 and Arm 0, regardless of the Tool and Arm settings.
Latch Number
Specify the R-I/O input signal used to return latched point data after setting LatchEnable On. Specify either 1, 2, 3, or 4. Specify the continuous latch count with SetLatch to enable a latch with point data produced from up to four R-I/O input signals after setting LatchEnable On. This parameter is optional. If omitted, point data latched using the first R-I/O input signal will be returned.

Return Values
Returns the robot position latched by the R-I/O input signal in point data.

Executing this function needs approx. 15 msec for processing.

When WithToolArm is specified, returns the position according to the Tool and Arm settings at function call.

When WithoutToolArm is specified, returns the position of Tool 0 and Arm 0, regardless of the Tool and Arm settings.

See Also
LatchEnable, LatchState Function, SetLatch

LatchPos Function Example

Function main
    SetLatch 24, SETLATCH_TRIGGERMODE_LEADINGEDGE, 4
    LatchEnable On    'Enable the latch function
    Go P1
    Wait LatchState = True     'Wait a trigger
    Print LatchPos(WithoutToolArm, 1)     'Display the latched position 1
    Print LatchPos(WithoutToolArm, 2)     'Display the latched position 2
    Print LatchPos(WithoutToolArm, 3)     'Display the latched position 3
    Print LatchPos(WithoutToolArm, 4)     'Display the latched position 4
    LatchEnable Off     ' Disable the latch function
Fend

To omit parameter:

Function main
    SetLatch 24, SETLATCH_TRIGGERMODE_LEADINGEDGE
    LatchEnable On    'Enable the latch function
    Go P1
    Wait LatchState = True     'Wait a trigger
    Print LatchPos     ' Display the latched position 1
    LatchEnable Off     ' Disable the latch function
Fend

To assign the return value of LatchPos to the point data:

P2 = LatchPos    ' Assign the latched position 1. Omit parameter.

P2 = LatchPos(WithoutToolArm, 1)    ‘Assign the latched position 1
P3 = LatchPos(WithoutToolArm, 2)     ‘Assign the latched position 2
P4 = LatchPos(WithoutToolArm, 3)     ‘Assign the latched position 3
P5 = LatchPos(WithoutToolArm, 4)     ‘Assign the latched position 4