SetLatch Statement
Sets the latch function of the robot position using the R-I/O input.
Syntax
SetLatch { #portNumber, triggerMode, continuance latch times}
Parameters
- portNumber
- Specify the port number of the R-I/O input port to connect the trigger input signal.
- The table below shows the port numbers you can specify. Specify the port number of the unit that the object robot is connected.
Point Port Number Control Unit INPUT 2 points 24, 25 OUTPUT - - Drive Unit 1 INPUT 2 points 56, 57 OUTPUT - - Drive Unit 2 INPUT 2 points 280, 281 OUTPUT - - - The following constants are defined as the port number.
Constant Port Number SETLATCH_PORT_CU_0 24 SETLATCH_PORT_CU_1 25 SETLATCH_PORT_DU1_0 56 SETLATCH_PORT_DU1_1 57 SETLATCH_PORT_DU2_0 280 SETLATCH_PORT_DU2_1 281 - triggerMode
- The trigger input signal logic to connect with the R-I/O. The logic can be specified with the following constants.
Constant Value Explanation SETLATCH_TRIGGERMODE_TRAILINGEDGE 0 Negative logic SETLATCH_TRIGGERMODE_LEADINGEDGE 1 Positive logic - With the negative logic, it latches the robot position at the switch edge from the input signal High to Low. With the positive logic, it latches the robot position at the switch edge from the input signal from Low to High.
- continuance latch times
- Specify the continuance latch times of robot position by R-I/O input signal. 1, 2, 3 and 4 is available. After LatchEnable On, point data can be latched for the specified number of continuance latches. Maximum is 4 times. Parameter can be omitted. When it’s omitted, it’s only 1 time of continuance latch.
Description
Sets the condition of the robot position latch using the R-I/O input signals. One robot cannot wait the trigger signals of several ports simultaneously. Executing SetLatch needs approx. 40 msec for processing.
Note
If you specify a port number of the unit unrelated to the selected robot, the error “I/O input/output bit number is out of available range” occurs.
See Also
LatchEnable, LatchState Function, LatchPos Function
SetLatch Statement Example
Function main
SetLatch 24, SETLATCH_TRIGGERMODE_LEADINGEDGE, 4
' Positive logic continuance latch 4 times
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
Omitting parameter:
Function main
SetLatch 24, SETLATCH_TRIGGERMODE_LEADINGEDGE ' Positive logic
LatchEnable On 'Enable the latch function
Go P1
Wait LatchState = True 'Wait a trigger
Print LatchPos Display the latched position
LatchEnable Off ' Disable the latch function
Fend