3 Description of functions
3-8
C_COM
[Function]
Sets the parameters for the line to be opened by the OPEN instruction. This is used when the communication destination
is changed frequently.
* Character string type
* Only for a client with the Ethernet option.
[Format]
C_COM (<communication line number>) = “ETH: <server side IP address> [, <port number>]”
[Terminology]
ETH: An identifier to indicate that the target is an Ethernet
<Communication line number> The number of the COM to be specified by the OPEN instruction (The line type is
assigned by the COMDEV parameter.) Specify 1 through 8.
<Server side IP address> Server side IP address (May be omitted.)
<Port number> Port number on the server side (If omitted, the set value of the NETPORT parameter is
used.)
[Reference Program]
Example when OPT12 is set in the second element of the COMDEV parameter
1 C_COM(2)="ETH:192.168.0.10,10010" ' Set the IP address of the communication destination server
corresponding to communication line COM2
2 *LOPEN1:OPEN "COM2:" AS #1 ' As 192.168.0.10 and the port number as 10010, and then open the line.
3 IF M_OPEN(1)<>1 THEN *LOPEN1 ‘ Loops if unable to connect to the server.
4 PRINT #1, "HELLO" ‘ Sends a character string.
5 INPUT #1, C1$ ‘ Receives a character string.
6 CLOSE #1 ‘ Closes the line.
7 C_COM(2)="ETH:192.168.0.11,10011" ‘ Set the IP address of the communication destination server
corresponding to communication line COM2
8 *LOPEN2:OPEN "COM2:" AS #1 ‘ As 192.168.0.11 and the port number as 10011, and then open the line.
9 IF M_OPEN(1)<>1 THEN *LOPEN2 ‘ Loops if unable to connect to the server.
10 PRINT #1, C1$ ‘ Sends a character string.
11 INPUT #1, C2$ ‘ Receives a character string.
12 CLOSE #1 ‘ Closes the line.
13 HLT ‘ Halts the program.
14 END ‘ Ends.
[Description]
(1) It is not necessary to use this command when the communication counterpart of the robot controller is specified with the
NETHSTIP and NETPORT parameters and the specified communication counterpart will not be changed at all.
(2) Currently, this function is valid only for a client of a data link with the Ethernet.
(3) Because the communication parameters of the OPEN instruction are set, it is necessary to execute this command
before the OPEN instruction.
(4) When the power is turned on, the set values specified by the NETHSTIP and NETPORT parameters are used. When
this command is executed, the values specified by the parameters of this command are changed temporarily. They are
valid until the power is turned off. When the power is turned on again, the values revert to the original values set by the
parameters.
(5) If this command is executed after the OPEN instruction, the current open status will not change. In such a case, it is
necessary to close the line with the CLOSE instruction once, and then execute the OPEN instruction again.
(6) If an incorrect syntax is used, an error occurs when the program is executed, not when the program is edited.
[Related Parameters]
NETHSTIP, NETPORT