FANUC Series 0i-MODEL F Plus. CONNECTION MANUAL (FUNCTION) - page 347

 

  Index      Manuals     FANUC Series 0i-MODEL F Plus. CONNECTION MANUAL (FUNCTION) B-64693EN-1/01

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     345      346      347      348     ..

 

 

 

FANUC Series 0i-MODEL F Plus. CONNECTION MANUAL (FUNCTION) - page 347

 

 

17. EMBEDDED ETHERNET FUNCTION

 

 

B-64693EN-1/01

 

- 2730 - 

17.2.9 

Setting of the Modbus/TCP Server Function 

This subsection describes  the  setting  required  to operate the Modbus/TCP Server function  with the 
embedded Ethernet function. 
 

  WARNING 

 

Only when a partner client device sends data and the Modbus/TCP Server 
function of CNC receives it, the data is checked and processed by CNC. Even if 
the communication of the client happens to stop unexpectedly, the Modbus/TCP 
Server function does not detect such situations. 
So, do not use the Modbus/TCP Server function for data exchange application 
concerned with machine safety. 
For example, even if the client attempts to send the "STOP" data at some timing, 
it is not guaranteed that it always reaches CNC. Thus, it is very dangerous to 
build the system concerned with machine safety by using Modbus/TCP Server 
function. 
If the data exchange concerned with machine safety fails, the machine may 
behave unexpectedly, possibly damaging the tool, the machine itself, the 
workpiece, or causing injury to the user. 

 

NOTE 

1  The Modbus/TCP Server function can also be used on the Fast Ethernet board. 
 

This subsection is written for the embedded Ethernet, but the basic content can 
be also applied when the Fast Ethernet board is used. For details on using the 
Fast Ethernet board, see "Industrial Ethernet CONNECTION MANUAL 
(B-64013EN)". 

2  This function cannot be operated on the PCMCIA LAN card. 

It cannot be operated on a Fast Ethernet board and on embedded Ethernet at 
the same time. Switch it between them, using bit 1 (MOD) of parameter 
No.14882. 

3  The communication speed of the embedded Ethernet is lower than a Fast 

Ethernet board. 

4  The Modbus/TCP client function and the PROFINET IO controller function are 

not supported. 

 

B-64693EN-1/01

 

 

17. EMBEDDED ETHERNET FUNCTION

 

- 2731 - 

17.2.9.1 

OVERVIEW 

OVERVIEW 

This section provides an overview of the Modbus/TCP Server function. 
 

Modbus/TCP data model 

The following four kinds of data formats, each called a "Table",  are defined for the  Modbus/TCP data 
model. 
 

Table name 

Object type (data type) 

Type of READ/WRITE 

Discrete input 

Single bit 

READ only 

Coils 

Single bit 

READ-WRITE 

Input Registers 

16-bit word 

READ only 

Holding Registers 

16-bit word 

READ-WRITE 

 

NOTE 

1  For the CNC Modbus/TCP Server function, only "Holding Registers" can be 

used. 
"Discrete input", "Coils", and "Input Registers" cannot be used. 

2  "READ" means the input of data as viewed from the Modbus/TCP client, and 

"WRITE" means the data of output as viewed from the client. 

 

Modbus/TCP function codes 

For the Modbus/TCP Server function of the CNC, the following function codes are supported. 
 

Function code name 

Code number 

Read Holding Registers 

03h 

Write Multiple Registers 

10h 

Read/Write Multiple Registers 

17h 

 

17. EMBEDDED ETHERNET FUNCTION

 

 

B-64693EN-1/01

 

- 2732 - 

Modbus area (Holding Registers) 

For  the  Modbus/TCP Server function, the Modbus area (Holding Registers) of 65536  words (131072 
bytes) is prepared. 
And the Modbus area can be allocated to the PMC area. 
Because of this, the data accessed from the Modbus/TCP client device to the Modbus area can be posted 
to the PMC area, and the user application (Ladder program etc.) can access the Modbus area through the 
PMC area. 
This allocation can be set in up to three areas. 
The Modbus/TCP area is a data area in word units, and can take address values of 1 to 65536. 
 

 

Modbus/TCP 
Client 

Write Registers

 

0                  15 

Read Registers

 

0                  15

 

Modbus/TCP 
Server 

Modbus area 

15                  0

 

(Holding Registers)

 

7                  0

 

PMC area 

Area1 

Area2 

Area3 

00001

 

65536

 

User 
Application 

 

 

 

 

Read Registers

 

0                  15

 

Address error is returned when accessing 
the Modbus area not allocated to PMC area. 

Fig.17.2.9.1 (a) Modbus area 

 

NOTE 

 

A Modbus/TCP client device can access only a Modbus area with a PMC area 
allocated. If a client device attempts to access a Modbus area with no PMC area 
allocated, an address error (Exception Code = 0x02, Exception Name = ILLIGAL 
DATA ADDRESS) is returned to the client device. 
Be sure to allocate a PMC area to the Modbus area to be accessed by a client 
device. 

 

B-64693EN-1/01

 

 

17. EMBEDDED ETHERNET FUNCTION

 

- 2733 - 

SPECIFICATIONS of the Modbus/TCP Server Function 

This section describes the specifications of the Modbus/TCP Server function of the CNC. 
 
The following is a list of specifications of the Modbus/TCP Server function of the CNC. 
 

Item 

Description 

Combination with other 
functions 

The function can be operated at the same time as the function of embedded 
Ethernet. 

PMC area that can be 
allocated 

DI 

 

: R, E, and D areas 

DO 

 

: R, E, and D areas 

Status 

: R and E area 

Maximum DI/DO data size 

Depends on the effective PMC area.   

Port number (TCP) 

502 (standard value) 

Function specification 

"Automatic TCP connection management" is supported. 

 

This means that the user application (ladder program) need not take TCP 
connection into consideration. 

"Non-priority connection pool" is supported. 

 

This means that if there are requests from more Modbus/TCP clients than a 
certain number, connections will be terminated in order of the oldest to the 
newest. (NOTE 1) 

 

("Priority connection pool" is not supported.) 

"Access control service" is not supported. 

 

This means that no client devices require authentication (user name or 
password) to access the FANUC Modbus/TCP Server function. 

Maximum number of clients 
that can connect to a single 
CNC at the same time 

 

NOTE 

1  Use the function within the maximum number of clients that can be connected to 

a single CNC at the same time. 
If there are connection requests from more clients than the maximum number, 
the communication with the oldest client will be disconnected. Thus, a client that 
wants to keep a connection must reconnect if disconnected, assuming that it 
may be disconnected from the server. 

2  Settings of communication parameters are not subject to 8-level data protection 

function. 

 

17. EMBEDDED ETHERNET FUNCTION

 

 

B-64693EN-1/01

 

- 2734 - 

Allocating PMC Areas 

To allocate a PMC area in the setting screen of each communication function, specify it as follows: 

 

Input format) 
 

<Path number>:<PMC address> 

 
For example, for R0500 on the second path of the PMC, input "2:R500". 
If <Path number> is omitted (R500), the first path is assumed (1:R0500). 
If the <:> key is not available, it can be substituted with the </> key or the <EOB> key. ":" is optional. 
To clear "<Path number>:<PMC address>" previously set, input " " (blank). ("---" will be displayed). In 
this case, it is assumed that no PMC area is used. 
 

  WARNING 

 

Be careful not to cause an overlap between the PMC area to allocate and a 
PMC area used for other purposes. Immediately after setting all necessary 
communication parameters, check that the DI/DO data and status data are 
operated properly in a starter where safety is secured. 
If the machine is operated without confirmation of above explanation, the 
machine may behave unexpectedly, possibly damaging the tool, the machine 
itself, the workpiece, or causing injury to the user. 

 

  CAUTION 

1  Immediately after the power is turned on, all R area and E area as volatile 

memory in the PMC area are 0. 

2  The D area in the PMC area is allocated to nonvolatile memory. In addition, the 

E area in the PMC area is normally allocated to volatile memory. However, it can 
also be used as nonvolatile memory. 

 

When the area is used as nonvolatile memory, the contents of the area are 
retained even after the power is turned off. So, special attention should be paid 
not to cause an unpredictable operation when the power is turned on next time. 

 

Creating a Ladder Program 

DI/DO data and status data allocated to a PMC area are processed by a ladder program. 
The following provides notes on creating a ladder program required to construct a safety system. 
 

  CAUTION 

1  The time after the power is turned on until communication is actually started may 

vary depending on the system configuration of the CNC and the state of the 
communication partner device. 

 

If it is necessary to strictly determine whether communication starts, it is not 
sufficient to determine it with time and status data only. Determine it with a 
method such as checking with actual DI data. 

2  Create a ladder program in such a way that the system will be operated safely 

even if a communication error occurs. 

 

B-64693EN-1/01

 

 

17. EMBEDDED ETHERNET FUNCTION

 

- 2735 - 

Input signal (DI) and output signal (DO) 

An output signal from the CNC is written by the ladder program into the PMC data area.  The 
reading/writing process of a communication function reads the signal and sends it to the Ethernet network. 
An input signal also flows a similar route in the opposite direction. 
 

 

ラダープログラム

 

処理

 

PMC

 

レジスタ

 

(メモリ)

 

DeviceNet

 

マスタ機能

 

リフレッシュ

 

処理

 

CNC

 

Ladder program 
process

 

PMC

 

PMC 
area

 

Communication 
function of 
embedded 
Ethernet

 

 

Reading/writing 
process

 

Output signal

 (DO)

 

Input signal

 (DI)

 

CNC

 

Communication 
partner device of 
embedded 
Ethernet

 

Ethernet

 

 

Fig.17.2.9.1 (b) Input signal (DI) and output signal (DO) 

 

Ladder program process and reading/writing process by a communication function 

Processing by the ladder program and the reading/writing process by a communication function operate 
asynchronously with one another. 
Processing by the ladder program can operate independently of reading/writing process by a 
communication function, so the ladder program can be repeatedly executed at high-speed. 
 
The following figure shows a time chart of the internal operation of the CNC with signals output from the 
ladder program. 

 

 

 

 

 

 

 

Reading/writing process of Industrial 
Ethernet communication function

 

1 1

 

2 2

 

3 3

 

 

 

 

 

 

 

2 1

 

Content of data area A:

 

Content of data area B:

 

 

(mth)

 

(m+1)th

 

(m+2)th

 

(nth)

 

1,1

 

2,2

 

3,3

 

Ladder program process:

 

(n+1)th

 

(n+2)th

 

(n+3)th

 

Transferred to the communication partner device of Industrial Ethernet

 

 

 

 

 

 

 

2,1

 

 

 

 

 

 

 

 

 

Fig.17.2.9.1 (c) Time chart 

 

17. EMBEDDED ETHERNET FUNCTION

 

 

B-64693EN-1/01

 

- 2736 - 

The upper part of the figure indicates that processing by the ladder program is performed periodically and 
writing to data area A or data area B is performed in the ladder program. 
 
The middle part indicates how data area A and data area B in the PMC are updated in this case. There are 
differences in the timing in which data is written to data area A or data area B even in the same execution 
cycle of the ladder program, so data area A and data area B are not updated at the same time. 
 
The lower part indicates that the reading/writing process by communication functions is cyclically made 
to read data in data area A and data area B. Since data area A and data area B are not updated at the same 
time, for example, in the case of (n+1)th  refreshing, the data written by one execution of the ladder 
program cannot be read as one set. 
 
Conversely, when input signals from communication functions are processed in the ladder program, the 
data written by one execution of writing may not be read by one execution of the ladder program. 
 

  CAUTION 

 

Reading/writing process by a communication function is made asynchronously 
with the execution of the ladder program. Therefore, keep the following in mind 
when creating a ladder program. 
<1>  When an input signal from the communication function to be written in the 

specified PMC address is read from two points in the ladder program, even 
if the ladder program can be executed in one cycle, there is no guarantee 
that the same value can be read. 

<2>  When the ladder program writes an output signal to the communication 

partner device in the specified PMC address, the signal may be transferred 
to the communication partner device before the ladder program is 
completely executed. 

 

Unit of Data and Concurrency 

The unit of I/O data can be word (2-bytes) only. 
The concurrency of word (2-byte) data is  guaranteed, and there will never be data segmentation. The 
concurrency of long (4-byte) data cannot be guaranteed. 
 

  WARNING 

 

If the data bigger than word (2-byte) data is used, data segmentation might 
occur. 

 

If word (2-byte) data is used, refer to “Creating a Ladder Program” for notes on 
creating a ladder program. 

 

If data segmentation occurs, the machine may behave unexpectedly, possibly 
damaging the tool, the machine itself, the workpiece, or causing injury to the 
user. 

 
To guarantee the concurrency of data, satisfy the following two conditions. 
<1>  In the ladder program, the following commands are used in units of two bytes. 

MOVW, MOVN, XMOVB, SETNW, XCHGW, DSCHB, TBLRW, TBLWW, DSEQW, DSNEW, 
DSGTW, DSLTW, DSGEW, DSLEW, DMAXW, DMINW, EQW, NEW, GTW, LTW, GEW, 
LEW, RNGW, COMPB, EOR, AND, OR, NOT, EORW, ANDW, ORW, NOTW, SHLW, SHRW, 
ROLW, RORW, BSETW, BRSTW, BTSTW, BPOSW, BCNTW, CODB, DCNVB, DECB, 
TBCDW, FBCDW, ADDB, SUBB, MULB, DIVB, NUMEB, ADDSW, SUBSW, MULSW, 
DIVSW, MODSW, INCSW, DECSW, ABSSW, NEGSW 

B-64693EN-1/01

 

 

17. EMBEDDED ETHERNET FUNCTION

 

- 2737 - 

<2>  When DI data or DO data is assigned to at the setting screen of a communication function, the value 

of items "ADDRESS" and "SIZE" are aligned with 2-byte boundaries. 
Example) ADDRESS/SIZE  1:R0000/2, 2:R0002/4, 3:R0004/6, 1:E0002/8 

 

Conversion of Endian 

The byte arrangement in the Modbus area (Holding Registers) is little endian to make it easy for the 
ladder program to handle it. 
With the appropriate setting item on the setting screen of the Modbus/TCP Server function, the byte 
arrangement can be changed to big endian. 
 

  WARNING 

 

Confirm that an appropriate value is set to the setting item of selecting the 
conversion of endian, and that the byte arrangement of the exchanged data is 
correct. 
If the machine is operated without confirmation of above explanation, the 
machine may behave unexpectedly, possibly damaging the tool, the machine 
itself, the workpiece, or causing injury to the user. 

 

Little endian 

 

Modbus area 

(Holding Registers)

 

PMC area

 

On the Ethernet line 

+00

 

12h

 

34h

 

56h

 

78h

 

+01

 

0                     15

 

 

12h

 

34h

 

56h

 

78h

 

0                     15

 

 

+00

 

+01

 

7         0

 

              

 

56h

 

12h

 

78h

 

34h

 

+00

 

+01

 

+02

 

+03

 

 

Fig.17.2.9.1 (d) Little endian 

 

When Bit0 of OPTION1 is "1", byte arrangement of data becomes a big endian. 

 

Big endian 

 

Modbus area 

(Holding Registers)

 

PMC area

 

On Ethernet line 

+00

 

12h

 

34h

 

56h

 

78h

 

+01

 

0                     15

 

 

12h

 

34h

 

56h

 

78h

 

0                     15

 

 

+00

 

+01

 

7         0

 

              

 

56h

 

12h

 

78h

 

34h

 

+00

 

+01

 

+02

 

+03

 

 

Fig.17.2.9.1 (e) Big endian 

 

 

 

 

 

 

 

 

Content      ..     345      346      347      348     ..