CP-series Function Block Practices Guide
CP-series Function Block Practices Guide
Practices Guide
1
About Intellectual Property Right and Trademarks
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Windows is a registered trademark of Microsoft Corporation in the USA and other countries.
Company names and product names in this guide are the trademarks or registered trademarks
of their respective companies.
2
■ Introduction
This guide describes examples of using function blocks.
Omron does NOT warrant that the function blocks work properly at all times in actual programs and
machines. Please obtain the user’s manuals of the used devices and be sure to understand the important
precautions and reminders described on the manuals before attempting to start operation.
■ Intended Audience
This guide is intended for the following personnel, who must also have knowledge of electrical systems (an
electrical engineer or the equivalent).
• Personnel in charge of installing FA systems
• Personnel in charge of designing FA systems
• Personnel in charge of managing FA systems and facilities
■ Related Manuals
Cat. No. Model Manual name
W613 CP2E-E□□D□-□ CP Series CP2E CPU Unit Hardware User’s Manual
(CP2E) CP2E-S□□D□-□
CP2E-N□□D□-□
W614 CP2E-E□□D□-□ CP Series CP2E CPU Unit Software User’s Manual
(CP2E) CP2E-S□□D□-□
CP2E-N□□D□-□
W483 CP1E-E□□D□-□ CP Series CP1E/CP2E CPU Unit
(CP1E/CP2E) CP1E-N□□D□-□ Instructions Reference Manual
CP2E-E□□D□-□
CP2E-S□□D□-□
CP2E-N□□D□-□
W446 CXONE-AL□□D-V4 CX-Programmer Ver.9.□
Operation Manual
3
Practices Guide
4
1. Modbus RTU Master Function Block
The Modbus RTU Master Function Block sends the Modbus RTU commands using the serial port.
NB Series CP2E-N/CP2E-S
Inverter RUN/stop,
frequency
setting/monitoring,
etc. Modbus RTU slave
(e.g., inverter)
This function block sends and receives up to 32 Modbus RTU commands through a port automatically and
sequentially when the boot flags are turned ON after addresses and data are set.
Frequency monitor
1 (Node 1)
ON Sends and receives commands sequentially
2 Frequency monitor
(Node 2) 1 2 3
ON
3 Frequency monitor
(Node 3)
ON
Up to 32
When the boot flags are turned ON simultaneously, Modbus RTU commands are sent and received sequentially.
<Previously>
Commands and data were set in the DM allocation area for the Modbus-RTU Easy Master function of the
CP2E CPU Unit to send and receive Modbus RTU commands through the serial port. The user had to create
sequence programs to send and receive multiple commands sequentially because the CP2E CPU Unit could
send or receive only one command per port.
5
1.2 Function Blocks to Use
The Modbus RTU Master Function Blocks send the Modbus RTU commands via the serial port. A function
block for each command and each serial port are available. For details on the function blocks, refer to
Description of Functions.
Function blocks
Function Command Function Serial port Function block name
code name
01 Hex Read Read multiple Port 1/built-in RS-232C _CP2E030_SendModRTU_F01_P1
Coils coils Port 2/built-in RS-485 _CP2E030_SendModRTU_F01_P2
Port 1 (EX) _CP2E030_SendModRTU_F01_P1EX
03 Hex Read Read multiple Port 1/built-in RS-232C _CP2E030_SendModRTU_F03_P1
Holding holding Port 2/built-in RS-485 _CP2E030_SendModRTU_F03_P2
Registers registers Port 1 (EX) _CP2E030_SendModRTU_F03_P1EX
05 Hex Write Write a single Port 1/built-in RS-232C _CP2E030_SendModRTU_F05_P1
Single Coil coil Port 2/built-in RS-485 _CP2E030_SendModRTU_F05_P2
Port 1 (EX) _CP2E030_SendModRTU_F05_P1EX
06 Hex Read Write a single Port 1/built-in RS-232C _CP2E030_SendModRTU_F06_P1
Single holding Port 2/built-in RS-485 _CP2E030_SendModRTU_F06_P2
Register register Port 1 (EX) _CP2E030_SendModRTU_F06_P1EX
10 Hex Write Write multiple Port 1/built-in RS-232C _CP2E030_SendModRTU_F10_P1
Multiple holding Port 2/built-in RS-485 _CP2E030_SendModRTU_F10_P2
Registers registers Port 1 (EX) _CP2E030_SendModRTU_F10_P1EX
Serial port name
CP2E-E type CP2E-S type
6
■ Function01: Read Coils (_CP2E030_SendModRTU_F01_P□)
P_On
_CP2E030_SendModRTU_F01_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL) FB busy flag
Boot flag Execute 起動トリガ
FB_BUSY
(UINT) (BOOL) FB normal end
Modbus slave address SlaveAddr Modbus スレーブアドレス FB_OK
(UINT) (BOOL)
Coil starting address コイル開始アドレス FB error end
ReadCoilAddr FB_NG
(UINT) (WORD)
Quantity of coils コイル数 Modbus error code
ReadCoilSize ErrorCode
(WORD)
Area of read data RecvAreaID 読出データ格納 CH 種別
(UINT)
Word of read data RecvAreaNo 読出データ格納 CH 番号
P_On
_CP2E030_SendModRTU_F03_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL) FB busy flag
Boot flag Execute 起動トリガ
FB_BUSY
(UINT) (BOOL) FB normal end
Modbus slave address SlaveAddr Modbus スレーブアドレス FB_OK
(UINT) (BOOL)
FB error end
Register starting address ReadRegAddr レジスタ開始アドレス FB_NG
(UINT) (WORD)
Quantity of register レジスタ数 Modbus error code
ReadRegSize ErrorCode
(WORD)
Area of read data RecvAreaID 読出データ格納 CH 種別
(UINT)
First word of read data 読出データ格納先頭 CH 番号
RecvAreaNo
7
■ Function10: Write Multiple Registers (_CP2E030_SendModRTU_F10_P□)
P_On
_CP2E030_SendModRTU_F10_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
(UINT) (BOOL)
Register starting address WriteRegAddr FB_NG FB error end
(UINT) (WORD)
Quantity of register WriteRegSize ErrorCode Modbus error code
(WORD)
Area of write data SendAreaID
(UINT)
First word at erite data SendAreaNo
2. Operating Procedure
Exchange data with an inverter using Modbus RTU via the serial port of the CP2E CPU Unit.
Wiring Connect the CP2E CPU Unit and an RTU slave using
a communication cable.
8
3. Programming Examples
The CP2E-S CPU Unit controls the 3G3MX2-V1 Inverter connected to the RS-485 port.
While always monitoring the frequency of the inverter, the CP2E-S CPU Unit changes the frequency and
operates and stops the inverter.
Modbus-RTU master
CP2E-S□□-type CPU Unit
3G3MX2-V1 Inverter
Built-in RS-485 port Slave address: 3
Output Frequency Reference Output Frequency Monitor
RUN Command
9
The following I/O memory is used:
I/O memory Description Set value Remarks
D100 Value of Output Frequency Reference Setting &6000
D110 Value of Output Frequency Monitor -
3.2 Setting
■ PLC Settings for CP2E-S CPU Unit
(1) Serial Port Setting
Start the CX-Programmer.
Select the Built-in RS-485 Port Tab in the PLC Settings.
Set the Communications Settings Field and Response Timeout Field.
Setting example
Item Description
Communications Select the Custom Option and set the baud rate to 115200 and the format to 8,1,E.
Settings * Use the same settings as the connected inverter.
Mode Select Modbus-RTU simple master.
Response Timeout Set the default value of 0 (default 5000 ms).
10
(2) Communications Setting
Select the Startup/CPU Settings Tab in the PLC Settings.
Set the retry counts to 2 in the Comms Instructions Settings in FB Field.
■ Setting 3G3MX2-V1
Set the Modbus communication parameters according to the settings of the CP2E CPU Unit.
Parameter No. Function name Data Default data Set value
A001/A201 1st/2nd Frequency 03: Modbus communication 02 03
Reference Selection
A002/A202 1st/2nd RUN Command 03: Modbus communication 02 03
Selection
C071 Communication Speed 03: 2400 bps 05 10
Selection 04: 4800 bps 115.2 kbps
05: 9600 bps
06: 19.3 kbps
07: 38.4 kbps
08: 57.6 kbps
09: 76.8 kbps
10: 115.2 kbps
C072 Communication Station No. 1 to 247 1 3
Selection
(Modbus slave address)
C074 Communication Parity 00: No parity 00 01
Selection 01: Even parity Even parity
02: Odd parity
C075 Communication Stop Bit 1: 1 bit 1 1
Selection 2: 2 bits 1 bit
11
Parameter No. Function name Data Default data Set value
C076 Operation Selection on 00: Trip 02 02
Communication Error 01: Trip after deceleration stop Ignore
02: Ignore
03: Free-run stop
04: Deceleration stop
C077 Communication Error 0.00: Timeout disabled 0.00 0.00
Timeout Time 0.01 to 99.99 Disabled
C078 Communication Wait Time 0 to 1000 0 ms 0 ms
* Refer to the MX2 Series Type V1 User’s Manual (Cat. No. I585) for settings.
12
(2) Ladder Programming for Frequency Reference Setting
Create a program to send the output frequency reference to the 3G3MX2-V1 Inverter when W1.00 is turned
ON.
Boot flag
・ When frequency reference bit (W1.00) is turned ON, Boot flag (W1.05) is turned ON and the function block
sends a command to write the value in output frequency (D100) to the Modbus register 0001 Hex in the
inverter with the slave address 3.
(When output frequency is 60.00 HZ, set D100 to &6000.)
・ FB_BUSY (W1.01) is ON during waiting for sending or during sending.
・ When sending is completed, FB_OK (W1.02) is turned ON and Boot flag (W1.05) is turned OFF.
13
(3) Ladder Programming for Starting and Stopping Operation
Create a program to start operation when W0.00 is turned ON and to stop operation when W0.00 is turned
OFF.
Boot flag
Boot flag
・ When RUN start bit (W0.00) is turned ON, Boot flag (W0.05) is turned ON and the function block sends a
command to write #FF00 (1: RUN) to the Modbus coil 0000 Hex in the inverter with the slave address 3.
14
・ When RUN start bit (W0.00) is turned OFF, Boot flag (W0.12) is turned ON and the function block sends a
command to write #0000 (0: Stop) to the Modbus coil 0000 Hex in the inverter with the slave address 3.
・ Give each FB instance a different name.
・ The error code is stored in D121,D122 if the function block ends in an error.
Boot flag
Quantity of registers: 1
・ When Boot flag (W2.00) is turned ON, the function block reads data from the Modbus register 1001 Hex in
the inverter with the slave address 3 and write the data to D110. (When the output frequency is 60.00 Hz,
&6000 is written.)
・ When Boot flag (W2.00) is turned ON, reading stops.
・ The error code is stored in D123 if the function block ends in an error.
15
Reference: difference allocation Modbus-RTU Easy Master Function and Function Block
■ Memory allocation of Modbus-RTU Easy Master function
15 07 00
D1300 - - Slave address A641.00 Execution Bit
D1301 - - Function code A641.01 Execution Normal Flag
D1302 No. of communications data bytes A641.02 Execution Error Flag
D1303
.
Communications data
. (Coil address, register
.
address, data, etc.)
P_On
_CP2E030_SendModRTU_F10_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL) FB busy flag
Boot flag Execute FB_BUSY
(UINT) (BOOL) FB normal end
Modbus slave address SlaveAddr FB_OK
(UINT) (BOOL)
Register starting address FB error end
WriteRegAddr FB_NG
(UINT) (WORD)
Quantity of registers Modbus error code
WriteRegSize ErrorCode
(WORD)
Area of write data SendAreaID
(UINT)
First word at write data SendAreaNo
16
■ Practices Guide - Revision History
Revision code Date Revised content
A November 2019 Original production
17
Description of Functions
18
CP2E
030 Modbus RTU master: _CP2E030_SendModRTU
Basic Send Modbus RTU command from serial communication port.
function
Symbol ◼Function01: Read Coils
P_On
_CP2E030_SendModRTU_F01_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
(UINT) (BOOL)
Coil starting address FB error end
ReadCoilAddr FB_NG
(UINT) (WORD)
Quantity of coils Modbus error code
ReadCoilSize ErrorCode
(WORD)
Area of read data
RecvAreaID
(UINT)
Word of read data
RecvAreaNo
19
Symbol ◼Function10:Write Multiple Registers
P_On
_CP2E030_SendModRTU_F10_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
(UINT) (BOOL)
Register starting address FB error end
WriteRegAddr FB_NG
(UINT) (WORD)
Quantity of register Modbus error code
WriteRegSize ErrorCode
(WORD)
Area of write data
SendAreaID
(UINT)
First word at write data
SendAreaNo
File name ◼Built-in RS-232C port for CP2E-S/E / Serial port1 for CP2E-N
_CP2E030_SendModRtu_F01_P1.cxf : Function 01 (Read Coils)
_CP2E030_SendModRtu_F03_P1.cxf : Function 03 (Read Holding Registers)
_CP2E030_SendModRtu_F05_P1.cxf : Function 05 (Write Single Coil)
_CP2E030_SendModRtu_F06_P1.cxf : Function 06 (Write Single Register)
_CP2E030_SendModRtu_F10_P1.cxf : Function 10 (Write Multiple Registers)
20
Function ◼Function block operation
description ・ When Boot flag (Execute) is turned ON, send the Modbus RTU command to Modbus RTU slave
specified by Modbus slave address (SlaveAddr).
・ Send processing will be repeated during Boot flag (Execute) is ON.
・ Send processing will be stopped during Boot flag (Execute) is OFF.
・ Read data specified by Coil/Register starting address (ReadCoilAddr/ReadRegAddr) and Quantity of
Coil/Register (ReadCoilSize/ReadRegSize) from Modbus RTU slave when read command is sent.
・ Write data specified by Coil/Register starting address (WriteCoilAddr/WriteRegAddr) and Quantity of
Coil/Register (WriteRegSize) to Modbus RTU slave when write command is sent.
・ The send and receive data word designations are specified using the area of write/read data
(Send/RecvAreaID) and First word of write/read data (SendAreaNo/RecvAreaNo).
For example, for D1000, the area type is set to P_DM and the first word address is set to &1000.
・ If send processing is completed normally, ON is set to FB normal end (FB_OK) and “#0000” is stored in
Modbus error code (ErrorCode).
・ If the send processing produces an error, ON is set to FB error end (FB_NG) and Modbus error code will
be output to the Modbus error code (ErrorCode).
Time chart
EN (P_On) ON
OFF
Send once Send continuously
Boot flag ON
(Execute) OFF
FB busy flag ON
(FB_BUSY) OFF
FB normal end or ON
FB error end OFF
(FB_OK/FB_NG)
•Send processing will be repeated during Boot flag is ON.
FB execution completed
At FB normal end : Read or write operation is completed.
◼Instance operation
・ Serial port can be executed to send only one command. Each instance is executed in the order in which
Boot flag (Execute) is turned ON.
・ The instance that Boot flag (Execute) is OFF is not executed.
If Boot flag is turned OFF before Modbus RTU command is sent, Modbus RTU command is not sent.
Time chart : Three instances (Example)
EN (P_On) ON
OFF Command is not sent if Boot flag is
turned OFF before send command.
Instance 1
ON
Boot flag (Execute) OFF
Send command 1 1 1 1 1 1 1 1 1
Instance 2
ON
Boot flag (Execute) OFF
Send command 2 2 2 2
Instance 3
ON
Boot flag (Execute) OFF
Send command 3 3 3 3 3 3
Each instance is executed in the order Each instance is executed in the order
in which Boot flag is turned ON. in which Boot flag is turned ON.
“1”? ”2”? ”3”? ”1”・・・ “1”? ”3”? ”2”? ”1”・・・
Supported command
Function code コマンド名称 機能
01 Hex Read Coils Read multiple coils
03 Hex Read Holding Registers Read multiple holding registers
05 Hex Write Single Coil Write a single coil
06 Hex Write Single Register Write a single holding register
10 Hex Write Multiple Registers Write multiple holding registers
21
Kind of FB Connect Always ON type
definition Connect the EN input to the Always ON Flag (P_On)
・ The same instance can not be used in two or more places.
FB ・ The FB is processed over multiple cycles. The FB busy flag (FB_BUSY) output variable can be used to
precautions check whether the FB is being processed.
・ It can be set max 32 instances on each serial port.
・ This FB is used Modbus RTU Easy Master function. When using this FB, do not use Modbus RTU Easy
Master function for serial port used this FB.
・ Do not use the work area of shared resource, when this FB is used.
EN input ・ Connect the EN input to the Always ON Flag (P_On).
condition ・ If a different type of bit is connected to EN, the FB outputs will be maintained when the connected bit is
turned OFF.
Restrictions ・ Use the Always ON Flag (P_On) for EN.
Input ・ If Boot flag (Execute) is turned OFF before Modbus RTU command is sent, Modbus RTU command is
variables not sent. Set Boot flag (Execute) to turn OFF after FB normal end (FB_OK) is ON.
・ Do not turn ON EN and Boot flag (Execute) at the same time. If EN and Execute are turned ON at the
same time, linear interpolation will not be executed.
・ If the input variables are out of range, the ENO will turn OFF and the FB will not be processed.
Application Send Modbus RTU command to Modbus RTU slave.
example Sends according to the ON / OFF status of W0.00 to W0.04.
P_On Instance3
(BOOL)
EN
(BOOL)
W0.03 Execute
…
P_On Instance4
(BOOL)
EN
(BOOL)
W0.04 Execute
…
22
◼ Variable Tables
Input Variables
Area of read data RecvAreaID WORD #00B1 - P_WR (#00B1): Work Area
Area of read data RecvAreaID WORD #0082 - P_DM (#0082): Data Memory Area
Area of write data SendAreaID WORD #0082 - P_DM (#0082): Data Memory Area
23
Function10: Write Multiple Registers
Name Variable name Data type Default Range Description
EN EN BOOL 1 (ON): FB started.
0 (OFF): FB not started.
Boot flag Execute BOOL 1 (ON): start to send Modbus command
0 (OFF): stop to send Modbus command
Modbus slave SlaveAddr UINT &1 &1 to &31
address
Register starting WriteCoilAddr UINT &0 &0 to &65535
address
Quantity of register WriteRegSize UINT &1 &1 to &20 Write registers : max 20 word
Area of write data SendAreaID WORD #0082 - P_DM (#0082): Data Memory Area
Output Variables
Name Variable name Data type Range Description
ENO ENO BOOL 1 (ON): FB processed normally.
0 (OFF): FB not processed or ended in an error.
FB Busy Flag FB_BUSY BOOL Automatically turns OFF when processing is completed.
FB Normal end FB_OK BOOL Turns ON for one cycle when processing ends normally.
Error end FB_NG BOOL Turns ON for one cycle when processing ends in an
error.
Error code ErrorCode DWORD Outputs the Modbus error code when execution ends in
an error.
When ErrorCode is 0088 Hex, Exception code will be set
to ErrorCode+1.
24
Detail of Modbus command
◼Function 01 Read Coils: Read to Work Aera (W) from Multiple coils.
Request
Field name Data length Data or Input variable name
Slave address 1 byte SlaveAddr
Function code 1 byte 01 Hex
Coil starting 2 bytes ReadCoilAddr
address 0 to FFFF Hex (&0 to &65535)
Quantity of coils 2 bytes ReadCoilSize
0 to 10 Hex (&0 to &16)
Response
Field name Data length Data or variable input name
Slave address 1 byte Same as SlaveAddr
Function code 1 byte 01 Hex
Byte count 1 byte 1 or 2 Hex
Coil status 1 or 2 bytes Work area (W) specified with Area of read data
(RecvAreaID), Word of read data (RecvAreaNo).
Example: Area of read data: P_WR
Word of read data: &10
Read to W10CH
* : Response data except for Coil status is not confirmed on FB.
Example: Read 10 bit (10 10001010 =28A Hex) to W10 from Coil starting address 4 (0004 Hex) on slave address 2.
P_On
_CP2E030_SendModRTU_F01_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
&2
(UINT) (BOOL)
Coil starting address FB error end
ReadCoilAddr FB_NG
&4
(UINT) (WORD)
Quantity of coils Modbus error code
ReadCoilSize ErrorCode
&10
(WORD)
Area of read data
RecvAreaID
P_WR
(UINT)
Word of read data
RecvAreaNo
&10
Modbus slave 2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
(1) (0) (1) (0) (0) (0) (1) (0) (1) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
* : The subscript numbers in the shaded boxes indicate the coil address and ON/OFF (1/0) status.
Read
CP2E
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
W9CH - - - - - - - - - - - - - - - -
W10CH (1) (0) (0) (0) (1) (0) (1) (0) - - - - - - (1) (0)
W11CH - - - - - - - - - - - - - - - -
* : The subscript numbers in the shaded boxes indicate the ON/OFF (1/0) status.
25
◼Function 03 Read Holding Registers: Read to Data Memory Area (D) from Multiple Holding registers.
Request
Field name Data length Data or Input variable name
Slave address 1 byte SlaveAddr
Function code 1 byte 03 Hex
Register starting 2 bytes ReadRegAddr
address 0 to FFFF Hex (&0 to&65535)
Quantity of register 2 bytes ReadRegSize
1 to 0014 Hex (&1 to&20)
Response
Field name Data length Data or Input variable name
Slave address 1 byte Same as SlaveAddr
Function code 1 byte 01 Hex
Byte count 1 byte 2×N (N:Quantity of register)
Read register data 2×N bytes Data memory area (D) specified with Area of read data
(RecvAreaID), Word of read data (RecvAreaNo).
Example: Area of read data: P_DM
Word of read data: &1000
Read from D1000
* : Response data except for Read register data status is not confirmed on FB.
Example: Read 3 words (AB12, 5678, 9713 Hex) to D1000, D1001 and D1002 from Register starting address 100 (0064 Hex)
on slave address 2.
P_On
_CP2E030_SendModRTU_F01_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
&2
(UINT) (BOOL)
Coil starting address FB error end
ReadCoilAddr FB_NG
&100
(UINT) (WORD)
Quantity of coils Modbus error code
ReadCoilSize ErrorCode
&3
(WORD)
Area of read data
RecvAreaID
P_DM
(UINT)
Word of read data
RecvAreaNo
&1000
Modbus slave 2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
100 A B 1 2
101 5 6 7 8
102 9 7 1 3
Read
CP2E
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D1000 A B 1 2
D1001 5 6 7 8
D1002 9 7 1 3
26
◼Function 05 Write Single Coil: Write Single coil
Request
Field name Data length Data or Input variable name
Slave address 1 byte SlaveAddr
Function code 1 byte 05 Hex
Output Coil address 2 bytes WriteCoilAddr
0 to FFFF Hex (0 to &65535)
Output value 2 bytes ON(1): #FF00
OFF(0): #0000
Response
Field name Data length Data or Input variable name
Slave address 1 byte Same as SlaveAddr
Function code 1 byte 05 Hex
Output Coil address 2 bytes WriteCoilAddr
0 to FFFF Hex (0 to &65535)
Output value 2 bytes ON(1): FF00 Hex
OFF(0): 0000 Hex
* : Response data except for Coil status is not confirmed on FB.
P_On
_CP2E030_SendModRTU_F05_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
&2
(UINT) (BOOL)
Output coil address FB error end
WriteCoilAddr FB_NG
&10
(WORD) (WORD)
Output value Modbus error code
OutputValue ErrorCode
#FF00
CP2E
Output Coil address: &10, Write data: FF00 Hex (ON)
Write
Modbus slave 2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0→1
27
◼Function 06 Write Single Register: Write to single holding register from Data Memory Area (D)
Request
Field name Data length Data or Input variable name
Slave address 1 byte SlaveAddr
Function code 1 byte 06 Hex
Register address 2 bytes WriteRegAddr
0~FFFF Hex (0~&65535)
Register value 2 bytes Data memory area (D) specified with Area of read data
(RecvAreaID), Word of read data (RecvAreaNo).
Example: Area of read data: P_DM
Word of read data: &500
Write to D500
レスポンス
Field name Data length Data or Input variable name
Slave address 1 byte Same as SlaveAddr
Function code 1 byte 06 Hex
Register address 2 bytes Same as WriteRegAddr
0 to FFFF Hex (0 to &65535)
Register value 2 bytes 0000 to FFFF Hex
* : Response data except for Read register data status is not confirmed on FB.
Example: Write 1 word (3AC5 Hex) to D500 from Register address 200 on slave address 2.
P_On
_CP2E030_SendModRTU_F06_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
&2
(UINT) (BOOL)
Register address FB error end
WriteRegAddr FB_NG
&200
(WORD) (WORD)
Area of write data Modbus error code
SendAreaID ErrorCode
P_DM
(UINT)
Word of Write data
SendAreaNo
&500
CP2E
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D500 3 A C 5
D501
Write
Modbus slave 2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
200 3 A C 5
201
28
◼Function 10 Write Multiple Registers: Write to multiple holding registers from Data Memory Area (D)
Request
Field name Data length Data or Input variable name
Slave address 1 byte SlaveAddr
Function code 1 byte 10 Hex
Register starting 2 bytes WriteRegAddr
address 0 to FFFF Hex (0 to &65535)
Quantity of register 2 bytes WriteRegSize
0 to 0014 Hex (0 to &20)
Byte count 1 byte 2×N (N:Quantity of register)
Registers value 2×Byte count bytes Data memory area (D) specified with Area of read data
(RecvAreaID), Word of read data (RecvAreaNo).
Example: Area of read data: P_DM
Word of read data: &2000
Read from D1000
Response
Field name Data length Data or Input variable name
Slave address 1 byte SlaveAddr
Function code 1 byte 10 Hex
Register starting 2 bytes Same as WriteRegAddr
address
Quantity of register 2 bytes Same as WriteRegSize
* : Response data except for Read register data status is not confirmed on FB.
Example: Write 2 words of Register starting address 10 (000A Hex) from D2000,D2002 (0100, 3A98 Hex) on slave address 2.
P_On
_CP2E030_SendModRTU_F10_P□
(BOOL) (BOOL)
EN ENO
(BOOL) (BOOL)
Boot flag FB busy flag
Execute FB_BUSY
(UINT) (BOOL)
Modbus slave address FB normal end
SlaveAddr FB_OK
&2
(UINT) (BOOL)
Register starting address FB error end
WriteRegAddr FB_NG
&10
(UINT) (WORD)
Quantity of register Modbus error code
WriteRegSize ErrorCode
&2
(WORD)
Area of write data
SendAreaID
P_DM
(UINT)
First word at write data
SendAreaNo
&2000
CP2E
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D2000 0 1 0 0
D2001 0 0 5 4
Write
Modbus slave2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
10 0 1 0 0
11 0 0 5 4
29
◼ Version History
Version Date Contents
001 2019.11 New
Note
This manual is a reference that explains the function block functions.
It does not explain the operational limitations of Units, components, or combinations of Units and components. Always read
and understand the Operation Manuals for the system’s Units and other components before using them.
30