Ethernet Function Instruction Manual: Mitsubishi Electric Industrial Robot
Ethernet Function Instruction Manual: Mitsubishi Electric Industrial Robot
Ethernet Function Instruction Manual: Mitsubishi Electric Industrial Robot
BFP-A3379-D
Revision History
CAUTION All teaching work must be carried out by an operator who has received special
training.
(This also applies to maintenance work with the power source turned ON.)
→Enforcement of safety training
CAUTION For teaching work, prepare a work plan related to the methods and procedures
of operating the robot, and to the measures to be taken when an error occurs
or when restarting. Carry out work following this plan.
(This also applies to maintenance work with the power source turned ON.)
→Preparation of work plan
CAUTION During teaching work, place a sign indicating that teaching work is in progress
on the start switch, etc.
(This also applies to maintenance work with the power source turned ON.)
→Indication of teaching work in progress
DANGER Provide a fence or enclosure during operation to prevent contact of the operator
and robot.
→Installation of safety fence
CAUTION Establish a set signaling method to the related operators for starting work,
and follow this method.
→Signaling of operation start
CAUTION As a principle turn the power OFF during maintenance work. Place a sign
indicating that maintenance work is in progress on the start switch, etc.
→Indication of maintenance work in progress
CAUTION Before starting work, inspect the robot, emergency stop switch and other
related devices, etc., and confirm that there are no errors.
→Inspection before starting work
The points of the precautions given in the separate "Safety Manual" are given below.
Refer to the actual "Safety Manual" for details.
DANGER When automatic operation of the robot is performed using multiple control
devices (GOT, programmable controller, push-button switch), the interlocking
of operation rights of the devices, etc. must be designed by the customer.
CAUTION Use the robot within the environment given in the specifications. Failure to do
so could lead to faults or a drop of reliability.
(Temperature, humidity, atmosphere, noise environment, etc.)
CAUTION Transport the robot with the designated transportation posture. Transporting
the robot in a non-designated posture could lead to personal injuries or faults
from dropping.
CAUTION Always use the robot installed on a secure table. Use in an instable posture
could lead to positional deviation and vibration.
CAUTION Wire the cable as far away from noise sources as possible. If placed near a
noise source, positional deviation or malfunction could occur.
CAUTION Do not apply excessive force on the connector or excessively bend the cable.
Failure to observe this could lead to contact defects or wire breakage.
CAUTION Make sure that the workpiece weight, including the hand, does not exceed the
rated load or tolerable torque. Exceeding these values could lead to alarms or
faults.
WARNING Securely install the hand and tool, and securely grasp the workpiece. Failure to
observe this could lead to personal injuries or damage if the object comes off or
flies off during operation.
WARNING Securely ground the robot and controller. Failure to observe this could lead to
malfunctioning by noise or to electric shock accidents.
CAUTION Indicate the operation state during robot operation. Failure to indicate the state
could lead to operators approaching the robot or to incorrect operation.
WARNING When carrying out teaching work in the robot's movement range, always secure
the priority right for the robot control. Failure to observe this could lead to
personal injuries or damage if the robot is started with external commands.
CAUTION Keep the jog speed as low as possible, and always watch the robot. Failure to do
so could lead to interference with the workpiece or peripheral devices.
CAUTION After editing the program, always confirm the operation with step operation before
starting automatic operation. Failure to do so could lead to interference with
peripheral devices because of programming mistakes, etc.
CAUTION Make sure that if the safety fence entrance door is opened during automatic
operation, the door is locked or that the robot will automatically stop. Failure to do
so could lead to personal injuries.
WARNING When the robot arm has to be moved by hand from an external area, do not place
hands or fingers in the openings. Failure to observe this could lead to hands or
fingers catching depending on the posture.
CAUTION Do not stop the robot or apply emergency stop by turning the robot controller's
main power OFF. If the robot controller main power is turned OFF during automatic
operation, the robot accuracy could be adversely affected. Also a dropped or
coasted robot arm could collide with peripheral devices.
CAUTION Do not turn OFF the robot controller's main power while rewriting the robot
controller's internal information, such as a program and parameter. Turning OFF
the robot controller's main power during automatic operation or program/parameter
writing could break the internal information of the robot controller.
DANGER Do not connect the Handy GOT when using the GOT direct connection function of
this product. Failure to observe this may result in property damage or bodily injury
because the Handy GOT can automatically operate the robot regardless of whether
the operation rights are enabled or not.
DANGER Do not connect the Handy GOT to a programmable controller when using an iQ
Platform compatible product with the CR750-Q/CR751-Q/CR800-R/CR800-Q
controller. Failure to observe this may result in property damage or bodily injury
because the Handy GOT can automatically operate the robot regardless of whether
the operation rights are enabled or not.
DANGER Do not remove the SSCNET III cable while power is supplied to the multiple CPU
system or the servo amplifier when using an iQ Platform compatible product with the
CR750-Q/CR751-Q/CR800-R/CR800-Q controller. Do not look directly at light emitted
from the tip of SSCNET III connectors or SSCNET III cables of the Motion CPU or the
servo amplifier. Eye discomfort may be felt if exposed to the light.
(Reference: SSCNET III employs a Class 1 or equivalent light source as
specified in JIS C 6802 and IEC60825-1 (domestic standards in Japan).)
DANGER Do not remove the SSCNET III cable while power is supplied to the controller.
Do not look directly at light emitted from the tip of SSCNET III connectors or
SSCNET III cables. Eye discomfort may be felt if exposed to the light.
(Reference: SSCNET III employs a Class 1 or equivalent light source as
specified in JIS C 6802 and IEC60825-1 (domestic standards in Japan).)
DANGER Attach the cap to the SSCNET III connector after disconnecting the SSCNET III cable.
If the cap is not attached, dirt or dust may adhere to the connector pins, resulting in
deterioration connector properties, and leading to malfunction.
CAUTION Make sure there are no mistakes in the wiring. Connecting differently to the way
specified in the manual can result in errors, such as the emergency stop not
being released. In order to prevent errors occurring, please be sure to check
that all functions (such as the teaching box emergency stop, customer
emergency stop, and door switch) are working properly after the wiring setup
is completed.
CAUTION Use the network equipments (personal computer, USB hub, LAN hub, etc.)
confirmed by manufacturer. The thing unsuitable for the FA environment
(related with conformity, temperature or noise) exists in the equipments connected
to USB. When using network equipment, measures against the noise, such as
measures against EMI and the addition of the ferrite core, may be necessary.
Please fully confirm the operation by customer. Guarantee and maintenance
of the equipment on the market (usual office automation equipment) cannot
be performed.
CAUTION To maintain the security (confidentiality, integrity, and availability) of the robot and the
system against unauthorized access, DoS*1 attacks, computer viruses, and other
cyberattacks from unreliable networks and devices via network, take appropriate
measures such as firewalls, virtual private networks (VPNs), and antivirus solutions.
Mitsubishi Electric shall have no responsibility or liability for any problems involving
robot trouble and system trouble by unauthorized access, DoS attacks, computer
viruses, and other cyberattacks.
*1 DoS: A denial-of-service (DoS) attack disrupts services by overloading systems or
exploiting vulnerabilities, resulting in a denial-of-service (DoS) state.
Contents
1. Before use ....................................................................................................................................................... 1-1
1.1. How to use the instruction manual ......................................................................................................... 1-1
1.1.1. Content of instruction manual ..................................................................................................... 1-1
1.2. Terms used in the instruction manual..................................................................................................... 1-1
1.3. Confirmation of product ......................................................................................................................... 1-2
1.4. Ethernet function ................................................................................................................................... 1-2
1.4.1. Function of Ethernet................................................................................................................... 1-2
2. Preparation before use ..................................................................................................................................... 2-1
2.1. Connection of Ethernet cable................................................................................................................. 2-1
2.2. Parameter setting.................................................................................................................................. 2-3
2.2.1. Parameter list ............................................................................................................................ 2-3
2.2.2. Details of parameters ................................................................................................................. 2-5
2.2.3. Parameter setting example 1 (When the Support Software is used) ............................................. 2-8
2.2.4. Parameter setting example 2-1 (When the data link function is used: When the controller is the server)
........................................................................................................................................................... 2-9
2.2.5. Parameter setting example 2-2 (When the data link function is used: When the controller is the client)
......................................................................................................................................................... 2-10
2.2.6. Parameter setting example 3 (for using the real-time external control function) .......................... 2-11
2.3. Connection confirmation ...................................................................................................................... 2-12
2.3.1. Checking the connection with the Windows ping command ....................................................... 2-12
3. Description of functions .................................................................................................................................... 3-1
3.1. Controller communication function ......................................................................................................... 3-2
3.1.1. Connecting the controller and personal computer........................................................................ 3-2
3.1.2. Setting the personal computer network ....................................................................................... 3-2
3.1.3. Setting the controller parameters ................................................................................................ 3-2
3.1.4. Setting the personal computer support software communication .................................................. 3-3
3.1.5. Communication.......................................................................................................................... 3-4
3.2. Data link function .................................................................................................................................. 3-5
3.2.1. MELFA-BASIC V/VI Commands ................................................................................................. 3-5
3.2.2. Using data link function .............................................................................................................. 3-9
3.2.3. Ending..................................................................................................................................... 3-12
3.3. Real-time external control function ....................................................................................................... 3-13
3.3.1. Explanation of command .......................................................................................................... 3-15
3.3.2. Explanation of communication data packet ............................................................................... 3-17
3.3.3. Using real-time external control function ................................................................................... 3-21
3.3.4. Ending..................................................................................................................................... 3-23
3.4. Real-time monitor function ................................................................................................................... 3-24
3.4.1. Overview ................................................................................................................................. 3-24
3.4.2. Supported version.................................................................................................................... 3-25
3.4.3. Setup ...................................................................................................................................... 3-26
3.4.4. Start of monitor / End of monitor ............................................................................................... 3-28
3.4.5. Explanation of communication data packet ............................................................................... 3-29
3.4.6. Data type ID ............................................................................................................................ 3-32
3.4.7. Parameters.............................................................................................................................. 3-33
3.4.8. Error ........................................................................................................................................ 3-33
3.5. SLMP Connection ............................................................................................................................... 3-34
3.5.1. Function Overview ................................................................................................................... 3-34
3.5.2. Supported version.................................................................................................................... 3-34
3.5.3. Specifications .......................................................................................................................... 3-34
3.5.4. Parameters.............................................................................................................................. 3-34
3.5.5. SLMP Communication Procedure............................................................................................. 3-35
3.5.6. Message Format ...................................................................................................................... 3-37
3.5.7. Commands .............................................................................................................................. 3-45
3.5.8. End Code ................................................................................................................................ 3-80
3.6. CC-Link IE Field Network Basic function .............................................................................................. 3-81
3.6.1. Overview ................................................................................................................................. 3-81
3.6.2. Supported version.................................................................................................................... 3-82
3.6.3. Specifications .......................................................................................................................... 3-82
3.6.4. Parameters.............................................................................................................................. 3-83
3.6.5. Support of robot I/O signals and link devices............................................................................. 3-84
3.6.6. Setup procedure ...................................................................................................................... 3-85
4. Appendix ......................................................................................................................................................... 4-1
4.1. Error list ................................................................................................................................................ 4-1
4.2. Sample program ................................................................................................................................... 4-2
4.2.1. Sample program of data link....................................................................................................... 4-2
4.2.2. Sample program for real-time external control function .............................................................. 4-14
1 Before use
1. Before use
This chapter describes the confirmation items and cautionary items which must be read before practical use of the
Ethernet.
Through the following configuration, this document introduces the Ethernet function. As for the functions available in the
standard robot controller and the operation method, please refer to the "Instruction Manual" provided with the robot
controller.
1-1
1 Before use
The standard configuration of the product supplied by the customer is as follows. Confirm the configuration.
In addition to the standard robot system configuration, the following is necessary. These devices are separately procured
by the customer.
4) Robot controller programming aiding tool corresponding to (An optional) Personal computer Support 1
Windows for Robot controller of our company Software
5) Application for network communication program production (Goods on the market) Microsoft. 1
corresponding to Windows Visual Studio etc.
The Ethernet installed as a standard on the robot controller has the following functions.
(1) The connections with 100BASE-TX (for CR750/CR751/CR800-R/CR800-Q) and with 1000BASE-T (for CR800-D) are
supported.
(2) TCP/IP protocol is used to allow the communication with the personal computer on the Ethernet.
(3) The sampling program (corresponding to Microsoft Visual Basic Express 2008/Visual C++ Express 2008) of the
personal computer is equipped.
The following is provided as the samples. (Refer to Chapter 4 Appendix.)
• The data link function is used to transmit and receive the variables of personal computer and robot (characters and
numerical values). (OPEN/INPUT#/PRINT#)
Here, approve that the result of the operation of the application which the customer produces on the basis of the
sample is out of the responsibility with our company.
1-2
1 Before use
These functions can all be used simultaneously, but be aware that when the network handles
CAUTION large loads, communications slow down and may not reflect real-time information.
1-3
1 Before use
* The personal computer used to communicate with the robot controller must be located on the same network.
Communication cannot be carried out over firewalls (from internet) or over gateways (from different adjacent network, etc.).
Consider operation with a method that communicates via a server (i.e., HTTP server, etc.) connected to the same network
as the robot controller. Pay special attention to safety and response in this case.
Ethernet
Personal Personal
computer computer
program program
Personal computer support software Data link application Real-time external control application
(Mitsubishi option) (Customer-created) (Customer-created)
Ethernet
Personal Personal
computer computer
program program
Personal computer support software Data link application Real-time external control application
(Mitsubishi option) (Customer-created) (Customer-created)
1-4
2 Preparation before use
LAN connect
<CR800-R controller>
Robot CPU unit front
LAN connect
<CR800-Q controller>
Robot CPU unit front
2-1
2 Preparation before use
LAN connect
<CR751 controller>
CR751 controller front
LAN connect
<CR750-Q/CR751-Q controller>
Robot CPU unit front
LAN connect
2-2
2 Preparation before use
Before use, it is necessary to set the following parameters. The parameters which are set on the robot controller are shown
in the following list. For the method to set the parameter, refer to the instruction manual of the controller.
After changing the parameters, turn the power supply of the controller from OFF to ON. Unless
CAUTION this is done, the changed parameters will not become valid.
Parameter list
Number Controller Real-time Real-time
Parameter Data link CC-Link
Details of Default value communication control monitoring SLMP
name function IEF Basic
elements function function function
NETIP IP address of robot controller Character “192.168.0.20”
string 1 O O O O O -
2-3
2 Preparation before use
2-4
2 Preparation before use
2-5
2 Preparation before use
For example, if the port No. specified at NETPORT(3) is allocated to the data link of COM:3, the following will be applied.
COMDEV(3) = OPT13 * OPT13 is set at 3rd element of COMDEV.
CPRCE13 = 2 * Set up as a data link.
(7) NETHSTIP (The IP address of the server of the data communication point)
Set up, when using the robot controller as a client by the data link function.
Specify the IP address of the partner server which the robot controller connects by the data link function.
Set up, when only set the robot controller to the client by server specification of NETMODE.
(8) MXTTOUT (Timeout setting for executing real-time external control command)
This is changed when using real-time external control command and setting the timeout time for communication with the
robot controller.
Set a multiple of the control cycle (refer to the following).
2-6
2 Preparation before use
If you change a port number from its initial value, be sure that it does not overlap with any
CAUTION other port numbers. If there is any overlap, an error will occur when the controller starts, and
it will not work properly.
2-7
2 Preparation before use
Next, set the personal computer IP address to 192.168.0.10. Set this value on the Network Properties screen.
The personal computer IP address is set with the Windows TCP/IP Property Network setting (property in network
computer). Because the set-up screen differs with versions of Windows, refer to the manuals enclosed with Windows, etc.,
for details on setting this address.
Refer to the instruction manuals enclosed with the personal computer support software for details on setting and using the
personal computer support software.
2-8
2 Preparation before use
Shows the example of the setting, when the controller is server by the data link function.
Conditions for example 2-1
Robot controller IP address 192.168.0.20
Personal computer IP address 192.168.0.10
Robot controller port No. 10003
Communication line No.
<For MELFA-BASIC V/VI>
OPEN command COM No. COM3:
Next, set the personal computer IP address to 192.168.0.10. Set this value on the Network Properties screen.
The personal computer IP address is set with the Windows TCP/IP Property Network setting (property in network
computer). Because the set-up screen differs with versions of Windows, refer to the manuals enclosed with Windows, etc.,
for details on setting this address.
Refer to the instruction manuals enclosed with the personal computer support software for details on setting and using the
personal computer support software.
2-9
2 Preparation before use
Shows the example of the setting, when the controller is client by the data link function.
Conditions for example 2-2
Robot controller IP address 192.168.0.20
Personal computer IP address 192.168.0.10
Robot controller port No. 10003
Communication line No.
<For MELFA-BASIC V/VI>
OPEN command COM No. COM3:
The personal computer IP address is set with the Windows TCP/IP Property Network setting (property in network
computer). Because the set-up screen differs with versions of Windows, refer to the manuals enclosed with Windows, etc.,
for details on setting this address.
Refer to the instruction manuals enclosed with the personal computer support software for details on setting and using the
personal computer support software.
2-10
2 Preparation before use
2.2.6. Parameter setting example 3 (for using the real-time external control function)
An example of the settings for using the real-time external control function is shown below.
Next, set the personal computer IP address to 192.168.0.10. Set this value on the Network Properties screen.
The personal computer IP address is set with the Windows TCP/IP Property Network setting (property in network
computer). Refer to the manuals enclosed with Windows, etc., for details on setting this address.
Refer to the instruction manuals enclosed with the personal computer support software for details on setting and using the
personal computer support software.
2-11
2 Preparation before use
Connection confirmation
No. Confirmation item Check
2 Is the Ethernet cable properly connected between the controller and personal computer? (Refer to 2.1 in this
manual.)
4 Is the parameter of the controller properly set? (Refer to 2.2 in this manual.)
5 Is the power supply of the controller turned off once after the parameter set?
The method for checking the connection with the Windows ping command is shown below.
Start up the " MS-DOS Prompt " from the Windows " Start " - " Programs " menu, and designate the robot controller IP
address as shown below.
If the communication is normal, " Reply from ... " will appear as shown below.
If the communication is abnormal, " Request time out " will appear.
2-12
3 Description of functions
3. Description of functions
This chapter explains the methods for using the six Ethernet option functions with a system in which the controller and network
personal computer are connected with a one-on-one cross cable.
(1) Using the controller communication function ... Refer to Chapter 3.1
(2) Using the data link function ... Refer to Chapter 3.2
(3) Using the real-time external control function ... Refer to Chapter 3.3
(4) Using the real-time monitoring function ... Refer to Chapter 3.4
(5) Using SLMP ... Refer to Chapter 3.5
(6) Using the CC-Link IE Field Network Basic function ... Refer to Chapter 3.6
3-1
3 Description of functions
The operations for communicating with the personal computer support software are explained in this section.
Connect the controller and the personal computer with the following Ethernet cable.
Refer to section "2.2.3 Example of setting the parameters 1 (for using the support software)" and set the network.
Turn ON the robot controller power, and set the parameters as shown below.
If the default settings are to be used, the parameters do not need to be changed.
After setting the parameters, turn the robot controller power OFF and ON.
Refer to the instruction manual enclosed with the robot controller for details on setting the parameters.
3-2
3 Description of functions
Start the personal computer support software and make the communication settings. Set the communication method to
TCP/IP, and the IP Address to 192.168.0.20.
Refer to the instruction manual enclosed with the personal computer support software for details on setting the personal
computer support software.
3-3
3 Description of functions
3.1.5. Communication
Refer to the instruction manual enclosed with the personal computer support software for details on using the personal
computer support software.
If communication is not possible, refer to section "2.3 Checking the connection" and check the state.
When the robot controller power is turned OFF and ON, the connection will be disconnected
and communication will be disabled.
CAUTION In this case, end the application software on the personal computer once, and then
restart.
3-4
3 Description of functions
[Statement example] To set port No. 10003 as communication destination and open as #1
Set parameter COMDEV (element No. 3) to OPT13, NETPORT to 10003.
1 OPEN “COM3:” AS #1 ’Set port No.
2 INPUT #1, C1$ 'Read
3 PRINT #1, ”Reply”, C1$ ‘Writing
4 CLOSE #1 ‘Line closing
5 HLT ‘Stop
The data link function of the Ethernet has the two kinds shown below.
* Uses the robot controller as the server.
* Uses the robot controller as the client.
192.168.0.20 192.168.0.20 192.168.0.20
(Server) (Server) (Server)
3-5
3 Description of functions
M_OPEN
[Function]
Indicates whether or not the file has been opened.
[Format]
[Terminology]
<Numeric variable> Specify a numeric variable to be assigned.
<File number> Specify a file number constant between 1 and 8 for the communication line that
was opened by the OPEN instruction. If omitted, 1 is set. If 9 or higher is
specified, an error occurs when executed.
[Reference Program]
1 ' Client Program ----------------
2 M1=0
3 M_TIMER(1)=0 ‘Resets the timer to 0.
4 *LOPEN:OPEN "COM2:" AS #1 ‘Opens the line.
5 IF M_TIMER(1)>10000.0 THEN *LERROR ‘Jumps when 10 seconds elapses.
6 IF M_OPEN(1)<>1 THEN GOTO *LOPEN ‘Loops if no connection is made.
7 DEF ACT 1,M_OPEN(1)=0 GOSUB *LHLT2 ‘Monitors the down state of the server using an interrupt.
8 ACT 1=1 ‘Starts monitoring.
9 *LOOP:M1=M1+1
10 IF M1<10 THEN C1$="MELFA" ELSE C1$="END" ‘Sends END after sending the “MELFA” string nine times.
11 PRINT #1,C1$ ‘Sends a character string.
12 INPUT #1,C2$ ‘Receives a character string.
13 IF C1$="END" THEN *LHLT ‘Jumps to CLOSE after sending “END.”
14 GOTO *LOOP ‘Loops.
15 *LHLT:CLOSE #1 ‘Closes the line.
16 HLT ‘Halts the program.
17 END ‘Ends.
18 *LERROR:ERROR 9100 ‘Generates error 9100 if no connection can be made to the
server.
19 CLOSE #1
20 HLT
21 END
22 ERROR 9101 ‘Generates error 9101 if the server is down during
processing.
23 *LHLT2:CLOSE #1
24 HLT
25 END
3-6
3 Description of functions
[Explanation]
(1) This command is used in a combination with the OPEN instruction. The following lists the meanings and values for the
types of the files specified by the OPEN instruction.
Type of file to be
Meaning Value
opened
File Indicates whether or not the file has been 1: Already opened.
opened. -1: The file number is undefined (not opened).
1 is always returned after executing the
OPEN instruction.
Communication line Indicates whether For server setting 1: Client is already connected.
Ethernet or not connection 0: Client is not connected.
is made with the -1: The file number is undefined (not opened).
counterpart. For client setting 1: Already connected to the server. (Connection
has been made.)
0: Not connected to the server. (Connection has
not been made. Equivalent to when the server is
down after being opened.)
-1: The file number is undefined. (When the file
has not been opened, or has been opened
while the server is down.)
[Related Instruction]
OPEN
[Related Parameters]
COMDEV, CPRE**, NETMODE
3-7
3 Description of functions
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
[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
3-8
3 Description of functions
This section explains the operations for starting the sample program given in "4.2.1 Sample program for data link function"
and communicating with a system in which the controller and network personal computer are connected with a one-on-one
cross cable.
3-9
3 Description of functions
Before/after
Parameter Parameter value
change
Before 192.168.0.20
NETIP
After 192.168.0.20 (unchanged)
Before 10000,10001,10002,10003,10004,10005,10006,10007,10008,10009
NETPORT 10000,10001,10002,10003,10004,10005,10006,10007,10008,10009
After
(unchanged)
Before 0
CPRCE13
After 2
Before ,,,,,,,
COMDEV
After , , OPT13, , , , ,
Before/after
Parameter Parameter value
change
Before 192.168.0.20
NETIP
After 192.168.0.20 (unchanged)
Before 10000,10001,10002,10003,10004,10005,10006,10007,10008,10009
NETPORT 10000,10001,10002,10003,10004,10005,10006,10007,10008,10009
After
(unchanged)
Before 0
CPRCE13
After 2
Before ,,,,,,,
COMDEV
After , , OPT13, , , , ,
Before 1,1,1,1,1,1,1,1,1
NETMODE
After 1,1,0,1,1,1,1,1,1
192.168.0.2, 192.168.0.3, 192.168.0.4, 192.168.0.5, 192.168.0.6,
Before
192.168.0.7, 192.168.0.8, 192.168.0.9, 192.168.0.10
NETHSTIP
192.168.0.2, 192.168.0.3, 192.168.0.2, 192.168.0.5, 192.168.0.6,
After
192.168.0.7, 192.168.0.8, 192.168.0.9, 192.168.0.10
3-10
3 Description of functions
3-11
3 Description of functions
3.2.2.5. Communication
(1) When the robot controller program is started, first the following data will be sent to the personal computer.
"START"(CR) (CR) indicates the CR code.
(2) When the personal computer receives the data, the characters will appear in the received data area.
START•
(3) Send value data from the personal computer.
For example, input the value data 123 in the transmission data area, and click on the Send button with the mouse.
(4) When the robot controller receives the value data in the DATA variable, it will reply data to the personal computer.
DATA=123 will appear in the personal computer's received data area.
If communication cannot be carried out correctly, refer to section "2.3 Checking the connection" in this manual.
When the robot controller power is turned OFF and ON, the connection will be disconnected
and communication will be disabled.
CAUTION In this case, end the application software on the personal computer once, and then
restart.
3.2.3. Ending
(1) Press the END button on the robot controller operating panel, and enter cycle operation.
(2) Input the value -1 from the personal computer, and end the program.
(3) End the personal computer's sample program.
(4) Turn OFF the robot controller's power.
3-12
3 Description of functions
Robot controller
Personal computer
Command position
transmission/reception
The following table lists the position command data for giving the target move position from the personal computer to the
robot for each hour of the motion operation control cycle, and the monitor data types from the robot.
For more information about communication data, see Section 3.3.1, “Command Explanation” and Section 3.3.2,
“Communication Data Packet Explanation” in this document.
3-13
3 Description of functions
Creation of transmission
Robot program start
packet data
Packet data
Reception of packet data
transmission
3-14
3 Description of functions
Either the MELFA-BASIC V command languages can be used with the real-time external control function.
Note that the meanings of the arguments differ for the MELFA-BASIC V commands. (Refer to following format and
terminology.)
Refer to section "3.3.2 Explanation of communication data packet" for details on the structure of the communication data
packet used with this function.
MXT <File No.>, <Reply position data type> [, <Filter time constant>]
[Terminology]
<File No.> Describe a number between 1 and 8 assigned with the OPEN command.
If the communication destination is not designated with the OPEN command, an
error will occur, and communication will not be possible.
In addition, data received from a source other than the communication destination
will be ignored.
<Replay position data type> Designate the type of the position data to be received from the personal computer.
A XYZ/joint/motor pulse can be designated.
0: XYZ coordinate data
1: Joint coordinate data
2: Motor pulse coordinate data
<Filter time constant> Designate the filter time constant (msec). If 0 is designated, the filter will not be
applied. (0 will be set when omitted.) A filter is applied on the reception position
data, an obtuse command value is created and output to the servo.
[Reference Program]
1 OPEN "ENET:192.168.0.2" AS #1 ‘Ethernet communication destination IP address
2 MOV P1 ‘Move to P1
3 MXT1,1,50 ‘Move with real-time external control with filter time constant set to
50msec
4 MOV P1 ‘Move to P1
5 HLT ‘Halt program
3-15
3 Description of functions
[Explanation]
* When the MXT command is executed, the position command for movement control can be retrieved from the personal
computer connected on the network. (One-on-one communication)
* One position command can be retrieved and operated at the operation control time. The operation control time is approx.
7.11 msec with the CR750/CR751 series, and approx. 3.5 msec with the CR800 series (approx. 7.11 msec when user
mechanism is set).
* Operation of MXT command
1) When this command is executed with the controller, the controller enters the command value reception enabled state.
2) When the controller receives the command value from the personal computer, it will output the received command
value to the servo within the next control process cycle.
3) After the command value is sent to the servo, the controller information, such as the current position is sent from the
controller to the personal computer.
4) A reply is made from the controller to the personal computer only when the command value from the personal
computer is sent to the controller.
5) If the data is not received, the current position is maintained.
6) When the real-time external command end command is received from the personal computer, the MXT command is
ended.
7) When the operation is stopped from the operating panel or external input, the MXT command will be halted, and the
transmission/reception will also be halted until restart.
* The timeout is designated with the parameter MXTTOUT.
* One randomly designated (head bit, bit width) input/output signal can be transmitted and received simultaneously with the
position data.
* A personal computer with sufficient processing speed must be used to command movement in the movement control time.
3-16
3 Description of functions
The structure of the communication data packet used with the real-time external control function is explained in this section.
The same communication data packet for real-time external control is used for commanding the position and for monitoring.
The contents differ when transmitting (commanding) from the personal computer to the controller and when receiving
(monitoring) from the controller to the personal computer.
Create an application referring to the communication data packet structure described in the following table and section
"4.2.2. Sample program for real-time external control function". Note that the following table shows the data types in the C
language.
Transmission data type unsigned short 1) When transmitting (commanding) from the personal computer to the
designation (2-byte) controller, designate the type of position data transmitted from the
SendType personal computer.
There is no data at the first transmission.
0 // No data
1 // XYZ data
2 // Joint data
3 // Motor pulse data
3-17
3 Description of functions
3-18
3 Description of functions
Reply input/output 1) When transmitting (commanding) from the personal computer to the
signal data designation controller, designate the data type of the input/output signal replied from
RecvIOType unsigned short the controller.
(2-byte) Designate "No data" when not using this function.
0 // No data
1 // Output signal
2 // Input signal
Timeout time counter 1) When transmitting (commanding) from the personal computer to the
value controller, Not used.
Tcount unsigned short
(2-byte) 2) When receiving (monitoring) from controller to personal computer, if the
timeout time parameter MXTTOUT is a value other than -1, this indicates
the No. of times communication with the controller was not possible. When
the No. of times is counted and reaches the maximum value, the value will
return to the minimum value 0, and the count will be repeated. This is set
to 0 when the MXT command is started.
Counter value for 1) When transmitting (commanding) from the personal computer to the
communication data controller.
Ccount unsigned long
(4-byte) 2) When receiving (monitoring) from controller to personal computer, this
indicates the No. of communication times.
3-19
3 Description of functions
3-20
3 Description of functions
This section explains the operations for starting the sample program given in "4.2.2 Sample program for real-time external
control function" and communicating with a system in which the controller and network personal computer are connected with
a one-on-one cross cable.
3-21
3 Description of functions
(3) Start the personal computer's real-time external control sample program.
Refer to section "4.2.2 Sample program for real-time external control function" and create the execution file. (The created
execution file will be sample.exe.)
Start Windows Explorer, and double-click on sample.exe.
3-22
3 Description of functions
If the amount of instructions becomes too large or the movement range of the robot is exceeded, an error is
generated and the robot controller stops. In this case, reset the robot controller.
If communication cannot be carried out correctly, refer to section "2.3 Checking the connection", and check the connection
cable or restart the controller and sample.exe.
When the robot controller power is turned OFF and ON, the connection will be disconnected
and communication will be disabled.
CAUTION In this case, end the application software on the personal computer once, and then
restart.
3.3.4. Ending
(1) Press the END button on the robot controller operating panel, and enter cycle operation.
(2) End the personal computer's sample program.
When the [ENTER] key is pressed, the MXT command will end, the robot will return to the default position, and the robot
program will stop.
The sample program will also end.
(3) Turn OFF the robot controller's power.
3-23
3 Description of functions
3.4.1. Overview
In using such communication equipment as PLC and personal computers, this function is used to monitor orthogonal and
joint position data of the current position of the robot controller in real-time using Ethernet UDP communication.
3.4.1.1. CR800 series
iQ-R
MELSEC Series
iQ-R Series *R Type only, or
MELSEC-Q Series
*R Type only*Q Type only
PLC, PC, … Robot
Ethernet communication device FR Series
100BASE-TX(CR800-R/Q)
1000BASE-T(CR800-D)
Controller
CR800
R32TB or R56TB
3-24
3 Description of functions
Q172DRCPU
*Q Type only
Robot
PLC, PC, …
F Series
Ethernet communication device
10BASE-T/100BASE-TX
Ethernet Cable
Controller
CR75x-Q / CR75x-D
R32TB or R56TB
3-25
3 Description of functions
3.4.3. Setup
MELSEC
iQ-RiQ-R Series (R Type only),
Series
or MELSEC-Q Series (Q Type only)
*R Type only
Robot
PLC, PC, …
FR Series
Ethernet communication device
100BASE-TX(CR800-R/Q)
1000BASE-T(CR800-D)
Controller
CR800
R32TB or R56TB
3-26
3 Description of functions
Q172DRCPU
*Q Type only
Robot
PLC, PC, …
F Series
Ethernet communication device
10BASE-T/100BASE-TX
Ethernet Cable
Controller
CR75x-Q / CR75x-D
R32TB or R56TB
3-27
3 Description of functions
If you want to change the type of output data on the monitor the way, it sends a start packet data.
Caution The data output from the robot, for that is sent (UDP) communication via Ethernet without the
retransmission process, because there is the case that such noise environments, such as the
transmission of data or a wrong data dropout occurs, the guarantee of data is not possible.
Use the data output from the robot only for monitoring. When the data needs to be used for
control, check the data for consistency on the receiving side by comparing the data with the
previous value of the communication data counter or the monitoring counter of the robot
information (refer to section 3.4.4). If the check shows the data is incorrect, take appropriate
measures, such as stopping the equipment safely, before use.
3-28
3 Description of functions
It describes the structure of the communication packet data to be used in real-time monitoring function. To the robot controller,
I will use the same packet structure on both send and receive from Ethernet communication device. Storage method of
data is little-endian. Real data in 32-bit real number is IEEE754 standard method. Data packet size is 196 bytes fixed.
Table 3-1 Data packet
Name Data type Explanation Address
Specifies the start or end of the real-time monitoring function.
unsigned short
Command 1 // Start of the real-time monitor 0-1
2 byes
255 // End of the real-time monitor
Not used(reserve) 2 byes Not used 2-3
1) Communication device → Robot controller
Specifies the <Data type ID> of the data that you want to monitor.
unsigned short
Reply data type 1 2) Robot controller → Communication device 4-5
2 byes
Echo back of send 1)
*Data type ID see [3.4.6 Data type ID]
Not used(reserve) 2 byes Not used 6-7
1) E Communication device → Robot controller
Data structure Not used. Set to zero.
POSE, JOINT, PULSE,
ROBMON, 2) Robot controller → Communication device
FORCE or FLOAT8 The output data sent back from the controller.
40 bytes Data type is seeing in the return data type.
Reply data 1 *Data structure 8-47
* Each data structure is POSE // XYZ type [mm/rad]
described in Table JOINT // Joint type [rad]
Table 3-2, Table 3-3 PULSE // Motor pulse type [pulse] or Current type[%]
Table 3-4, Table 3-5 FORCE // Force sensor type
Table 3-6, Table 3-7 ROBMON // Robot movement information
FLOAT8 // General purpose, float×8
Input signal number of 1) Communication device → Robot controller
the top unsigned short Input signal number of the top (0 to 32767)
48-49
2 byes 2) Robot controller → Communication device
* Ver.R4b/S4b or later Echo back of send 1)
Output signal number 1) Communication device → Robot controller
of the top unsigned short Output signal number of the top (0 to 32767)
50-51
2 byes 2) Robot controller → Communication device
* Ver.R4b/S4b or later Echo back of send 1)
1) Communication device → Robot controller
Input signal data Not used. Set to zero.
unsigned long
52-53
4 byes 2) Robot controller → Communication device
* Ver.R4b/S4b or later
Input signal data(0x00000000-0xffffffff)
1) Communication device → Robot controller
Output signal data Not used. Set to zero.
unsigned long
56-57
4 byes 2) Robot controller → Communication device
* Ver.R4b/S4b or later
Output signal data(0x00000000-0xffffffff)
1) Communication device → Robot controller
Not used. Set to zero.
Communication data unsigned long
2) Robot controller → Communication device 60-63
counter 4 byes
The number of communications. To return to the minimum
value 0 and the maximum value by integrating.
unsigned short
Reply data type 2 Same Reply data type 1 64-65
2 byes
Not used(reserve) 2 byes Not used 66-67
POSE, JOINT, PULSE,
Reply data 2 ROBMON, Same Reply data 1 68-107
FORCE or FLOAT8 40 bytes
unsigned short
Reply data type 3 Same Reply data type 1 108-109
2 byes
Not used (reserve) 2 byes Not used 110-111
POSE, JOINT, PULSE,
Reply data 3 ROBMON, Same Reply data 1 112-151
FORCE or FLOAT8 40 bytes
Reply data type 4 unsigned short 2 byes Same Reply data type 1 152-153
Not used (reserve) 2 byes Not used 154-155
POSE, JOINT, PULSE,
Reply data 4 ROBMON, Same Reply data 1 156-195
FORCE or FLOAT8 40 bytes
3-29
3 Description of functions
3-30
3 Description of functions
Monitoring counter 4 bytes After power-on, +1 is counted from 0 in an operation control cycle unit (64/9 (*1)).
long The counting repeats in the range of 0 to 4294967295.
(*1) CR750/CR751 series: approx. 7.111 ms, CR800 series: approx. 3.5 ms (If user mechanical is set, approx. 7.1 ms)
3-31
3 Description of functions
3-32
3 Description of functions
3.4.7. Parameters
Second element:
0 is special value, reply to the sender port number
that is set to UDP header information in the packet
data start the robot controller has received
3.4.8. Error
Error
NETPORT/MONPORT parameter error
message
Cause The element of NETPORT(1) and MONPORT(1/2) overlap.
L.7810
Measures Please set not to overlap to another port number.
UDP port number to be used for real-time monitoring function and real-time
Detail external control is duplicated. That you cannot use the same port number,
please change to a different port number.
3-33
3 Description of functions
Please note that the functions listed here apply only to the CR800 series, and not the CR750/CR751 series.
SLMP is a common protocol for seamless communication between applications. Users do not have to be concerned with
network layers or boundaries. SLMP communications are available among devices that can transfer messages by SLMP
(programmable controllers, personal computers, HMIs and others). (For the details of the SLMP compatibility of external
devices, refer to the Instruction Manual of external devices.)
The CR800 Series supports the SLMP communication server function.
3.5.3. Specifications
The following section describes the specifications of the SLMP-compatible device and SLMP communication.
3.5.4. Parameters
3-34
3 Description of functions
The external device issues a close request The robot accepts the close request from the
to the robot and closes the communication. external device and closes the communication.
3-35
3 Description of functions
3-36
3 Description of functions
Header
This is the header for TCP/IP or UDP/IP. The header is added by the external device before transmission. Note that
the header is normally added automatically by the external device.
Subheader
This will differ depending on whether a serial No. is added.
The serial No. is an arbitrary number for message recognition added at the external device. When a serial No. is
added and a request message sent, the same serial No. is added to the response message. Serial Nos. are used
when multiple request messages are sent from an external device to the same SLMP-compatible device.
Serial No.
3-37
3 Description of functions
Example
When 1AH(26) is specified as the request destination network No.
ASCII code
Binary code
ASCII code
Binary code
The host station has a network No. of 00H and a station No. of FFH. Other stations have other values.
The request data addressed to the own station is received regardless of the network No. and station
No. settings.
Furthermore, the request data addressed to the other stations is received when the SLMPNWNO and
SLMPNDID settings are the same.
3-38
3 Description of functions
Example
When 03FFH is specified as the request destination unit I/O No.
ASCII code
Binary code
Example
When 0 is specified as the request destination multidrop station No.
ASCII code
Binary code
3-39
3 Description of functions
Example
When the request data length is 24 bytes
ASCII code
Binary code
Monitoring timer
Not used (fixed to 0000H)
Example
When 10H specified for monitoring timer
ASCII code
Binary code
3-40
3 Description of functions
(Failed completion)
* The following items contain the same information described in section 3.5.6.1 of this manual.
Request destination network No.
Request destination station No.
Request destination unit I/O No.
Request destination multidrop station No.
3-41
3 Description of functions
Header
Contains the Ethernet header.
Subheader
Contains the subheader for the request message.
When adding a serial No. to the request message
When not adding a serial No. to the request message
(when the serial No. is 1234H)
(Fixed value) (Fixed value) (Fixed value)
Serial No.
(Fixed value)
(Fixed value) (Fixed value)
Binary code
Binary code
Serial No.
3-42
3 Description of functions
(Failed completion)
Hexadecimal (unit: bytes)
Request data End code Network Station Destination unit Destinati Command Subcommand
No. No. on
length I/O No.
(respond- (respond- multidrop
ing ing station
station) station) No.
Error information
Example
When the response data length is 22 bytes
ASCII code
Binary code
3-43
3 Description of functions
End code
The command processing result is stored.
The value "0" is stored for normal completion. An error code is stored for abnormal completion. (See section 3.5.8 of
this manual.)
Successful completion Failed completion (0400H)
Response data
When the command is completed successfully, data such as the read data corresponding to the command is stored.
Refer to the "Response data" section in the command description for details on response data.
Error information
The command and the subcommand, etc. for which an error occurred are stored.
3-44
3 Description of functions
3.5.7. Commands
Header Subheader Destina- Destina- Destination Destina- Request data Monitoring Request data Footer
tion tion tion
unit I/O No. length timer
network station multi-
No. No. drop
station
No.
Header Subheader Destina- Destina- Destination Destina- Response data End code Response data Footer
tion tion tion
unit I/O No. length
network station multi-
No. No. drop
station
No.
Failed completion
Refer to section 3.5.6.2 onward in this manual.
3-45
3 Description of functions
3-46
3 Description of functions
3-47
3 Description of functions
*1: Send input relay device codes in order from "X". Note that asterisks (*) from the second character onward may
also be specified with a space (code: 20H).
3-48
3 Description of functions
*1: Send in order from 0. The higher-order digit 0 can also be specified with a space (code: 20H).
0002
0000
*1: The device number for internal relay M1234 is in decimal, and must therefore be converted to hexadecimal. This
will be 000004D2H, and should be sent in the order D2H, 04H, 00H, 00H. This will be 00001234H for link relay
B1234, and should be sent in the order 34H, 12H, 00H, 00H.
*2: The device number for internal relay M1234 is in decimal, and must therefore be converted to hexadecimal. This
will be 0004D2H, and should be sent in the order D2H, 04H, 00H. This will be 001234H for link relay B1234, and
should be sent in the order 34H, 12H, 00H.
3-49
3 Description of functions
Number of devices
Specify the number of devices for reading/writing data.
3-50
3 Description of functions
Example
When performing data communication in binary code, specify a single device with 4 bits, and send data for the
number of specified devices from the specified start device in the order from higher-order byte to lower-order byte.
The ON state is denoted as "1", and the OFF state is denoted as "0".
Example
3-51
3 Description of functions
Example
When word devices for reading data contain other than integers (real numbers, character strings),
stored values are read as integer values.
● When D0 to D1 contains a real number (0.75), D0 = 0000H, and D1 = 3F40H.
● When D2 to D3 contains a character string ("12AB"), D2 = 3231H, and D3 = 4241H.
3-52
3 Description of functions
When bit devices are handled in word units when performing data communication in binary code, a single device is
specified with a 1 bit as shown in the following example. Data is stored in the order from lower-order byte (bit 0 to bit 7) to
higher-order byte (bit 8 to bit 15).
Example
When word devices are used, 1 word is specified in 16 bits as follows. Data is stored in the order from lower-order byte
(bit 0 to bit 7) to higher-order byte (bit 8 to bit 15).
When reading, do so after replacing values stored in the response data with higher/lower-order bytes at the user side.
When writing, store request data after replacing the values to be written with higher/lower-order bytes at the user side.
Example
Values to be read
or written
3-53
3 Description of functions
When word devices for reading data contain other than integers (real numbers, character strings),
stored values are read as integer values.
● When D0 to D1 contains a real number (0.75), D0 = 0000H, and D1 = 3F40H.
● When D2 to D3 contains a character string ("12AB"), D2 = 3231H, and D3 = 4241H.
• Precautions
When performing data communication with ASCII data, process as follows when passing character strings from
external devices to the CPU module.
The procedure for converting data received by SLMP-compatible devices from external devices to binary code
data, and writing it to a specified device is described below.
1. Expand character strings sent from external devices to 2-byte code per one character.
2. Rearrange the character strings expanded to 2-byte code per one character, and send them to the
SLMP-compatible device.
3. Write the data sent to the SLMP-compatible device to the specified device.
The following is an example of a case where a character string ("18AF") received from an external device is
converted to binary code data, and written to D0 to D1.
1. Expand the character string ("18AF") sent from the external device to 2-byte code per one character.
All codes
2. Rearrange the character strings expanded to 2-byte code per one character, and send them to the
SLMP-compatible device.
Numbers expressing
value for each byte
3-54
3 Description of functions
3-55
3 Description of functions
Device Number of
Subcommand First device No.
code devices
Binary
Sub- First device Device Number
command No. code of devices
• Subcommand
Subcommand *1
Item
ASCII code Binary code
When reading data
in bit units or or
or or
or or
*1: Use subcommand 008 if accessing a link direct device, module access device, or CPU buffer memory
access device. When the subcommand is set to 008, the message format will differ. (Reading, writing by
specifying device extension)
• Device code
Specify the type of device to be read.
3-56
3 Description of functions
• Number of devices
Specify the number of devices to be read.
Number of devices
Item
ASCII code Binary code
When reading data in bit units 1 to 3584 devices 1 to 7168 devices
When reading data in word units 1 to 960 devices
Response data
The value read from the device is stored in hexadecimal. The data order will differ depending on whether it is in ASCII
code or binary code.
3-57
3 Description of functions
(Response data)
(Response data)
3-58
3 Description of functions
(Response data)
(Response data)
3-59
3 Description of functions
(Response data)
(Response data)
3-60
3 Description of functions
Device Number of
Subcommand First device No. Write data
code devices
Binary
Number
Sub- First device Device
command No. of Write data
code
devices
• Subcommand
Subcommand *1
Item
ASCII code Binary code
When writing data in
bit units or or
or or
or or
*1: Use subcommand 008 if accessing a link direct device, module access device, or CPU buffer memory
access device. When the subcommand is set to 008, the message format will differ. (Reading, writing by
specifying device extension)
• Device code
Specify the type of device to be written.
3-61
3 Description of functions
• Number of devices
Specify the number of devices to be written.
Number of devices
Item
ASCII code Binary code
When writing data in bit units 1 to 3584 devices 1 to 7168 devices
When writing data in word units 1 to 960 devices
• Write data
Specify the value to be written to all the devices specified in "Number of devices" in the request data.
Request data
There is no Write command response data.
Sub- Device
command code
First device Number of
No. devices Write data
3-62
3 Description of functions
Sub- Device
command code
First device Number of
No. devices Write data
Sub- Device
command code
First device Number of
No. devices Write data
3-63
3 Description of functions
Request data
Specify the devices for the specified number
of devices.
1 1
1 1
Double-word access
Device Device
code Device No. Device No.
code
Binary
Number of
Number of Word access Double-word access
Sub- devices
command devices for double-
for word word
Device Device Device Device Device Device Device Device
access access No. code No. code No. code No. code
1 1 1 1
3-64
3 Description of functions
• Subcommand
Subcommand *1
ASCII code Binary code
or or
or or
*1: Use subcommand 008 if accessing a link direct device, module access device, or CPU buffer memory
access device. When the subcommand is set to 008, the message format will differ. (Reading, writing by
specifying device extension)
3-65
3 Description of functions
Response data
Values for read devices are stored in hexadecimal. The data order will differ depending on whether it is in ASCII code
or binary code.
Data in the devices specified for Data in the devices specified for
word access double-word access
3-66
3 Description of functions
Communication example
With word access, read D0, D1, M100 to M115, and X20 to X2F, and with double-word access, read D1500 to D1501,
Y160 to Y17F, and M1111 to M1142.
Here D0 = 6549 (1995H), D1 = 4610 (1202H), D1500 = 20302 (4F4EH), and D1501 = 19540 (4C54H).
(Response data)
Word access Word access Word access Word access
Read data 1 Read data 2 Read data 3 Read data 4
3-67
3 Description of functions
(Response data)
Word Word Word Word
access access access access Double-word Double-word Double-word
Read Read Read Read access access access
data 1 data 2 data 3 data 4 Read data 1 Read data 2 Read data 3
3-68
3 Description of functions
Number of
devices Device Set/
Subcommand for bit
Device Device No. Set/ Device No.
access code reset code reset
1 1
Specify the devices for the specified number of devices.
Binary
Number of
Sub- devices Device Device Set/ Device Device Set/
command for bit No. code reset No. code reset
access
1 1
Double-word access
Number
Number of
Word access Double-word access
Sub- devices for
of devices
double-
command for word Device Device Write Device Device
word Write data
access
access No. code data No. code
3-69
3 Description of functions
• Subcommand
Subcommand *1
Item
ASCII code Binary code
When writing data in
bit units or or
or or
or or
*1: Use subcommand 008 if accessing a link direct device, module access device, or CPU buffer memory
access device. When the subcommand is set to 008, the message format will differ. (Reading, writing by
specifying device extension)
• Number of devices for bit access, Number of devices for word access, Number of devices for double-word access
Specify the number of target devices.
Subcommand Item Description
0003 Number of devices Specify the number of bit devices in 1-bit units.
0002 for bit access
Number of devices Specify the number of devices for 1 word access.
for word access The applicable units are 16-bit units for bit devices, and
1-word units for word devices.
Number of devices Specify the number of devices for 2 word access.
for double-word The applicable units are 32-bit units for bit devices, and
access 2-word units for word devices.
0001 Number of devices Specify the number of bit devices in 1-bit units.
0000 for bit access
Number of devices Specify the number of devices for 1 word access.
for word access The applicable units are 16-bit units for bit devices, and
1-word units for word devices.
Number of devices Specify the number of devices for 2 word access.
for double-word The applicable units are 32-bit units for bit devices, and
access 2-word units for word devices.
3-70
3 Description of functions
• Set/reset
Specify ON/OFF for bit devices.
Data to be written
Item Subcommand When When turned Remarks
turned ON OFF
ASCII code 0003 "0001" "0000" Send 4 digits in order from "0"
0002
0001 "01" "00" Send 2 digits in order from "0"
0000
Binary code 0003 0100H 0000H Either of the 2-byte numerical values
0002 on the left is sent.
0001 01H 00H Either of the 1-byte numerical values
0000 on the left is sent.
Response data
There is no Write Random command response data.
3-71
3 Description of functions
3-72
3 Description of functions
Device Device
code Device No. Write data code Device No. Write data
Data 1 Data 2
Data 3
Data 4
Data 1 Data 3
Data 2 Data 4
3-73
3 Description of functions
Sub-
command
Data 3 Data 4
Data 1 Data 3
Data 2 Data 4
3-74
3 Description of functions
Binary code
Sub- First device No. Device Number
No extension Command command of
specified or device No. code
devices
• Command
Access is possible with the following commands.
Item
Command
Category Operation
Device Read 0401
Write 1401
Read Random 0403
Write Random 1402
3-75
3 Description of functions
• Subcommand
ASCII code Binary code
• Extension designation
Specify the CPU module start I/O number.
ASCII code Binary code
Specify the start I/O number in hexadecimal (3 ASCII Specify the start I/O number in hexadecimal (2 bytes).
code digits). When the start I/O number is expressed When the start I/O number is expressed with 4 digits,
with 4 digits, specify with the first 3 digits. specify with the first 3 digits.
The start I/O numbers for the specified CPU modules are as follows.
CPU module CPU No. Start I/O number
CPU No.1 03E0H
CPU No.2 03E1H
CPU No.3 03E2H
CPU No.4 03E3H
3-76
3 Description of functions
• Device code
Specify the following device codes.
Device code
Device Category Device No. range
ASCII code *1 Binary code
CPU buffer Word G*** 00ABH Specify within the range of Decimal
memory device numbers held by the
CPU buffer HG** *2 002EH access destination unit.
memory fixed
cycle area
*1: For ASCII code, specify device codes with 4 digits. For device codes with 3 digits or less, add an asterisk (*)
(ASCII code: 2AH) or a space (ASCII code: 20H) after the device code.
*2 : When the CR800-Q controller is used, the HG devices cannot be used as SLMP-compatible devices.
Response data
The same applies if no extension is specified.
Communication example
The start I/O number accesses the 03E0H CPU module buffer memory (address: 1).
Show the request data when performing communication with ASCII code.
3-77
3 Description of functions
Request data
Loopback data
Subcommand quantity Loopback data
Binary code
Sub- Loopback
command data Loopback data
quantity
• Subcommand
Subcommand
ASCII code Binary code
Example
When the loopback data quantity is 5 bytes
When using ASCII, convert the number of bytes to 4 ASCII code digits (hexadecimal), and send them in the order
from higher-order byte to lower-order byte.
When using binary code, send the number of 2-byte characters indicating the number of bytes in the order from
lower-order byte to higher-order byte.
• Loopback data
Specify the data sent and received when performing a loopback test.
When performing data communication in ASCII code, specify a 1-byte character string ("0" to "9", "A" to "F") for
data with maximum of 960 characters, and send from the start.
When performing data communication in binary code, convert the 1-byte character ("0" to "9", "A" to "F") code to a
1-byte numerical value, and send data with maximum of 960 bytes from the starting character code.
3-78
3 Description of functions
Request data
The same content as that in the "Loopback data quantity" and "Loopback data" specified in the request message is
stored.
Loopback data
Loopback data
quantity
Binary code
Loopback
data Loopback data
quantity
Communication example
Perform a loopback test with loopback data "ABCDE".
• When performing data communication in ASCII code
(Request data)
Loopback data
Subcommand quantity Loopback data
(Response data)
Loopback data
quantity Loopback data
(Response data)
Loopback
data
quantity Loopback data
3-79
3 Description of functions
3-80
3 Description of functions
3.6.1. Overview
The CR800 series supports this function. It is not supported by the CR750/CR751 series.
CC-Link IE Field Network Basic is an FA network to which general-purpose Ethernet was applied.
For the MELFA FR series, CC-Link IE Field Network Basic slave stations are supported, and the signals and registers of
robot controllers can be input and output via regular communications (cyclic correspondence) with a PLC, computer, or
other master station.
Master Slave
PLC CPU/computer, etc. Robot controller
PLC CPUs in the MELSEC iQ-R/iQ-F/Q/L series and robot controllers in the MELFA FR series have Ethernet built-in as
standard, so they do not require dedicated options. This allows system construction with minimal configuration, thereby
saving space and reducing the cost.
Because CC-Link IE Field Network Basic has application software that runs on a general-purpose Ethernet protocol stack,
TCP/IP transmissions can intermingle. Therefore, the products that support CC-Link IE Field Network Basic and the
products that support Ethernet can be connected by a single cable, which makes it easy to construct the system however
you want.
Commercial
switching hub
Wi-Fi Router
Ethernet
Remote I/O Robot Display Inverter Servo Solenoid Label Barcode Weight
valve printer reader checker
3-81
3 Description of functions
3.6.3. Specifications
The communication specifications of CC-Link IE Field Network Basic are described below.
Item Description
(*1) Remote input, RX: Information input from slave to master through bitwise operations.
(*2) Remote output, RY: Information output from master to slave through bitwise operations.
(*3) Remote register, RWr: Information input from slave to master through 16-bit (1 word) operations.
(*4) Remote register, RWw: Information output from master to slave through 16-bit (1 word) operations.
3-82
3 Description of functions
3.6.4. Parameters
3-83
3 Description of functions
The support of robot I/O signals and link devices for RX/RY and RWr/RWw are indicated here.
As shown below, the link relays RX/RY and link registers RWr/RWw of a master station's link device interacts with the I/O
signals (6000 to max. 6255) and I/O registers (6000 to max. 6127) of each robot. Even if the station number changes, the
I/O signals of the robot are the same. Also, the number of stations occupied by a robot can be set from 1 to 4, designated
by the setting for number of stations occupied by master stations.
(*1) Remote input, RX: Information input from slave to master through bitwise operations.
Remote output, RY: Information output from master to slave through bitwise operations.
(*2) Remote register, RWr: Information input from slave to master through 16-bit (1 word) operations.
Remote register, RWw: Information output from master to slave through 16-bit (1 word) operations.
3-84
3 Description of functions
The steps up to using the CC-Link IE Field Network Basic function are indicated here.
The system configuration used as an example in this description has MELSEC PLC R16CPU as the master station and FR
series robot FV-4FR-D as the slave station.
Confirm the operation by using the General Purpose Signal window and Register window on RT ToolBox3. Refer to the
instruction manual of RT ToolBox3 for how to use signal monitoring, how to operate the robot program, and so on.
3-85
3 Description of functions
Master station (PCL, computer, etc.) Master station (PCL, computer, etc.)
192.168.0.39 192.168.0.39
100BASE-TX
100BASE-TX Ethernet
Ethernet
Fiber optic cable
SSCNET III/H
192.168.0.20 192.168.0.20
Slave station (robot CR800-D)
Slave station (robot CR800-R/CR800-Q)
CAUTION • For the CR800-R/CR800-Q type, the Ethernet connector is used with the
R16RTCPU/Q172DSRCPU unit. An Ethernet connector cannot be used with the
CR800-R/CR800-Q robot controller.
• The PLC CPU acting as the master station must have a firmware version that supports the
CC-Link IE Field Network Basic function. Refer to the website or manual of each device for
details.
Download the profile (csp+ file) of the robot controllers from the website of the CC-Link Partner Association
(Products).
https://www.cc-link.org/
https://www.cc-link.org/en/products/index.html
3-86
3 Description of functions
2. Next, open "Online" → "Parameter" → "Field Network Parameter" → "CC-Link IE Field Basic", and change the
function selection to "Enable". Lastly, press "Write" and then reset the power of the robot controller.
3-87
3 Description of functions
3-88
3 Description of functions
2. In GX Works3, go to "CC-Link IEF Basic Setting" in "Module Parameter" and set "Enable" for whether to use or
not to use the CC-Link IEF Basic Setting. Then open "<Detailed Setting>" beside the network configuration
settings. Here select "Detect Now". When the automatic detection is complete, the detected slave stations will be
displayed. In the following example, STA#1 for CR800-R is added.
3-89
3 Description of functions
3. Press "Close with Reflecting the Setting" and then select "Yes" on the confirmation dialog box that is displayed.
3-90
3 Description of functions
5. Finally, go to the menu bar's "Online" → "Write to PLC", and press "Execute" to write the parameters to the PLC
CPU. When the writing is complete, reset the power and restart.
The settings are now complete. Next, run network diagnostics to confirm whether normal communications are
possible.
3-91
3 Description of functions
3-92
3 Description of functions
After the robot slave station has established proper communication with the master station, if the master station goes
down or the wiring becomes disconnected and communication with the master station is blocked, error 7870 is issued
on the robot controller.
The error number of the robot controller and its details can be checked on the error monitor screen of RT ToolBox3.
For the PLC CPU master station, the station with the error can be confirmed in the network status section of the
CC-Link IEF Basic Diagnostics screen in GX Works3.
3-93
3 Description of functions
3.6.6.3. Programming
Write the program.
In the following example, the signal and register value output by the robot program of the robot controller is returned
by the PLC CPU's ladder program and reflected in the robot's input signal and register.
<Example>
Robot controller PLC CPU
Link Refresh
Scan
Input signal 6000 to 6063 RY0 to RY3F Link relay B1000 to B103F
Input register 6000 to 6031 RWw0 to RWw1F Link register W1000 to W103F
3-94
4 Appendix
4. Appendix
4.1. Error list
The errors which occur only when the Ethernet function is used are listed as follows.
For the other errors except these, refer to the errors list of the instruction manual of the controller.
4-1
4 Appendix
The sample program to do the data link with Microsoft Visual Studio Express Visual Basic (hereafter written as VB) is
herein described.
The program creation is briefly introduced with the following procedure.
For details of VB operation and application producing method, refer to the instruction manual of this software.
(1) Preparation of Winsock control
(2) Production of form screen
(3) Program (Form1.frm)
There is the program following 2 passages. Use either according to the customer's system.
1) Program for the clients (when using the personal computer as the client and using the controller as the server).
2) Program for the server (when using the personal computer as the server and using the controller as the client).
* About the work of 1) 2), the client and the server are the same.
4-2
4 Appendix
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
4-3
4 Appendix
4-4
4 Appendix
Me.Text3.TabIndex = 15
'
'Text2
'
Me.Text2.AcceptsReturn = True
Me.Text2.BackColor = System.Drawing.SystemColors.Window
Me.Text2.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text2.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text2.Location = New System.Drawing.Point(152, 24)
Me.Text2.MaxLength = 0
Me.Text2.Name = "Text2"
Me.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text2.Size = New System.Drawing.Size(105, 19)
Me.Text2.TabIndex = 13
Me.Text2.Text = "10003"
'
'Text1
'
Me.Text1.AcceptsReturn = True
Me.Text1.BackColor = System.Drawing.SystemColors.Window
Me.Text1.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text1.Location = New System.Drawing.Point(8, 24)
Me.Text1.MaxLength = 0
Me.Text1.Name = "Text1"
Me.Text1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text1.Size = New System.Drawing.Size(137, 19)
Me.Text1.TabIndex = 12
Me.Text1.Text = "192.168.0.1"
'
'Label4
'
Me.Label4.BackColor = System.Drawing.SystemColors.Control
Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label4.Location = New System.Drawing.Point(8, 104)
Me.Label4.Name = "Label4"
Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label4.Size = New System.Drawing.Size(65, 13)
Me.Label4.TabIndex = 19
Me.Label4.Text = "Receive data"
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.Control
Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label3.Location = New System.Drawing.Point(8, 56)
Me.Label3.Name = "Label3"
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label3.Size = New System.Drawing.Size(65, 13)
Me.Label3.TabIndex = 18
Me.Label3.Text = "Send data"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(152, 8)
Me.Label2.Name = "Label2"
4-5
4 Appendix
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(65, 13)
Me.Label2.TabIndex = 11
Me.Label2.Text = "Port No."
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.Size = New System.Drawing.Size(73, 17)
Me.Label1.TabIndex = 10
Me.Label1.Text = "IP address"
'
'Timer1
'
Me.Timer1.Interval = 50
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(320, 253)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Check1)
Me.Controls.Add(Me.Text4)
Me.Controls.Add(Me.Text3)
Me.Controls.Add(Me.Text2)
Me.Controls.Add(Me.Text1)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Data link (client)"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Public WithEvents Button1 As System.Windows.Forms.Button
Public WithEvents Check1 As System.Windows.Forms.CheckBox
Public WithEvents Text4 As System.Windows.Forms.TextBox
Public WithEvents Text3 As System.Windows.Forms.TextBox
Public WithEvents Text2 As System.Windows.Forms.TextBox
Public WithEvents Text1 As System.Windows.Forms.TextBox
Public WithEvents Label4 As System.Windows.Forms.Label
Public WithEvents Label3 As System.Windows.Forms.Label
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Windows.Forms.Timer
End Class
4-6
4 Appendix
Imports System
Imports System.Net.Sockets
4-7
4 Appendix
Client = Nothing
Timer1.Enabled = False
Button1.Enabled = False
Check1.Checked = False
'
MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1)
End Try
End Sub
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
4-8
4 Appendix
Me.Button1.TabIndex = 26
Me.Button1.Text = "Send"
Me.Button1.UseVisualStyleBackColor = False
'
'Check1
'
Me.Check1.BackColor = System.Drawing.SystemColors.Control
Me.Check1.Cursor = System.Windows.Forms.Cursors.Default
Me.Check1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Check1.Location = New System.Drawing.Point(264, 24)
Me.Check1.Name = "Check1"
Me.Check1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Check1.Size = New System.Drawing.Size(49, 25)
Me.Check1.TabIndex = 24
Me.Check1.Text = "Connection"
Me.Check1.UseVisualStyleBackColor = False
'
'Text4
'
Me.Text4.AcceptsReturn = True
Me.Text4.BackColor = System.Drawing.SystemColors.Window
Me.Text4.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text4.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text4.Location = New System.Drawing.Point(8, 120)
Me.Text4.MaxLength = 0
Me.Text4.Multiline = True
Me.Text4.Name = "Text4"
Me.Text4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text4.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.Text4.Size = New System.Drawing.Size(305, 121)
Me.Text4.TabIndex = 27
'
'Text3
'
Me.Text3.AcceptsReturn = True
Me.Text3.BackColor = System.Drawing.SystemColors.Window
Me.Text3.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text3.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text3.Location = New System.Drawing.Point(8, 72)
Me.Text3.MaxLength = 0
Me.Text3.Name = "Text3"
Me.Text3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text3.Size = New System.Drawing.Size(249, 19)
Me.Text3.TabIndex = 25
'
'Text2
'
Me.Text2.AcceptsReturn = True
Me.Text2.BackColor = System.Drawing.SystemColors.Window
Me.Text2.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text2.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text2.Location = New System.Drawing.Point(152, 24)
Me.Text2.MaxLength = 0
Me.Text2.Name = "Text2"
Me.Text2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text2.Size = New System.Drawing.Size(105, 19)
Me.Text2.TabIndex = 23
Me.Text2.Text = "10003"
'
'Text1
'
4-9
4 Appendix
Me.Text1.AcceptsReturn = True
Me.Text1.BackColor = System.Drawing.SystemColors.Window
Me.Text1.Cursor = System.Windows.Forms.Cursors.IBeam
Me.Text1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Text1.Location = New System.Drawing.Point(8, 24)
Me.Text1.MaxLength = 0
Me.Text1.Name = "Text1"
Me.Text1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Text1.Size = New System.Drawing.Size(137, 19)
Me.Text1.TabIndex = 22
'
'Label4
'
Me.Label4.BackColor = System.Drawing.SystemColors.Control
Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label4.Location = New System.Drawing.Point(8, 104)
Me.Label4.Name = "Label4"
Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label4.Size = New System.Drawing.Size(65, 13)
Me.Label4.TabIndex = 29
Me.Label4.Text = "Receive data"
'
'Timer1
'
Me.Timer1.Interval = 50
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.Control
Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label3.Location = New System.Drawing.Point(8, 56)
Me.Label3.Name = "Label3"
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label3.Size = New System.Drawing.Size(65, 13)
Me.Label3.TabIndex = 28
Me.Label3.Text = "Send data"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(152, 8)
Me.Label2.Name = "Label2"
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(65, 13)
Me.Label2.TabIndex = 21
Me.Label2.Text = "Port No."
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.Size = New System.Drawing.Size(73, 17)
Me.Label1.TabIndex = 20
4-10
4 Appendix
End Sub
Public WithEvents Button1 As System.Windows.Forms.Button
Public WithEvents Check1 As System.Windows.Forms.CheckBox
Public WithEvents Text4 As System.Windows.Forms.TextBox
Public WithEvents Text3 As System.Windows.Forms.TextBox
Public WithEvents Text2 As System.Windows.Forms.TextBox
Public WithEvents Text1 As System.Windows.Forms.TextBox
Public WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Public WithEvents Label3 As System.Windows.Forms.Label
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
End Class
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Net.NetworkInformation
Imports System.Text
4-11
4 Appendix
4-12
4 Appendix
Catch ex As Exception
MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1)
End Try
End Sub
End Class
4-13
4 Appendix
A sample program that establishes a data link using Microsoft Visual Studio Express Visual C++ (hereinafter VC) is shown
below.
The procedures for creating the program are briefly explained below.
Refer to the software manuals for details on operating VC and creating the application.
(1) Create new project
(2) Create program sample.cpp/strdef.h
4-14
4 Appendix
4-15
4 Appendix
#define VER_H7
/*************************************************************************/
/* Joint coordinate system (Set unused axis to 0) */
/* Refer to the instruction manual enclosed */
/* with each robot for details on each element. */
/************************************************************************/
typedef struct{
float j1; // J1 axis angle (radian)
float j2; // J2 axis angle (radian)
float j3; // J3 axis angle (radian)
float j4; // J4 axis angle (radian)
float j5; // J5 axis angle (radian)
float j6; // J6 axis angle (radian)
float j7; // Additional axis 1 (J7 axis angle) (radian)
float j8; // Additional axis 2 (J8 axis angle) (radian)
} JOINT;
/*************************************************************************/
/* XYZ coordinate system (Set unused axis to 0) */
/* Refer to the instruction manual enclosed */
/* with each robot for details on each element. */
/************************************************************************/
typedef struct{
float x; // X axis coordinate value (mm)
float y; // Y axis coordinate value (mm)
float z; // Z axis coordinate value (mm)
float a; // A axis coordinate value (radian)
float b; // B axis coordinate value (radian)
float c; // C axis coordinate value (radian)
float l1; // Additional axis 1 (mm or radian)
float l2; // Additional axis 2 (mm or radian)
} WORLD;
typedef struct{
WORLD w;
unsigned int sflg1; // Structural flag 1
unsigned int sflg2; // Structural flag 2
} POSE;
/*************************************************************************/
/* Pulse coordinate system (Set unused axis to 0) */
/* These coordinates express each joint */
/* with a motor pulse value. */
/*************************************************************************/
typedef struct{
long p1; // Motor 1 axis
long p2; // Motor 2 axis
long p3; // Motor 3 axis
long p4; // Motor 4 axis
long p5; // Motor 5 axis
long p6; // Motor 6 axis
long p7; // Additional axis 1 (Motor 7 axis)
4-16
4 Appendix
/************************************************************/
/* Real-time function communication data packet */
/************************************************************/
typedef struct enet_rtcmd_str {
unsigned short Command; // Command
#define MXT_CMD_NULL 0 // Real-time external command invalid
#define MXT_CMD_MOVE 1 // Real-time external command valid
#define MXT_CMD_END 255 // Real-time external command end
4-17
4 Appendix
} MXTCMD;
// Change the definition in the "strdef.h" file by the S/W version of the controller.
// Refer to the "strdef.h" file for details.
//
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <iostream>
#include <winsock.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <math.h>
#include "strdef.h"
#define NO_FLAGS_SET 0
INT main(VOID)
{
WSADATA Data;
SOCKADDR_IN destSockAddr;
SOCKET destSocket;
unsigned long destAddr;
int status;
int numsnt;
int numrcv;
char sendText[MAXBUFLEN];
char recvText[MAXBUFLEN];
char dst_ip_address[MAXBUFLEN];
unsigned short port;
char msg[MAXBUFLEN];
char buf[MAXBUFLEN];
char type,type_mon[4];
unsigned short IOSendType=0; // Send input/output signal data designation
unsigned short IORecvType=0; // Reply input/output signal data designation
unsigned short IOBitTop=0;
4-18
4 Appendix
cout << " Input connection destination port No. (10000) -> ";
cin.getline(msg, MAXBUFLEN);
if(msg[0]!=0) port=atoi(msg);
else port=10000;
4-19
4 Appendix
// Socket creation
destSocket=socket(AF_INET, SOCK_DGRAM, 0);
if (destSocket == INVALID_SOCKET) {
cerr << "ERROR: socket unsuccessful" << endl;
status=WSACleanup();
if (status == SOCKET_ERROR)
cerr << "ERROR: WSACleanup unsuccessful" << endl;
return(1);
}
MXTCMD MXTsend;
MXTCMD MXTrecv;
JOINT jnt_now;
POSE pos_now;
PULSE pls_now;
memset(&MXTsend, 0, sizeof(MXTsend));
memset(&jnt_now, 0, sizeof(JOINT));
memset(&pos_now, 0, sizeof(POSE));
memset(&pls_now, 0, sizeof(PULSE));
while(loop) {
memset(&MXTsend, 0, sizeof(MXTsend));
4-20
4 Appendix
memset(&MXTrecv, 0, sizeof(MXTrecv));
// Keyboard input
// [Enter]=End / [d]= Display the monitor data, or none / [0/1/2/3]= Change of monitor data display
// [z/x]=Increment/decrement first command data transmitted by the delta amount
while(_kbhit()!=0) {
ch=_getch();
switch(ch) {
case 0x0d:
MXTsend.Command = MXT_CMD_END;
loop = 0;
break;
case 'Z':
case 'z':
delta += (float)0.1;
break;
case 'X':
case 'x':
delta -= (float)0.1;
break;
case 'C':
4-21
4 Appendix
case 'c':
delta = (float)0.0;
break;
case 'd':
disp = ~disp;
break;
case '0': case '1': case '2': case '3':
disp_data = ch - '0';
break;
}
}
memset(sendText, 0, MAXBUFLEN);
memcpy(sendText, &MXTsend, sizeof(MXTsend));
if(disp) {
sprintf(buf, "Send (%ld):",counter);
cout << buf << endl;
}
numsnt=sendto(destSocket, sendText, sizeof(MXTCMD), NO_FLAGS_SET, (LPSOCKADDR) &destSockAddr,
sizeof(destSockAddr));
if (numsnt != sizeof(MXTCMD)) {
cerr << "ERROR: sendto unsuccessful" << endl;
status=closesocket(destSocket);
if (status == SOCKET_ERROR)
cerr << "ERROR: closesocket unsuccessful" << endl;
status=WSACleanup();
if (status == SOCKET_ERROR)
cerr << "ERROR: WSACleanup unsuccessful" << endl;
return(1);
}
memset(recvText, 0, MAXBUFLEN);
4-22
4 Appendix
int DispType;
void *DispData;
switch(disp_data) {
case 0:
DispType = MXTrecv.RecvType;
DispData = &MXTrecv.dat;
break;
case 1:
DispType = MXTrecv.RecvType1;
DispData = &MXTrecv.dat1;
break;
case 2:
DispType = MXTrecv.RecvType2;
DispData = &MXTrecv.dat2;
break;
case 3:
DispType = MXTrecv.RecvType3;
DispData = &MXTrecv.dat3;
break;
default:
break;
}
switch(DispType) {
case MXT_TYP_JOINT:
case MXT_TYP_FJOINT:
case MXT_TYP_FB_JOINT:
if(loop==1) {
memcpy(&jnt_now, DispData, sizeof(JOINT));
loop = 2;
}
if(disp) {
JOINT *j=(JOINT*)DispData;
sprintf(buf, "Receive (%ld): TCount=%d
Type(JOINT)=%d¥n %7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f (%s)"
,MXTrecv.CCount,MXTrecv.TCount,DispType
,j->j1, j->j2, j->j3 ,j->j4, j->j5, j->j6, j->j7, j->j8, str);
cout << buf << endl;
}
break;
case MXT_TYP_POSE:
case MXT_TYP_FPOSE:
case MXT_TYP_FB_POSE:
if(loop==1) {
memcpy(&pos_now, &MXTrecv.dat.pos, sizeof(POSE));
loop = 2;
}
if(disp) {
POSE *p=(POSE*)DispData;
sprintf(buf, "Receive (%ld): TCount=%d
Type(POSE)=%d¥n %7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f, %04x,%04x (%s)"
,MXTrecv.CCount,MXTrecv.TCount,DispType
,p->w.x, p->w.y, p->w.z, p->w.a, p->w.b, p->w.c, p->sflg1, p->sflg2, str);
cout << buf << endl;
}
break;
case MXT_TYP_PULSE:
case MXT_TYP_FPULSE:
case MXT_TYP_FB_PULSE:
case MXT_TYP_CMDCUR:
case MXT_TYP_FBKCUR:
4-23
4 Appendix
if(loop==1) {
memcpy(&pls_now, &MXTrecv.dat.pls, sizeof(PULSE));
loop = 2;
}
if(disp) {
PULSE *l=(PULSE*)DispData;
sprintf(buf, "Receive (%ld): TCount=%d
Type(PULSE/OTHER)=%d¥n %ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld (%s)"
,MXTrecv.CCount,MXTrecv.TCount,DispType
,l->p1, l->p2, l->p3, l->p4, l->p5, l->p6, l->p7, l->p8, str);
cout << buf << endl;
}
break;
case MXT_TYP_NULL:
if(loop==1) {
loop = 2;
}
if(disp) {
sprintf(buf, "Receive (%ld): TCount=%d Type(NULL)=%d¥n (%s)"
,MXTrecv.CCount,MXTrecv.TCount, DispType, str);
cout << buf << endl;
}
break;
default:
cout << "Bad data type.¥n" << endl;
break;
}
counter++; // Count up only when communication is successful
retry=0; // Leave reception loop
}
else { // Reception timeout
cout << "... Receive Timeout! <Push [Enter] to stop the program>" << endl;
retry--; // No. of retries subtraction
if(retry==0) loop=0; // End program if No. of retries is 0
}
} /* while(retry) */
} /* while(loop) */
// End
cout << "/// End /// ";
sprintf(buf, "counter = %ld", counter);
cout << buf << endl;
// Close socket
status=closesocket(destSocket);
if (status == SOCKET_ERROR)
cerr << "ERROR: closesocket unsuccessful" << endl;
status=WSACleanup();
if (status == SOCKET_ERROR)
cerr << "ERROR: WSACleanup unsuccessful" << endl;
return 0;
}
4-24
Oct. 2020 MEE Printed in Japan on recycled paper. Specifications are subject to change without notice.