ID : 376
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. (This should not happen in case of RS-232C) |
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. (This should not happen in case of RS-232C. ) |
||
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.) |
Related Terms
Comm.Open, Comm.Close, Comm.Output, Comm.Input, Comm.Clear, Comm.Count, Data Communication
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 : 376