<< Prev        Next >>

ID : 3630

GetAreaDetected

Function

Obtain the current area detection status.

This command is available in Ver.2.5.* or higher.

Syntax

GetAreaDetected( Area number[, Condition])

Guaranteed Entry

Area number
Specify the area detection number (0 to 31, or -1) by integer type data. Specifying "-1" will obtain all area's detection status.
Condition
Specify the following detection conditions by integer type data. This is an optional value. This should be "0" if this is omitted.
If "-1" is specified, a corresponding bit turns "1" when both "0: When robot enters the specified area." and "1: When robot leaves the specified area." are detected.
Designated value Detection condition
-1 When a robot leaves the specified area after entering, or When a robot enters the specified area after leaving.
0 When robot enters the specified area.
1 When robot leaves the specified area.

Return Value

Detection state of the specified area is set to a corresponding bit of a 32-bit array, and is returned by integer type data. If the detection condition is met, a bit corresponding to the specified area will be 1.
Other than the corresponding bit will be 0.
If "-1" is specified as an area number, conditions of all areas will be returned with each corresponding bit.

Description

Obtain the current detection status at the specified area.
The return value is 32 bit-array. The lowest bit represents the status of the area number 0, and the highest bit represents the status of the area number 31.

Example 1

Assume that "1" is set to the are number. If the area number 1 meets the detection condition, "0x00000002" will be returned, because the second lowest bit turns 1.

Example 2

Assume that "-1" is set to the are number. If the area number 0 and 1 meet the detection condition, "0x00000003" will be returned, because the lowest bit and the second lowest bit turns 1.

Attention

The detection information is retained in the controller until ClearAreaDetected command is issued. If you want to monitor the change of detection state as the following example shows, use ClearAreaDetected command before GetAreaDetected command.

Example

'!TITLE "Pro1.pcs"

Sub Main
  TakeArm Keep = 0

  ResetArea 0
	
  Move P, P( 100, 10, 300, 180, 0, 180, -1 )

  Area  0, P( 300, 0, 200, 0, 0, 0 ), V( 50, 50, 50 ), 128, -1, 0, Tar_Time( 2 )
SetArea 0 Move L, P( 300, 100, 200, 180, 0, 180, -1 ), Next 'Wait until a robot enters Area 0. Inform an external device once the robot enters the area.
ClearAreaDetected -1, -1
Wait GetAreaDetected( 0, 0 ) Set IO24
'Wait until a robot leaves Area 0. Inform an external device once the robot leaves the area.
ClearAreaDetected -1, -1
Wait GetAreaDetected( 0, 1 )
Reset IO24 End Sub

ID : 3630

<< Prev        Next >>