Merlin Gerin Modbus Guide
Merlin Gerin Modbus Guide
Merlin Gerin Modbus Guide
Merlin Gerin
Technical Guide
2000
Overview 3
Local Area Networks 4
Warning 5
Schneider Electric 1
2 Schneider Electric
Introduction Overview
E52410
rtie
so
E52406
cours
de se
cretariat
réunion
union
v Factory LANs
E52408
Schneider Electric 3
Introduction Local Area Networks
Local Area Networks have been standardized according to the OSI model.
Definition: OSI, Open Systems Interconnection.
This standard includes seven layers:
E52411
7 - Application 7 - Application
6 - Presentation
5 - Session
4 - Transport
3 - Network
1 - Physical 1 - Physical
4 Schneider Electric
Introduction Warning
If the recommendations in this manual are incompatible with instructions for a given
device, the device instructions should be followed. As regards EMC, safety rules
take precedence.
b Engineering and design departments, who must plan the use of communications
cables (connecting terminals, length of wiring, definition of topology,etc.)
b Those who implement Modbus, to help them install communications cables.
b Integrators, who must take communications into account in applications that
include SCHNEIDER products.
Schneider Electric 5
6 Schneider Electric
Cabling Guidelines
Review 9
Definitions and limitations 9
Protective earthing vs. grounding (equipotential bonding) 10
Power system earthing arrangements 17
EMC phenomena 19
Choice of the Physical Communication Medium 20
Various Types of Physical Media 20
Example of a choice of medium 23
Implementation guidelines 24
Sensitivity of various types of cable 24
Implementation of shielded cable 24
Cabling between two cabinets 30
Summary 35
Essential rules 35
Schneider Electric 7
8 Schneider Electric
Cabling Guidelines Review
Schneider Electric 9
Cabling Guidelines Review (continued)
10 Schneider Electric
Cabling Guidelines Review (continued)
Protective earthing
To ensure trouble-free operation of
Protection of persons
equipment and the safety of persons, all
exposed conductive parts must be
interconnected and earthed to ensure
E52273
equipotentiality.
Schneider Electric 11
Cabling Guidelines Review (continued)
Grounding
Definition: An exposed conductive part is The interconnection of all metal parts (building structures, pipes, cableways,
an accessible metal part that is isolated equipment, equipment enclosures, etc.) represents a low-impedance path for high
with respect to the live parts of the frequencies.
The resulting equipotentiality of this network of conductive parts provides effective
equipment but which may accidentally
immunity to interference by reducing all the high-frequency voltages that could
become live. otherwise exist between communicating equipment. This is true over a wide
frequency band.
Grounding satisfies the requirements concerning operation.
Exposed conductive parts ensure proper Metal parts must be interconnected (bonded) by screws, nuts and bolts or short, wide
operation of systems by providing immunity metal braids (25 mm2 cross-section and length less than 30 cm) or an equivalent
to various types of disturbances. metal part.
For high-frequencies, the best way to The impedance of PE protective conductors is too high to serve the purpose of
grounding.
guarantee trouble-free operation is to The grounding network must nevertheless be earthed.
ensure equipotentiality between the Common-mode currents
equipment. All equipment and electronic As exposed conductive parts provide a reference potential for electronic equipment
systems must therefore be bonded together and a return path for common mode currents, any current that penetrates a cable in
(or grounded). a piece of equipment insulated with respect to the exposed conductive parts exits via
the other cables.
When the equipotential bonding network is of poor quality, a cable carrying a
common mode current disturbs all the others. Effective equipotential bonding
reduces this phenomenon.
12 Schneider Electric
Cabling Guidelines Review (continued)
Schneider Electric 13
Cabling Guidelines Review (continued)
Lightning rod
E52277
Computer Meshed
room or island riser
Metal
frames
y3m y2m
Rebar
14 Schneider Electric
Cabling Guidelines Review (continued)
Shielding
E52279
isolating
transformer
Network
01
01
N
Mains
02
cable
02
03 03
Transformer
ground
Upstream LV
lightning arresters
PE
Schneider Electric 15
Cabling Guidelines Review (continued)
E52280
implementation of a ground mesh for the
whole building:
b Islands can be defined for installation of Equipment
electronic equipment. Trunking
b The cables extending outside the island
to sensors and actuators must be carefully
shielded.
Flat bar
16 Schneider Electric
Cabling Guidelines Review (continued)
E52281
Certain features of the different
arrangements must nevertheless be taken Loop capable
into account. of capturing
radiated fields
Shielding connected
at both ends
Note that overvoltages may be caused by separate earth electrodes for which the
potentials vary differently.
TN-C system
Flow of high
PEN disturbing currents
Shielding connected
at both ends
Schneider Electric 17
Cabling Guidelines Review (continued)
TN-S system
This is the best system from an EMC
viewpoint:
b Low risk of ground loop (radiated fields).
E52283
b The neutral current is not carried by the PE
protective conductor (conducted
disturbances). Shielding connected
at both ends
Care must taken to ensure equipotentiality
IT system
E52284
Loop capable
of capturing
radiated fields
Shielding connected
at both ends
18 Schneider Electric
Cabling Guidelines Review (continued)
E52285
Device 1 cables Device 2 cables
Device 3
b Cable-to-cable coupling, for instance by Disturbed (isolated) (isolated) (grounded)
cable
capacitive crosstalk (for electrical fields) or Common
inductive crosstalk (for magnetic fields). mode
current Differential
mode
voltage
Common
mode
Stray voltage
capacitance
Solutions:
b Clamp conductors against ground planes to avoid the formation of ground loops.
b Make sure all exposed conductive parts have the same potential to limit the flow
of disturbing currents.
b Separate conductors by category to reduce the effects of crosstalk.
b Do not leave any conductors unconnected to prevent antenna effects.
Schneider Electric 19
Cabling Guidelines Choice of the Physical
Communication Medium
E52289
Foil tape provided by the metal foil is
diminished by cable handling
b Coaxial cable. (tension, torsion, etc.)
E52287
Drain wire
Note: Shielded cable with a simple braid can increase protection by a factor of up to
a 100 from a few MHz up if the shielding is properly connected.
Twisted pairs with braided shielding are
recommended for all RS485 Shielded cable should be chosen when it is necessary to:
communication cables for Schneider b Limit outside interference that could affect a "sensitive" cable.
Electric products. b Keep a "polluting" conductor from interfering with nearby cables or equipment.
Note: You can also use electromagnetic waves that do not require a physical
medium.
20 Schneider Electric
Cabling Guidelines Choice of the Physical
Communication Medium (continued)
Equivalent diagram:
E52291
I
R
L
E
G
C
E = Transmitter
L = Series inductance
R = Series resistance
C = Capacitance between wires
G = Conductance (easier to calculate than parallel resistance) – represents loss in
insulation
(R+j*2* Π *f*L)
Zo = -------------------------------------
(G+j*2* Π *f*C)
f: frequency
j: symbol of the phase (+90°).
G is negligible compared to 2*π*f*C for commonly used insulating materials.
Likewise, at "low" frequencies (< 1MHz), R prevails over 2*π*f*L.
Thus the formula becomes:
R
Zo = -----------------------------
(j*2* Π *f*C)
(j*2* Π *f*L) L
Zo = ----------------
(j*2* Π *f*C)
therefore: Zo = ---
C
-
The following curve can thus be traced:
Impedance (ohms)
10,000
1000
Zo = R Zo = R+j 2 Π f L Zo = L
j2ΠfC G+j 2 Π f C C
100
50
20
10
10 100 1000 10 K 100 K 1M 10 M 100 M 1G
Frequency (Hertz))
Schneider Electric 21
Cabling Guidelines Choice of the Physical
Communication Medium (continued)
Attenuation in dB/km:
b This is the loss of signal quality in terms of amplitude.
b It depends on cable geometry.
b It varies according to frequency and length.
Temperature of use in °C
b Temperature of use should take into account:
v ambient temperature,
v how the cable was laid,
v the cable’s own heating,
v the proximity of power devices, etc.
22 Schneider Electric
Cabling Guidelines Choice of the Physical
Communication Medium (continued)
b Resistance per unit length: the application guide for standard EIA485 (TSB89)
stipulates that maximum resistance should in no case exceed 390 Ω (for the
conditions defined in this guide and at the given use temperature).
v therefore, length (in m) = 1000 x [1-(1-R/Rl)]:
R: 0.325 Ω/m
Rl: Resistance per unit length of the cable used (in Ω/m).
b Resistance per unit length: 0.213 Ω/m (at the temperature of use):
v length = 1000 x [1-(1-0.325/O.213)],
v maximum length = 1525 m.
Schneider Electric 23
Cabling Guidelines Implementation guidelines
Note: Shielded cables are not sensitive and do not generate interference.
24 Schneider Electric
Cabling Guidelines Implementation guidelines (continued)
Good Excellent
Ground bar
NO YES
Okay for very
short links
Contact
between screen
shells
Schneider Electric 25
Cabling Guidelines Implementation guidelines (continued)
Using filters
The effectiveness of a mains filter for high
Three rules must be followed when installing a filter:
frequencies depends on how well it is b Reference the filter sheetmetal to sheetmetal.
installed. b Connect the upstream and downstream cables on each side of the filter to reduce
parasitic coupling between the input and the output.
b Clamp the upstream and downstream cables against the sheetmetal to reduce
radiation from the input to the output.
E52297
No
E52298
No
E52299
Yes
26 Schneider Electric
Cabling Guidelines Implementation guidelines (continued)
Special case: Emergency Off and alarm connections should never be cabled using
point-to-point single wires; always use pairs.
d
E52300
d/R>5
Rule no. 3: b Keep relay, variable speed drive and power circuits separate from analogue, digital
Only pairs carrying analogue, digital and and telecommunications pairs.
b Use a special trunking inside cabinets for power cables.
telecommunications signals can be run
side by side in the same bundle or pulled
into the same group. Separate power cables from data cables when installing variable speed
drives.
Schneider Electric 27
Cabling Guidelines Implementation guidelines (continued)
b Separate analogue and digital signals with a row of 0 V pins if they use the same
Rule no. 4: connector.
The same connector should not be used
for different types of connections (except
for relay and power circuits).
b Protection with a factor of approximately 5 with high frequencies can be obtained
Rule no. 5: if rule number 5 is followed.
All free conductors in a cable should
systematically be connected to chassis
ground at both ends (except for analogue
cables).
b Power outputs of variable speed drives must always be shielded or filtered.
Rule no. 6:
Power cables do not need to be shielded if
they are filtered.
Recommendations:
b Use the enclosure as a Faraday shield.
b Limit the number and size of openings in enclosure panels.
b Avoid inside partitioning of enclosures, which increases electromagnetic
interference.
b Attach devices to plates made of non-insulating materials that act as grounding
planes.
b Place all equipment on a grid at the back of the cabinet.
Definition: A Faraday cage is a conducting envelope with perfectly joined walls.
Mounted with
electrical contact
(fan type washer)
28 Schneider Electric
Cabling Guidelines Implementation guidelines (continued)
Cabinets are made of various parts assembled with screws or hinges, or welded.
The many resulting openings diminish the electrical continuity.
To mask these opening, place cable entries near assembly points, or combine them
with an earth braid.
Grounding braid
E52302
Collar
YES
NO
Schneider Electric 29
Cabling Guidelines Implementation guidelines (continued)
E52303
E52304
connected all shielded cables and wire
protection systems.
Potential
reference plane Ground bar
30 Schneider Electric
Cabling Guidelines Implementation guidelines (continued)
Equipotential bonding
50 cm maximum
E52305
Use of trunking
Trunking should be used for equipotential
Trunking on the outside of cabinets must be made of metal if they are longer than
bonding. 3 m.
To guarantee proper continuity, trunking should be connected to the exposed
conductive parts of cabinets or machines using splices or leaf metal.
E52306
Schneider Electric 31
Cabling Guidelines Implementation guidelines (continued)
E52307
Power or variable
speed drive circuit
Unshielded analogue circuit
Relay circuit
Unshielded digital circuit
Shielded digital circuit
Shielded analogue circuit
Note: a metal cover over the complete trunking does not improve EMC.
is equivalent to
is equivalent to
-
Effectiveness
The theoretical EMC length is 1200 m on average, but can vary according to the type
of communications network:
b 2000 m for FIP at 1 Mbit/s and for Unitelway.
b 1000 m for Modbus Plus and for Ethway tri-axial cable at 50 W.
b 700 m for Mapway.
b 400 m for the BusX system in PREMIUM PLCs.
Likewise, when single trunking is used for power and signal cables, a coefficient
takes into account the absence of a metal separation or metal cover on the portion
of the chute used for signal cables.
32 Schneider Electric
Cabling Guidelines Implementation guidelines (continued)
Whenever one of the three conditions is not completely met, the physical length of
the trunking should be associated with a coefficient to respect EMC. Such
coefficients reflect the decrease in the protection. The resulting permissible length
of the trunking will be less than the TLC.
Protection factor = 5
E52309
Protection factor = 10
Protection factor = 5
Companion cable
Schneider Electric 33
Cabling Guidelines Implementation guidelines (continued)
Transmission of 41222 bytes at 4800 Bds. IEC test 1000-4-4. 15-pair shielded cable.
Transmission impossible
E52311
Errors Stops Length
13 110 1352 s
E52312
8 86 1225 s
E52313
0 0 160 s
E52314
0 0 160 s
E52315
E52317
E52319
E52313
E52320
0 error: 0 error:
E52314
E52321
0 error: 0 error:
E52315
E52322
E52317
34 Schneider Electric
Cabling Guidelines Summary
Essential rules
b Make sure all exposed conductive parts have the same potential..
b Choose equipment that complies with standards.
b Follow manufacturers’ instructions.
b Protect your installations from outside disturbances (careful
grounding of shielding).
b Eliminate ground loops.
b Shield both sensitive and interfering cables.
b Use enclosures or cubicles as Faraday cages (contact between
unpainted, rust-free steel sheets, short and wide earth braids, no
unnecessary openings, etc.)
b Do not use "pigtails" or long grounding wires.
b Avoid TN-C systems, as common mode interference is the
principal problem in EMC.
b Clamp conductors against ground planes.
b Separate conductors by category.
b Do not leave any conductors unconnected.
b The outgoing and incoming conductors should always remain
together.
b Make use of "natural protections" (cable raceways, etc.)
Schneider Electric 35
36 Schneider Electric
Guide to Integration
Review 40
Networks 40
Systems 40
Bauds and bits per second 40
Architectures 41
The 20 mA current loop 42
The RS232 link 43
RS485 link 47
Standards EIA 485A (March 98 update) 48
and TSB89 (application guidelines for TIA/EIA-485-A) 48
Interfaces 50
RS232/RS485 50
Modems 51
The Modbus Protocol 56
Difference between ASCII and RTU frames 56
Differences between Modbus and Modbus+ protocols 56
Modbus / Jbus 56
Description of exchanges 58
Principles used 60
Addressing 61
Functions 61
Control of messages received by the slave 62
Algorithm for generating CRC16 75
Schneider Specifications 79
Overview 79
Connection 83
Components available 84
Summary 85
Specific Characteristics of Products 86
Schneider Electric 37
38 Schneider Electric
Guide to Integration
Modbus / Jbus
This chapter describes layer 2 of the OSI model in detail. This layer
is composed of two separate parts for data transmission:
b A "hardware" part (interfaces, addressing, parameters, etc.).
b A "software" part (medium access control, error management,
logical level control, etc.).
Schneider Electric 39
Guide to Integration Review
Modbus / Jbus
Networks
Definition : The purpose of a
A network is defined by its:
communications network is to link at least b Topology (bus, ring, star, tree, mesh, etc.)
two devices in order to exchange data (ex.: b Physical limits (length, speed, number of subscribers, etc.)
Ethernet network). b Type of physical medium used (cable, optical fibre, radio waves, etc.)
b Type of network access (random, master-slave, token ring, with or without error
management, etc.)
b Transmission modes (synchronous/asynchronous, in packets, serial/parallel,
NRZ/Manchester coding, etc.)
b Protocol (TCP/IP, FIP, MODBUS, etc.).
Systems
Definition : A system brings together a
number of different entities that function
independently but are connected to each
other (in a network) in order to participate in
an overall function.
Definition : The throughput or number of This parameter is of greatest interest to the user. The two are often confused
data bits transmitted in one second on the because their valence is generally 1.
network is expressed in bits per second.
A valence of 2 indicates that the throughput is doubled for the same communication
speed.
Definition : Valence is the ratio between
throughput in bits/s and speed in bauds.
U
E70510
5V
2.5 V
0 1 0 0 1 1 0
5V
2.5 V
t
00 11 10 01 00 10
40 Schneider Electric
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links
Architectures
Definition: A 20mA current loop is a multi-point link
(the number of points depends on the types of (Connection on SubD9 recommended, maximum length 3000 m at 1200 Bds, and
transmitters/receivers) via a 4-wire cable. 300 m at 9600 Bds, bus topology.)
Definition: An RS232 link is a point-to-point link via a (Connection on a SubD9 or 25 pts, maximum length 15 m at 19200 Bds.)
cable with at least three wires.
Definition: An RS422 link is a point-to-point link via a (Connection on SubD9 recommended, maximum length 1200 m at 19200 Bds.)
cable with at least four wires for full duplex operation.
Definition: An RS485 link is a multi-point link (32 (Connection on SubD9 recommended, maximum length 1200 m at 19200 Bds, bus
points maximum) via a cable with at least 2 wires for topology.)
half-duplex operation.
Topologies
Bus
E52323
Ring
E52324
Star
E52325
Point-to-Point
E52437
Schneider Electric 41
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
- + - + - + -
General characteristics:
E52338
TD R R R
b Maximum number of loads on the bus: T +
depends on the type of transmitters/ TD
- + - + TD - + TD -
receivers.
R T T
b Standard topology: "Multi-point" of the 4- +RD T
42 Schneider Electric
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
General characteristics:
The RS232 link
b Electrical levels ± 15 V. The physical DB25-DB25 connection
b Control lines: possible (RTS, CTS, DCD,
etc.) but not systematic depending on the 13 DB25 Female RS-232-C 1
E52326
software and/or interface.
b Charge and polarisation of the line: no.
b Minimum connection (in DB9): 25 14
v pin 2 (Transmitted Data),
v pin 3 (Received Data),
v pin 7 (Signal Ground).
DB25 to DB25 serial cable
Computer Interface
DTE DCE
14 25
Definition: DTE (Data Terminal Equipment) represents the terminal or computer.
b Link two devices of different types (DTE-DCE) with a direct PIN-to-PIN cable.
b Link two devices of similar type with a special cable:
v DTE-DTE, use a nul-modem cable,
v DCE-DCE, use a nul-terminal cable.
On computers the serial port is usually a DB9 or DB25 male. The parallel port is a
DB25 female.
Note: The terms "DCE" and "DTE" are not related to the type or gender of the
connector.
Standard RS-232-C does not clearly define whether the connector is male or female.
Its purpose is rather to standardise the function and utility of connector pins and the
voltage applied.
Schneider Electric 43
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
E70511
25 14
DTE DCE
5 DB9 Male 1
9 6
Some terminals and computers may have a DB9 type RS-232-C serial connector. In
the figure above, the RS-232-C serial connection uses a DB9 to DB25 cable.
1 CD carrier detection
6 DSR data set ready
5 SG signal ground
44 Schneider Electric
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
Standard cabling
E52329
Protective ground
1 1
Transmitted data
2 2
Received data
3 3
RTS
4 4
CTS
5 5
DSR
6 6
Signal ground
7 DCD (RLSD)
7
8 8
DTR
20 20
RI
22 22
DIRECT DB25-DB25
DTE DCE
Nul-modem cable
Protective ground
E52330
GRND 1 1 GRND
RTS
4 4 RTS
CTS 5 5 CTS
DSR 6 6 DSR
NUL-MODEM
(asynchronous)
DTE DTE
Nul-terminal cable
Protective ground
E52331
GRND 1 1 GRND
RTS
4 4 RTS
CTS 5 5 CTS
DSR 6 6 DSR
RI
22 22 RI
NUL-TERMINAL
(asynchronous)
DCE DCE
Schneider Electric 45
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
The hardware method is recommended: it uses signals from the RTS/CTS pins in the
Definition : Flow control allows the RS-232 serial interface to order the DTE to stop transmitting. This method is the
most secure and most widely used.
receiver to order the terminal to stop The software method requires that the modem send two different ASCII codes to the
transmission when its buffer memory has terminal to order it to stop (Xoff) or continue (Xon) to transmit:
reached 90% of its capacity. There are two v XON Ctrl-Q ASCII 11 Hex.
types of control: hardware and software. v XOFF Ctrl-S ASCII 13 Hex.
All IBM PCs and compatible computers permit flow control by RTS/CTS, but some
Apple computers do not.
If its buffers are full, the modem can signal the DTE at any time to wait for a certain
Regardless of the method used, flow period before transmitting (and vice-versa).
control makes it possible to increase the
transmission speed of the terminal (DTE) to
a speed greater than that of modem
throughput on the line.
46 Schneider Electric
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
Schneider Electric 47
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
A A' A/A'
E52332 Lr
B B' B/B'
T
R
G R
C C'
G
C/C'
Key:
b G = Generator
b A & B = Generator connection points
b C = Common point for the generator
b R = Receiver
b A’ & B’ = Receiver connection points
b C’ = Common point for the receiver
b T = Transmitter
b A/A’ & B/B’ = Transmitter connection points
b C/C’ = Common point for the transmitter
b RL = Load resistance.
Electrical states:
A
E52333
B
C
Line "A" on the transmitter is negative with respect to line "B" for a binary "1" (OFF).
Line "A" on the transmitter is positive with respect to line "B" for a binary "0" (ON).
48 Schneider Electric
Guide to Integration 20 mA CL – RS232 – RS422 –
Modbus / Jbus RS485 links (continued)
Binary 1 Binary 0
E52334
(OFF) (ON)
Vob VOH
Voa VOL
OV (Diff)
Voa – Vob
A
E52335
50 pF 50 Ω
G Vt
+ 20% + 1%
B
C
1.1 Vss
E52336
0.9 Vss
Vss OV (Diff)
0.1 Vss
tui tr tf
Vss = | Vt - Vt* |
Schneider Electric 49
Guide to Integration Interfaces
Modbus / Jbus
50 Schneider Electric
Guide to Integration Interfaces (continued)
Modbus / Jbus
b Amplitude modulation
E52341
b Frequency modulation
E52342
Schneider Electric 51
Guide to Integration Interfaces (continued)
Modbus / Jbus
Telephone companies dispatch pairs of cables to their clients; each pair represents
a different telephone number. Each of these telephone lines is linked to a special
computer called a "switching exchange or PABX" at the central telephone station.
The purpose of this computer is to set up the communications link between the caller
and the number being called.
Computers only process information in binary form, i.e., 1 or 0.
For telephone exchanges they must:
b Decode the numbers dialed.
b Establish the communications link between the two subscribers.
b Convert analogue conversations to digital form (1 and 0).
b Process the digital data.
b Re-modulate the digital data to obtain analogue signals.
E52340
PABX
1001101011100
A/D D/A
Definition:
b PABX: Public Automatic Branch eXchange
b A/D: Analogue to Digital converter
b D/A: Digital to Analogue converter
b CPU: Central Processing Unit
b Caller: User who dials the telephone number
b Person called: User who receives the telephone call
ISDN connections
In this application, ISDN will progressively replace analogue telephone service. (The
future competitors of ISDN will be DSL technologies and cable.) This type of digital
connection does not use modems; it requires a Terminal Adapter or other specialised
card. The configuration of these devices is often similar to that of modems, but they
have additional and different characteristics that vary according to the model used.
52 Schneider Electric
Guide to Integration Interfaces (continued)
Modbus / Jbus
Definition: The modulation speed of the modem must not be confused with the
General characteristics: speed of the COM port on the computer. Modem speed represents the rate of
b Industrial or office modem (depending on transfer of DCE, while COM port speed represents the transfer rate of DTE.
Modem communication speed can be changed during an exchange according to
use). load on the telephone network. For high speeds, use of RTS/CTS "hardware" flow
b Analogue/Digital (depending on control is recommended.
connection to the telephone network).
b Adaptable transmission speed (on the Installation recommendations
telephone network).
Hardware:
b AT commands accepted for use and b Modems are normally delivered with a telephone connection cable and a serial
parameter setting. connection cable for connecting to the PC/Mac/terminal.
b RS232 input available (speed compatible b Refer to supplier instructions when installing a PCMCIA modem.
with MODBUS). b Connect the telephone cable to the LINE outlet (and not the PHONE outlet) on the
modem. (Other terms are sometimes used.)
b Dry contact input available to initiate a b Connect the serial cable to the RS232 outlet on the modem and the PC/Mac/
call. terminal.
b Conformity with EMC directives. b Connect the outside power supply first to the 220 V line and then to the modem.
(First make sure the modem is set to the OFF position.)
Software:
b The software provided with the modem cannot generally be used to perform tests.
Thus we recommend that a terminal emulator be used to perform the first operating
tests.
b A driver and installation instructions are provided with PCMCIA modems. Refer
also to drivers installed on the PC operating system.
Schneider Electric 53
Guide to Integration Interfaces (continued)
Modbus / Jbus
Modem parameters:
For some applications it is useful to know b Error correction can be used to eliminate a number of transmission errors on the
the modem parameters and how to set often disturbed telephone network. ITU standard V.42 is faster and better than the
them. MNP-4 (from Microcom).
b Data compression can be used to accelerate the transfer of data that has not yet
Commands beginning with AT (Hayes
been compressed. With ITU standard V.42bis, the data compression rate can be as
compatible) differ according to the modem. high as 4:1, and compressed data is recognized. MNP-5 (from Microcom) provides
Modems that use Rockwell chips all have a compression rate of only 2:1.
the same commands. Thus it is best to b Flow control: slow modems may have only software flow control, known as XON/
XOFF in manuals, but faster modems must use hardware flow control, with RTS/CTS
describe functions rather than specific
control lines. Use of both modes, possible with some modems, is not recommended.
commands.
Common AT commands:
Modem parameters are:
b Error correction,
ATD To dial a number, followed by a T for frequency selection (DTMF) or, more
b Data compression, rarely, D for pulses (for older telephone switching stations). Example: ATDT
b Flow control. 6939332 [ENTER] +++ can be used to return to the control mode and, for
example, hang up with ATH. Remember to pause for one second before and
after the command.
AT&W Records the profile currently in memory. This is the profile that will be
activated when the modem is turned on or with the ATZ command. Note that
several profiles can be recorded on some models.
AT&V Used to view active modem parameters.
AT&F Resets all modem parameters to their original factory settings.
ATLn Changes speaker volume. (ATMn selects speaker operating mode.)
ATSr=n Places value n in register r. The command ATSr can be used to view the
contents of the register.
ATS0=n Sets the number of rings before the modem answers. If the value is 0 the
modem will not respond. In Switzerland there must be at least two rings
before the modem answers (according to OFCOM).
ATS7=n Used to define the time the modem waits for a carrier before hanging up and
indicating NO CARRIER. This value is usually between 45 and 60 seconds.
Note: The modem reference manual is the most reliable source of information.
Examples given here may differ.
Messages:
54 Schneider Electric
Guide to Integration Interfaces (continued)
Modbus / Jbus
Schneider Electric 55
Guide to Integration The Modbus Protocol
Modbus / Jbus
56 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
Schneider Electric 57
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52348
Master
Query
Response
Broadcast commands are always write commands. Slaves do not answer such
All frames exchanged have the same commands.
E52349
structure.
Function Data Control
E52350
Slave n°
code zone zone Master
CRC 16
Broadcast
Queries from the master are addressed
either:
b To a specific slave (identified by its
Slave 1 Slave 2 Slave 3
number in the first byte of the query frame.
b To all slaves (broadcasting).
58 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
and preparation of
the next exchange
Master D D
Slave N°1 R
Slave N°n R
Physical
medium
Time
Exchange i-1 Exchange i Exchange i+1
D Query R Response
Wait Broadcast
Turnaround Execution by slave
time
Schneider Electric 59
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
Principles used
Synchronisation of exchanges
Any character received after a silence of more than 3 characters is considered the
beginning of a frame.
E52352
start bit
3-character silence
Character Character
Presentation of frames
The contents of the following frames
Presentation of query and response frames
is given in hexadecimal.
b Query
E52353
b Response
60 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
Schneider Electric 61
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
The master transmits a query indicating: Control of messages received by the slave
b Slave number. Contents of an exception response
b Function code.
b Parameters of the function.
E52357
Slave no. 1 CRC 16
(1 to FF)
It calculates and transmits the contents of MSB* LSB*
the control word (CRC 16). 1 byte 1 byte 1 byte 2 bytes
When the slave receives the query
message, it stores the message in memory, Exception code
calculates the CRC and compares it with 1. - Unknown function code
2. - Incorrect address
the CRC 16 received. 3. - Incorrect data
4. - PLC not ready
b If the message received is incorrect 5. - Acknowledgement
7. - No acknowledgement
(CRC 16 frames not equal) the slave does 8. - Write error
not respond. 9. - Zone overlap
b Query.
Slave
Data CRC
Slave no. Function CRC 16
zone calculation
E52358
1 9 0 0 0 0
LSB* MSB*
CRC 16 comparison
CRC 16
b Response.
Important: the least significant byte (LSB)
of CRC 16 is transmitted first.
E52359
1 89 1
LSB* MSB*
CRC 16
Note: Exception responses 5 and 7 are related to Jbus functions 13 and 14.
62 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
Definition: A bit is a basic unit of information that can only equal 1 or 0. Bits are the
"language" used by computers. They correspond to the following levels of electricity
in computers:
b "bit 0" = 0 Volt
b "bit 1" = 5 Volts
Important:
When bits are transmitted through a serial port, they correspond to the following
levels of electricity:
b bit 0 = +3V to +15V
b bit 1 = -3 to -15V
Definition: A byte is a group of eight (8) binary elements. A byte is thus eight (8)
bits that represent a binary "word".
Note: MSB = Most Significant Bit and LSB = Least Significant Bit.
b Response.
E52361
Byte in detail:
transmitted transmitted
Example:
Read bits 204 to 211 of slave no. 1.
b Query.
E52362
01 01 02 04 01 0E
CRC 16
b In hexadecimal, the number of bits to read from 204 to 211 are as follows:
v 0204, 0205, 0206, 0207, 0208, 0209, 020A, 020B, 020C, 020D, 020E, 020F, 0210,
0211,
v a total of 14 values, or 0E in hexadecimal.
b Response.
E52363
01 01 02 10101001 00101110
Schneider Electric 63
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52364
Address of the Number of words
Slave no. 3 or 4 first word to read: to read: n 125 : CRC 16
MSB* LSB* MSB* LSB* LSB* MSB*
b Response.
Example:
Read words 805 to 80A of slave no. 2.
b Query.
E52366
02 03 0805 0006
CRC 16
b Response.
E52367
02 03 OC XXXX YYYY
CRC 16
64 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52368
Slave no. 5 Address of the bit Value of the bit 0 CRC 16
MSB* LSB* LSB* MSB*
E52368
b Response.
Note: If the slave number is 00, all slaves force the values and do not transmit a
response.
Example:
Force bit 210 of slave no. 2 to 1.
E52369
02 05 02 10 FF 00
CRC 16
b Response.
E52370
Note: If the slave number is 00, all slaves force the values and do not transmit a
response.
Example:
01 06 810 1000
CRC 16
Schneider Electric 65
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52372
Slave no. 7 CRC 16
LSB* MSB*
b Response.
E52373
66 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52489
Slave No. 8 Sub-function Data CRC 16
code
Schneider Electric 67
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
A diagnostic of exchanges between the master and the slave can be obtained by
reading the various counters.
If the master’s counter is equal to the slave’s counter, the command sent by the
master has indeed been executed. If the master’s counter is equal to the slave’s
counter + 1, the command sent by the master has not been executed.
b Query.
E52374
1 byte 2 bytes
b Response.
E52375
Contents of
Slave No. OB 00 00 slave’s CRC 16
counter
LSB* MSB*
68 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
b Query.
E52376
Slave No. 0C CRC 16
b Response.
E52377
Status of Status of
Slave No. OC 46 00 00 event counter message 64 bytes CRC
counter
b In reception.
= 1 if = 1 if 1 if erroneous = 1 if CRC
E52378
= 1 if
E52379
1 1 disconnected 0
mode
0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0
(1) Disconnected mode is used to analyse certain problems. In this mode, the
coupler monitors the line and increments counters and updates the trace table.
However there are no transfers to the slave’s memory and no responses are
transmitted on the line. This mode is piloted by command 8 (sub-functions 01 and
04).
Schneider Electric 69
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
The functions used to load and unload the memory can also be used to read and
write the data memory in excess of the 16-bit addressing limit.
The memory load and unload commands are accessible at all times. Program
commands must be organised within a session composed of:
b Connection.
b Commands.
b Disconnection.
Note: Read and write commands cannot be mixed within a single session.
Only one coupler at a time can access the slave’s memory and/or give orders to the
slave’s central processing unit.
Notes:
b The data memory is always accessible regardless of the status of the coupler
(connected or not). Thus the principle of mutual exclusion is respected.
b An automatic disconnection procedure (time out, etc.) on the slave should be
provided in case the disconnection command does not arrive at its destination (line
out of operation, character error, etc.).
70 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
Syntax:
b Query.
E52382
b Response.
E52383
The sub-function code returned is the sub-function code of the last program
command executed, with the most significant bit forced to 1 if an error was detected
during execution.
Example: 82 for a run query (sub-function 2). The type of error is coded as follows:
Schneider Electric 71
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52384
Address of No. of bits No. of bytes Value of
Slave no. OF the 1st bit to to force to force bits to CRC 16
force force
1 X 1968
1 n 246
b Response.
E52385
Example:
Force bits 200 and 201 of slave 3 to 1.
b Query.
E52386
3 OF 200 0002 01 03
CRC 16
b Response.
E52387
3 OF 200 0002
CRC 16
72 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52388
Address of No. of No. of Value of
Slave no. 10 the 1st word words to bytes to words to CRC 16
to force force force force
1 X 123
1 N 246
b Response.
E52389
Example:
Force words 0800 to 0803 of slave no. 1.
(0800) = 0001
(0801) = 0010
(0802) = 0100
(0803) = 1000
b Query.
E52390
CRC 16
b Response.
01 10 0800 0004
CRC 16
Schneider Electric 73
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52392
Slave no. 11 CRC 16
b Response.
E52393
Note: The number of bytes, slave ID and data available depend on the type of slave.
For the ON/OFF indicator: FF = ON & 00 = OFF.
b Query.
E52394
01 11 CRC 16
b Response.
E52395
01 11 04 64 FF 01 E1 CRC 16
74 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52396
FFFF CRC 16
n=0
no carry yes
n=n+1
no n>7 yes
next byte
end
+ exclusive OR
n = number of data bits
POLY = polynomial for generating CRC 16 = 1010 0000 0000 0001
(generating polynomial = 1 + x2 + x15 + x16 )
In CRC 16, the LSB is transmitted first.
Schneider Electric 75
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
Example of CRC calculation: frame 020B = read event counter (function 11) of the
slave at 02h.
76 Schneider Electric
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
E52397
02 0B 41 17
CRC 16
E52399
+ 5V
OV 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 1 0 0 0 1
- 5V
LSB MSB
Start
Start
Stop
Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
1 4 7 1
Schneider Electric 77
Guide to Integration The Modbus Protocol (continued)
Modbus / Jbus
The Modbus function 11 "read event counter" is used. All modules have this function
(see description of functions).
b Query.
E52397
02 0B 41 17
b Response.
counter contents
E52398
02 0B 00 00 (00 00 in this A4 38
case)”.
+ 5V
E52400
OV 0 1 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 1 0 0
- 5V
2.86 ms
Picks up
ine
1st byte 2nd byte
Start
Start
Stop
Stop
D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7
= 2 0 B 0
Thus we have the address of the slave (02 hex) and the function code (0B hex).
78 Schneider Electric
Guide to Integration Schneider Specifications
Modbus / Jbus
Overview
Minimum configuration required:
b Functions on bits (read/write): 1 and 2; 5 and 15 or/and functions
on words (read/write): 3 and 4; 6 and 16.
b Diagnostic functions: 8 (sub-codes 10 to 18), 11.
Principles to follow:
b Respect the frame format.
b Respect function numbers.
b Respect limits given by the protocol:
b Read 2000 bits or 125 words maximum,
b Write 1968 bits or 123 words maximum.
b Use slave numbers that can be set with parameters.
b Detect ends of frames with a 3-character silence.
b Increment diagnostic counters in strict accordance with specifications.
b React properly to unexpected events:
b Upon reception of an invalid master frame with correct CRC 16 (Cyclical
Redundancy Check) and slave number, return an exception message.
b No response to a frame with a CRC 16 error.
b Reject frames that are incomplete or too long.
Schneider Electric 79
Guide to Integration Schneider Specifications (continued)
Modbus / Jbus
b The time between two characters in a frame must always be less than three
characters (1 character = start bit, data bits, parity and stop bits).
b The time between two frames (master or slave) must always be greater than or
equal to three characters.
b If the device is programmed with parity, verify the parity of all bytes in a frame
received.
b If the device is programmed with no parity, refuse frames that have bytes with
parity.
b The following controls should be performed on a master or slave frame:
v CRC 16 correct,
- correct slave number;
- correct function code and sub-codes (if any),
- correct field length (limits authorised by the protocol),
- actual length correct (length field = number of bytes received),
v a master should:
- signal errors (error message, screen, LED, etc.) from slave responses,
- always be able to communicate after an incorrect response from a slave,
- refuse a slave response than arrives during transmission of a master frame (full
duplex not authorised by Jbus),
- verify that the structure of a frame transmitted conforms to the protocol (number of
variables, number of bytes £ 255, etc.).
Notes:
b A character error indicates an error in the format (framing), framing, parity or
overrun.
b An incorrect frame length is detected by verifying the "number of data" field (if any),
the "number of bytes" field (if any) and the actual length of the frame.
b For a frame longer than 255 bytes, the slave must wait for the end of the frame
(detection of a 3-character silence). The frame is not processed and counter 2
(frame with CRC error) is incremented only once.
b There is now a new diagnostic counter 6 for function 13 (program download). The
old counter 6 "PLC not ready" is now counter 7. The new counter 6 is incremented
each time a "no acknowledgement" exception response is transmitted (including
broadcast). In remote download mode all exception codes (1, 2, 3, 4, 8 and 9) are
replaced by the "no acknowledgement" code (7). This is the case whenever function
code 13 has been recognised (see the <function code unknown> -- no algorithm).
Function 14 can be used to obtain more detailed information on errors.
80 Schneider Electric
Guide to Integration Schneider Specifications (continued)
Modbus / Jbus
E52405
Idle
Reception
Reception
255 characters CTP8 = CTP8 + 1
max.
Character error
3-character silence
Error in at least
YES NO
1 character in
the frame
YES Length NO
< 3 bytes
YES Slave NO
number 0
CTP5 = CTP5 + 2
Slave number
YES = NO
Slave number
1 of the station
CTP4 = CTP4 + 1
YES Unknown NO
function code
YES Incorrect NO
length
Exception
n° 1
CTP3 = CTP3 + 1 YES Incorrect NO
address
Exception
n° 3
CTP3 = CTP3 + 1 YES Incorrect NO
data
Exception
n° 2
CTP3 = CTP3 + 1 2
Exception
n° 3
CTP3 = CTP3 + 1
Schneider Electric 81
Guide to Integration Schneider Specifications (continued)
Modbus / Jbus
E52404
3
YES Unknown NO
function code
Function code
YES NO
not authorised
for broadcasting
YES Incorrect NO
length
YES Incorrect NO
address
YES Incorrect NO
data
CTP3 = CTP3 + 1
Application
processing
3
YES Processing NO
error
Function 8 reset NO
YES
counters to zero
or function 11
YES NO
Broadcast
YES NO
Broadcast
Exception
no. 2, 3, 4, 8 or 9 Response
82 Schneider Electric
Guide to Integration Schneider Specifications (continued)
Modbus / Jbus
E52401
to ground should limit leakage inductance.
0V 1 1
Use a subD 9-pin female connector for 0V
Rp
6 6
connection. Rp
5V 2 2
Rc
7 7
3 3
RD + (A')
8 8 RD + (A')
RD - (B') RD - (B')
4 4
TD + (A') TD + (A')
9 9
TD - (B')
5 5 TD - (B')
Rp = 470Ω
Rc = 150Ω
0V 1 1
Rp
0V 6 6
Rp
5V 2 2
Rc
7 7
3 3
RD + (A')
8 8
RD - (B')
4 4
TD + (A') L + (A/A')
9 9
TD - (B')
5 5 L - (B/B')
Schneider Electric 83
Schneider Specifications (continued)
84 Schneider Electric
Summary
RS232C:
b Limit length to 15 m.
b Take into account the specific requirements of each interface and software
program with regards to management of control lines (RTS/CTS) when connecting
the line.
RS232/RS485 interface:
b Use converters recommended by Schneider Electric whenever possible; they have
been tested and validated for proper operation regardless of the configuration of the
installation.
RS485 link:
b Choose a 2-wire connection over a 4-wire link whenever possible.
b Use shielded twisted pairs with a characteristic impedance of 120 W.
b Link earths carefully.
b Make sure there are load resistors (120 W) on each side of the communication
line, as well as polarisation resistors, preferably on the "Master" side.
b Limit slaves to 32.
Modules:
b Each module has its own address. Make sure communication speeds and formats
used (data, parities, stop) are the same.
Modbus protocol:
b Do not mix Modbus ASCII and Modbus RTU products.
b Verify conformity between functions implemented in the modules connected and
functions used by the supervisor.
b Respect the various time constraints in the protocol.
Schneider Electric 85
Specific Characteristics of
Products
86 Schneider Electric
Implementation in Products
Diagnostic tools 89
List of diagnostic tests 89
Schneider Electric 87
88 Schneider Electric
Implementation in Products Diagnostic tools
Products connected:
b Are the frames received/sent compatible with the functions supported by products
and/or by the control system?
b Is the correct format used (number of data bits, stop, parity bits, etc.).
b Are parameters set correctly (speed, address, 2 wires / 4 wires, etc.)?
b etc.
Note:
b Connect modules one by one in order to identify any "problem" modules.
b Use communication LEDs as an initial indicator.
b etc.
Schneider Electric 89
Bibliography
90 Schneider Electric
Index
Numerics
20mA current loop 41
A
A/D 52
Address 61
ASCII 56
Attenuation 22
B
Baud 40
Bits per second 40
Broadcast 59
C
Caller 52
Capacitance 22
Characteristic impedance 21
Common-mode currents 12
Common-mode voltages 19
Communications network 40
Conduction 30
Control word 62
CPU 52
D
D/A 52
Data Communication Equipment 43
Data compression 54
Data Terminal Equipment 43
Diaphonie 22
G
Ground 13
E
Earthing network 10
Electrical continuity 25
EMC 9
EMC (ElectroMagnetic Compatibility) 9
Equipotentiality 31
Error correction 54
Error rate 34
F
Faraday cage 28
Flow control 46, 54
Frames 58
I
Interference reduction systems 33
ISDN 52
Island 16
J
Jbus protocol 56
L
Local Area Networks 4
Schneider Electric 91
Index (continued)
M
Master 58
Maximum theoretical length for electromagnetic compatibility 32
Modbus protocol 56
Modbus+ protocol 56
Modem 51
O
One-end connection 24
P
PABX 52
Parallel communication 43
Person called 52
Protection 11, 25, 29
Protocol 40
Q
Query from the master 59
R
Resistance per unit length 22
Response from the slave 59
RPC 33
RS232 link 41
RS422 link 41
RS485 link 41
RTU 56
S
Segment length 32
Serial communication 43
Shielding 20
Slave 58
Speed of the COM port 53
Speed of the modem 53
System 40
T
Temperature of use 22
The potential reference 30
Topology 40
Transmission modes 40
Transmission speed 22
Two-end connection 24
V
Valence 40
92 Schneider Electric
Schneider Electric SA Merlin Gerin As standards, specifications and designs develop from time This document has been
F-38050 Grenoble cedex 9 to time, always ask for confirmation of the information given printed on ecological paper.
tel. +33 (0)4 76 57 60 60 in this publication.
telex : merge 320 842 F Ce produit doit être installé, raccordé et utilisé en
respectant les normes et/ou les réglements d'installation en
vigueur.
Published by : Communication BTT-S2E
Création, réalisation : SONOVISION-ITEP Eybens