DIGITAL CONTROLLER
COMMUNICATION
FUNCTIONS (MODBUS)
TYPE: PXH
INP-TN514207-E
Note: Windows® is the registered trade mark of Microsoft Corporation.
Note: Visual Basic® is the registered trade mark of Microsoft Corporation.
Note: MODBUS® is the registered trade mark of Gould Modicon.
z Exemption items from responsibility
The contents of this document may be changed in the future without prior notice.
We paid the utmost care for the accuracy of the contents. However, we are not liable for direct
and indirect damages resulting from incorrect descriptions, omission of information, and use of
information in this document.
Notice
CONTENTS
CONTENTS....................................................................................................................... i
1. COMMUNICATION FUNCTIONS ......................................................................................1
▪ Via RS-485 interface and PC loader interface, PXH provides communication functions of transmit-
ting and receiving data to and from host computer, programmable controller, graphic panel, etc.
▪ The communication system consists of master station and slave stations. For RS-485 communica-
tion, up to 31 slave stations (PXHs) can be connected per master station.
Note that, because the master station can communicate with only one slave station at a time, a party
to communicate with must be specified by the "Station No." set at each slave station.
For loader communication, one slave station (PXH) can be connected per master station.
▪ In order that the master station and slave station can communicate, the format of the trans-
mit/receive data must coincide. For the PXH, the format of the communication data is determined
by the MODBUS protocol.
▪ Please use an RS-232C ⇔ RS-485 converter in case of designating a personal computer or other
devices which have an RS-232C interface as a master station.
[RS-232C ⇔ RS-485 converter] (recommended article)
Type: RC-77 (isolated type)/ RA SYSTEMS make http://www.ras.co.jp
Type: K3SC-10 (isolated type)/ OMRON make http://www.omron.co.jp
RS-232C communication with PC is available upon connecting Type: ZZPPXH1*TK4H4563 to PC
loader interface where PXH is provided in standard.
Programmable
controller
RS-485
RS-232C
RS-485
Personal
computer
RS-232C
D-sub9 pin
RS-232C
RS-485 communication converter
Caution:
When using the RS-232C ⇔ RS-485 converter, pay attention to cable connection between the con-
verter and master station. If the cable is not connected correctly, the master station and slave station
cannot communicate. In addition, be careful about communication settings such as baud rate and
parity set for the converter.
For avoiding electric shock and malfunctions, do not turn on the power supply until all wiring is
completed.
3.1 Communication Terminal Allocation
■ PXH9 (RS-485)
Terminal number (14) (15) (16)
Signal name
■ PXH9 (PC loader interface)
PC loader interface
RS485
+
SG
RS485
–
Φ2.5, 3-pole miniature jack
INP-TN514207-E
3
3.2 Wiring
■ RS-485
▪ Use twisted pair cables with shield. Recommended: KPEV-SB (Furukawa Electric make)
▪ The total extension length of the cable is up to 500 m. A master station and up to 31 units of the
PXH can be connected per line.
▪ Both ends of the cable should be terminated with terminating resistors 100Ω (1/2W or more).
▪ If the PXH is to be installed where the level of noise applied to the PXH may exceed 1000 V, it is
recommended to install a noise filter in the master station side as below.
Recommended noise filter: ZRAC2203-11 (TDK make)
▪ If problematic in EMC at communication, loading the communication cable with ferrite can lower
the noise level.
Recommended ferrite core: ZCAT series (TDK make)
MSFC series (Morimiya Electric make)
Master station
(PC, etc.)
RS-232C⇔RS-485
Master station side
Twisted pair cable with shield
+
SG
RS-485 interface
or
RS-485 side of the RS-232C RS-485 converter
Terminating resistor
100Ω (1/2W)
Noise filter PXH
Transmission
cable
Slave (PXH)
+
SG
Slave (PXH)
+
SG
Slave (PXH)
▪ SG connection is not mandatory, but is
+
effective for remedying communication
errors attributable to noises.
Terminating
resistor
100Ω (1/2W)
SG
INP-TN514207-E
4
■ PC loader communication
▪ Use an optional PC loader communication cable (RS-232C).
PC loader communication cable
Master station side
(RS232C)
ZZPPXH1 TK4H4563
*
PC or the like
RS232C
D-Sub 9 pins
Bottom of PXH
INP-TN514207-E
5
4. SETTING OF COMMUNICATION CONDITION
In order that the master station and instrument (PXH) can correctly communicate, following settings are required.
▪ All communication condition settings of the master station and those of instruments (PXH) are indentical.
▪ For RS-485 communication, different "station numbers (STN4)" are assigned to all PXHs which are con-
nected to a common line. (Any "Station No." is not shared by more than one instrument.)
▪ For PC loader communication, the station No. is fixed at "1".
Both for PC loader communication and RS-485 communication, same station No. "1" may be assigned.
4.1 Setting items
The parameters to be set are shown in the following table. Set them by operating the front panel
keys.
■ RS-485
CH B COM
Parameter
symbol
SPD4
――― Data length 8 bits Fixed (can not be changed)
――― Stop bit 1 bit Fixed (can not be changed)
BIT4 Parity setting odd
STN4 Station No. 1
■ PC loader communication
CH B COM
Parameter
symbol
SPD2
――― Data length 8 bits Fixed (can not be changed)
――― Stop bit 1 bit Fixed (can not be changed)
BIT2 Parity setting odd
―――Station No. 1 Fixed (can not be changed)
Item
Transmission
speed
Item
Transmission
speed
Value at
delivery
38400bps
Value at
delivery
38400bps
Setting range Remarks
96 : 9600bps
192 : 19200bps
384 : 38400bps
8n : none parity
8o : odd parity
8E : even parity
0 to 255
(0: communication function stop)
Setting range Remarks
96 : 9600bps
192 : 19200bps
384 : 38400bps
8n : none parity
8o : odd parity
8E : even parity
Set the same
communication
condition to
the master station
and all slave
stations.
Set a different
number to each
station.
Set the same
conditions as
the master station.
INP-TN514207-E
6
4.2 Setting Operation Method
The following example shows how to set the communication conditions.
Example: For RS-485, set BIT4 parity at even and STN4 at 18.
Key
operation
SEL
∨
SEL
SEL
>∧∨
SEL
∨
SEL
Indication Description
200
LP01SV
200
PS1
0000
b COM
Ch
b. STN4
02 1
b. STN4
02 00001
b. STN4
02 00018
b. STN4
02 18
b. BIT4
04 8o
b. BIT4
04 8o
Operation status (PV/SV indication) or (PV/MV indication)
Press the SEL key to display PS1.
Press the ∨ key repeatedly until b.COM channel appears. (If
past over, press the ∧ key to return.)
Press the SEL key to display STN4 parameter.
Press the SEL key. The numeric value on the lower
indicator blinks and the setting mode is selected.
Press the >, ∧, or ∨ key to change the numeric value to 18.
Press the SEL key again. The numeric value stops blinking
and the setting is registered.
Press the ∨ key to display the BIT4 parameter.
Press the SEL key. The numeric value on the lower
indicator blinks and the setting mode is selected.
∧∨
SEL
DISP
DISP
b. BIT4
04 8E
b. BIT4
04 8E
b COM
Ch
LP01SV
200
200
Press the ∧ or ∨ key until the numeric value changes to 8E
(even parity).
Press the SEL key again. The numeric value stops blinking
and the setting is registered.
Press the DISP key to resume b.COM channel indication.
Press the DISP key to resume the operation status (PV/SV
indication).
* Be sure to turn off and on power so that the communication condition settings will affect the control.
INP-TN514207-E
7
5. MODBUS COMMUNICATION PROTOCOL
5.1 Outline
The communication system by the MODBUS protocol is that the communication always starts from
the master station and a slave station responds to the received message.
Transmission procedures is as shown below.
1) The master station sends a command message to a slave station.
2) The slave station checks that the station No. in the received message matches with the own station No.
or not.
3) If matched, the slave station executes the command and sends back the response message.
4) If mismatched, the slave station leaves the command message and wait for the next command
message.
a) In case when the station No. in the received command message matches with the own slave
station No.
Master to slave
Slave to master
b) In case when the station No. in the received command message mismatches with the own
slave station No.
Master to slave
Slave to master
The master station can individually communicate with any one of slave stations connected on the
same line upon setting the station No. in the command message.
Command message
Command message
Response message
(Not respond)
Data on
the line
Data on
the line
INP-TN514207-E
8
5.2 Composition of Message
Command message and response message consist of 4 fields; Station No., Function code, Data and
Error check code. And these are sent in the following order.
Station No. (1 byte)
Function code (1 byte)
Data (2 to 69 bytes)
Error check code (CRC-16) (2 bytes)
Fig. 5-1 Composition of message
In the following, each field is explained.
(1) Station No
Station No. is the number specifying a slave station. For RS-485 communication, the command
is processed only by the slave station whose station No. matches with the No. set in the parameter "STN4".
For details of setting the parameter "STN4", refer to chapter 4.
For PC loader communication, the station No. is fixed at "1".
(2) Function code
This is a code to designate the function executed at a slave station.
For details, refer to section 5.4.
(3) Data
Data are the data required for executing function codes. The composition of data varies with
function codes. For details, refer to chapter 6.
A register number is assigned to each data in the indicating controller. For using the data by
communication, designate the register number.
Note that the register number transmitted on message is expressed as its relative address.
The relative address is calculated by the following expression.
Relateve address
The lower 4 digits of the
=
Register number
– 1
For example, when the resister number designated by a function code is 40003,
Relative address = (lower 4 digits of 40003) – 1
= 0002
is used on the message.
INP-TN514207-E
9
(4) Error check code
This is the code to detect message errors (change in bit) in the signal transmission.
On the MODBUS protocol (RTU mode), CRC-16 (Cycric Redundancy Check) is applied.
For CRC calculation method, refer to section 5.5.
INP-TN514207-E
10
5.3 Response of Slave Station
(1) Response for normal command
To a relevant message, the slave station creates and sends back a response message which corre-
sponds to the command message. The composition of message in this case is the same as in
section 5.2.
Contents of the data field depend on the function code. For details, refer to Chapter 6.
(2) Response for abnormal command
If contents of a command message have an abnormality (for example, non-actual function code is
designated) other than transmission error, the slave station does not execute that command but
creates and sends back a response message at error detection.
The composition of response message at error detection is as shown in Fig. 5-2. The value used
for function code field is function code of command message plus 80
Table 5-1 gives error codes.
Function code + 80H
Error check(CRC-16)
Station No.
Error code
.
H
Error code Contents Description
01H Illegal function codeNon-actual function code is designated.
02H Illegal data address A relative address of resister number to which the
03H Illegal data value Because the designation of number is too much,
(3) No response
Under any of the following items, the slave station takes no action of the command message and
sends back no response.
▪ A station number transmitted in the command message differs from the station number speci-
▪ A error check code is not matched, or a transmission error (parity error, etc.) is detected.
▪ The time interval between the composition data of the message becomes longer than the time
▪ Station No. of a slave station is set as 0.
▪ A write-in command is sent while executing FIX.
Fig. 5-2 Response message at error detection
Table 5-1 Error Code
Check for the function code.
designated function code can not be used.
the area where resister numbers do not exist is designated.
fied to the slave station.
corresponding to 24 bits. (Refer to section 5.6 Transmission Control Procedure.)
INP-TN514207-E
11
5.4 Function Code
According to MODBUS protocol, register numbers are assigned by function codes.
Each function code acts on specific register number.
This correspondence is shown in Table 5-2, and the message length by function is shown in Table 5-3.
Table 5-2 Correspondence between function codes and objective address
Function code Resister No.
No. Function Object No. Contents
03H
04H
06H Write-in Holding register4xxxxRead-out/write-in word data
10H
Read-out
(continuously)
Read-out
(continuously)
Write-in
(continuously)
Holding register4xxxxRead-out/write-in word data
Input register 3xxxxRead-out word data
Holding register4xxxxRead-out/write-in word data
Table 5-3 Function code and message length
Function
code
03H Read-out of word data 32 words 887 69
04H
*1
06H Write-in of word data 1 word 888 8
10H
*1) For PXH, all data is designated by 2 words.
Read-out of word data
(read-out only)
Write-in of continuous
word data
(write-in of word data) is used, only 1 lower word can be written in, and only 1 upper word
If 06
H
cannot.
Contents
Number of
designatable
data
15 words 887 35
32 words 11738 8
[Unit:byte]
Command message Response message
Minimum Maximum Minimum Maximum
INP-TN514207-E
12
Loading...
+ 32 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.