<< Prev        Next >>

ID : 3894

Comm.State

Function

To return the port status of the data communication function.

Syntax

Comm.State(line number[, detail])

Guaranteed Entry

Line number
Designate a line number by integer type data.
Detail
Designate whether to obtain the status of the detail by integer type data.
This is omittable. This should be "0" if it is omitted.
0 The status of the detail is not obtained
1 The status of the detail is obtained

Return Value

Return the specified line status by integer type.

Description

Return the specified line status by integer type.

Return Value

If the status of the detail is not obtained

Return value Line status Description
0 Close A line is not opened by any task.
1 Open A line is opened by either task. (This should not happen in case of Ethernet client port)
2 Connect The status that the line is established and communication can be made.

If the status of the detail is obtained

Return value Line status Description Exclusive contorol Open from the other task
0 Close A line is not opened. Unlocked Open
1 Open(Task) A line is opened by either task.
(This should not happen in case of Ethernet client port.)
Excution Un open
2 Connect(Task) A line is opened by either task. Communication can be made.
3 Open(None) A line is opened.
(The task that opened the line has stopped.)
Unlocked Open(This helps to reduce CPU usage for Open)
4 Connect(None) A line is established.
(The task that established the line has stopped.)

Attention

The program also returns 1 if the own task opens the line.

"0" will be returned if a specified line number port does not exist.

Example

'!TITLE "DENSO Robot Program"
Sub Sample_CommState 

  Dim aaa As Integer
  
  For aaa = 4 to 7
    If Comm.State(aaa) = 0 Then Comm.Open aaa
  Next
  
  If aaa = 8 Then PrintDbg "No empty line"
  
  
End Sub

ID : 3894

<< Prev        Next >>