Formation Interface Communication 30
Formation Interface Communication 30
Modbus ®
Protocole de communication
Série Modbus®
Septembre 06
Y1959B
Y1959A FR 29-08-2006 16:06 Pagina 2
Y1959A FR 29-08-2006 16:06 Pagina 3
Protocole Modbus® . . . . . . . . . . . . . . . . . . . . 4
Configuration des paramètres de communication .. 4
3
Y1959A FR 29-08-2006 16:06 Pagina 4
Protocole Modbus®
• La Centrale (26 194) supporte les protocoles de • En cas d’utilisation de l’interface RS-485, sur le
communication Modbus RTU® et Modbus ASCII® même bus (câble de connexion) peuvent être
sur les ports série RS-232 et RS-485. branchés plusieurs esclaves (appareils) qui doivent
• Grâce à cette fonction, il est possible de lire l’état avoir une adresse différente de toutes les autres.
des appareils et de les contrôler à l’aide de logi- • Le Maitre s’adresse à un esclave plutôt qu’à un
ciels dédiés, logiciels de supervision standard autre en utilisant l’adresse correspondante.
fournis par des tiers (SCADA) ou par l’intermédiai- • Le protocole RTU est de type binaire. Il est le plus
re d’appareillages dotés d’interface Modbus® tels utilisé et le plus rapide, la longueur des messages
que PLC et terminaux intelligents. étant inférieur de près de 50% comparé au proto-
• Il s’agit d’un protocole Maitre/esclave sur lequel le cole ASCII.
Maitre(généralement un PC) est le seul dispositif à • Le protocole ASCII est utilisé en présence de
pouvoir prendre l’initiative d’interroger les esclaves. modem ou d’autres appareillages qui ne permet-
• Lorsqu’ils sont interrogés, ces derniers répondent tent pas de garantir la rapidité nécessaire en
au Maitre selon des règles préétablies. Ils ne termes de transmission/réception.
génèrent jamais de messages de leur propre ini- • Pour qu’ils puissent dialoguer, Maitre et esclave
tiative mais restent en principe dans un état passif doivent être configurés avec les mêmes protocole,
dans l’attente d’être interrogés. vitesse, parité, etc.
4
Y1959A FR 29-08-2006 16:06 Pagina 5
En cas d’utilisation du protocole Modbus® RTU, la structure du message de communication est la suivante:
T1 T1
Adresse Fonction Données CRC
T2 T2
(8 bit) (8 bit) (N x 8 bit) (16 bit)
T3 T3
• Le champ Adresse contient l’adresse de l’instru- • Ceci permet, en présence d’interférences sur la ligne
ment esclave auquel le message est envoyé. Il est de transmission, d’ignorer le message transmis pour
théoriquement possible de connecter 245 appa- éviter les problèmes côté Maitre et côté esclave.
reils (esclaves). • La séquence T1 T2 T3 correspond à la durée pen-
• La champ Fonction contient le code de la fonction dant laquelle aucune donnée ne doit être échan-
que l’esclave doit exécuter. gée sur le bus de communication, pour permettre
• Le champ Données contient les données trans- aux instruments connectés de reconnaître la fin
mises à l’esclave ou celles envoyées par l’esclave d’un message et le début du suivant. Cette durée
comme réponse à une interrogation. doit être égale à 3,5 caractères.
• Pour la Centrale (26 194), la longueur maxi- • La Centrale (26 194) mesure la durée écoulée
mum admise pour le champ données est de 32 entre le réception d’un caractère et celle du carac-
registres de 16 bit (64 bytes). tère suivant: dans le cas où cette durée dépasse-
rait celle nécessaire à la transmission de 3,5
• Le champ CRC permet au Maitre et à l’esclave de
caractères, sur la base de la vitesse en bauds pro-
s’assurer de l’absence d’erreurs de transmission.
grammée, le caractère suivant est considéré
comme le début d’un nouveau message.
Par exemple, pour lire depuis la Centrale (26 194) avec adresse 1 la valeur de tension L3 ligne principale
présente sur la position 6 (06 Hex), le message à transmettre est le suivant:
01 04 00 05 00 02 61 CA
Message dans lequel:
01 = adresse esclaves
04 = fonction de lecture position
00 05 = adresse de la position diminuée d’une unité, contenant la valeur de tension L3 ligne principale
00 02 = nombre de registres à lire à partir de l’adresse 06
61 CA = checksum CRC
5
Y1959A FR 29-08-2006 16:06 Pagina 6
6
Y1959A FR 29-08-2006 16:06 Pagina 7
7
Y1959A FR 29-08-2006 16:06 Pagina 8
Erreurs
Dans le cas où l’esclave recevrait un message erroné, il en informe le Maitre en répondant par un message
constitué de la fonction requise en OR avec 80 Hex, suivie d’un code d’erreur.
Code Erreur
01 Fonction non valable
02 Adresse registre erronée
03 Valeur du paramètre hors limite
04 Opération impossible
06 Esclave occupé, fonction momentanément non disponible
8
Y1959A FR 29-08-2006 16:06 Pagina 9
Le protocole Modbus® ASCII est généralement utilisé sur les applications qui nécessitent une communication
via modem.
Les fonctions et les adresses disponibles sont identiques à celles de la version RTU sauf que caractères trans-
mis sont en ASCII et que la fin du message n’est pas établie sur la base d’une durée mais en fonction des
caractères de retour à la ligne.
En cas de sélection depuis le menu du protocole Modbus® ASCII, la structure du message de communication
sur le port de communication correspondant est la suivante:
• Le début du message est indiqué par le caractère comme réponse à une interrogation. La longueur
‘:’ (ASCII 3Ah). maximum admise est de 32 registres consécutifs.
• Le champ Adresse contient l’adresse de l’appareil • Le champ CRC permet au Maitre et a l’esclave de
esclave auquel le message est envoyé. s’assurer de l’absence d’erreurs de transmission.
• Le champ Fonction contient le code de la fonction • Ceci permet, en présence d’interférences sur la ligne
que l’esclave doit exécuter. de transmission, d’ignorer le message transmis pour
• Le champ Données contient les données trans- éviter les problèmes côté Maitre et côté esclave.
mises a l’esclave ou celles envoyées par l’esclave • Le message se termine toujours par les caractères
de contrôle CRLF (0D 0A).
Exemple:
Pour lire depuis la Centrale (26 194) avec adresse 8 la valeur de tension instantanée équivalente présente
sur la position 04 (04 Hex), le message à envoyer est le suivant:
: 0 8 0 4 0 0 0 3 0 0 0 2 E F CR LF
Message dans lequel:
: = ASCII 3Ah - délimiteur début de message
08 = ASCII 30h 38h - adresse esclave
04 = ASCII 30h 34h - fonction de lecture position
00 03 = ASCII 30h 30h 30h 33h - adresse de la position diminuée d’une unité,
contenant la valeur de tension instantanée
00 02 = ASCII 30h 30h 30h 32h - nombre de registres à lire à partir de l’adresse 04
EF = ASCII 45h 46h - checksum LRC
CRLF = ASCII 0Dh 0Ah - délimiteur de fin de message
9
Y1959A FR 29-08-2006 16:06 Pagina 10
10
Y1959A FR 29-08-2006 16:06 Pagina 11
11
Y1959A FR 29-08-2006 16:06 Pagina 12
* En lisant le mot à l’adresse 40h sont restitués 32 bit dont la signification est indiquée dans le tableau ci-dessous:
12
Y1959A FR 29-08-2006 16:06 Pagina 13
13
Y1959A FR 29-08-2006 16:06 Pagina 14
En lisant le mot à l’adresse 2070h sont restitués 16 bit dont la signification est indiquée dans le tableau
ci-dessous:
Bit Touche Bit Touche
0 Ouvrir/Fermer ligne secondaire 5 Ouvrir/Fermer ligne principale
1 Reset 6 Sél. mesures secondaire
2 Man 7 Sél. mesures principale
3 Aut 8…15 (Libre)
4 Setup
En lisant le mot à l’adresse 2071h sont restitués 16 bit dont la signification est indiquée dans le tableau
ci-dessous:
Bit Entrée Bit Entrée
0 Contact AUX ligne principale 5 Ligne secondaire non enclenché
1 Ligne principale déclenchée 6 Prog. 1
2 Ligne principale non enclenchée 7 Prog. 2
3 Contact AUX ligne secondaire 8…15 (Libre)
4 Ligne secondaire déclenchée
En lisant le mot à l’adresse 2072h sont restitués 16 bit dont la signification est indiquée dans le tableau
ci-dessous:
Bit Sortie à relais Bit Sortie à relais
0 Ouvrir ligne principale 4 Prog. 1
1 Ouvrir ligne secondaire 5 Prog. 2
2 Fermer ligne principale 6 Prog. 3
3 Fermer ligne secondaire 7…15 (Libre)
En lisant le mot à l’adresse 2074h (ligne principale) ou 2076h (ligne secondaire) sont restitués 16 bit
dont la signification est indiquée dans le tableau ci-dessous:
Bit État ligne Bit État ligne
0 Ligne dans les limites 7 Tension > maximum
1 Ligne ok 8 Tensions hors seuil asymétrie
2 Tension dans les limites 9 Tension < seuil absence phase
3 Tension ok 10 Fréquence < minimum
4 Fréquence dans les limites 11 Fréquence > maximum
5 Fréquence ok 12 Séquence phases erronée
6 Tension < minimum 13…15 (Libre)
14
Y1959A FR 29-08-2006 16:06 Pagina 15
En lisant le mot à l’adresse 2075h (ligne principale) ou 2077h (ligne secondaire) sont restitués 16 bit
dont la signification est indiquée dans le tableau ci-dessous:
Bit État interrupteur Bit État interrupteur
0 Interrupteur fermé 4 Sortie commande fermeture
1 Alarme déclenchée 5 Sortie commande ouverture
2 Alarme non réarmée 6…15 (Libre)
3 État commandé (1 = fermé)
En lisant le mot à l’adresse 2078h sont restitués 16 bit dont la signification est indiquée dans le tableau
ci-dessous:
Bit État fonctions entrée Bit État fonctions entrée
0 Interrupteur ligne principale fermée 8 Bouton arrêt d’urgence
1 Interrupteur ligne principale déclenché 9 Démarrage générateur
2 Interrupteur ligne principale non enclenché 10 Générateur prêt
3 Interrupteur ligne secondaire fermé 11 Blocage clavier
4 Interrupteur ligne secondaire déclenché 12 Blocage programmation
5 Interrupteur ligne secondaire non déclenché 13 Blocage contrôle à distance
6 Forçage sur ligne secondaire 14…15 (Libre)
7 Inhibition retour sur ligne principale
En lisant le mot à l’adresse 2079h sont restitués 16 bit dont la signification est indiquée dans le tableau
ci-dessous:
Bit État fonctions sortie Bit État fonctions sortie
0 Ouverture ligne principale 5 Démarrage générateur
1 Ouverture ligne secondaire 6 Centrale (26 194) prête
2 Fermeture ligne principale 7 Load shed
3 Fermeture ligne secondaire 8…15 (Libre)
4 Alarme globale
15
Y1959A FR 29-08-2006 16:06 Pagina 16
Le tableau suivant indique les valeur à inscrire à l’adresse 2F00h pour obtenir les fonctions correspondantes:
Valeur Fonction
0 Passage à modalité RESET/OFF
1 Passage à modalité MAN
2 Passage à modalité AUT
Le tableau suivant indique les valeurs à inscrire à l’adresse 2F03h pour obtenir les fonctions correspondantes:
Valeur Fonction
1 Mémorisation des paramètres sur EEPROM uniquement
2 Mémorisation sur EEPROM suivie du reset de l’appareil
4 Mémorisation sur EEPROM suivie du reset de l’appareil
16
Y1959A FR 29-08-2006 16:06 Pagina 17
17
Y1959A FR 29-08-2006 16:06 Pagina 18
18
Y1959A FR 29-08-2006 16:06 Pagina 19
19
Y1959A FR 29-08-2006 16:06 Pagina 20
20
Y1959A FR 29-08-2006 16:06 Pagina 21
21
Y1959A FR 29-08-2006 16:06 Pagina 22
* Pour ces paramètres, la modification des configurations de l’interface Serie en utilisant cette même interface Serie peut
entraîner une perte d’alignement Maitre/esclave et le blocage de la ligne de communication. Il est, par conséquent,
recommandé d’utiliser uniquement la fonction 04 (en lecture).
22
Y1959A FR 29-08-2006 16:06 Pagina 23
Centrale (26194)
PC
Câble 51C2
RJ6/6
RS232
23
Y1959A FR 29-08-2006 16:06 Pagina 24
RS232
SG SG Câble
B B
51C4
A A
TR TR
PX1
RS485 RS485
RS232/RS485 CONV.
EIA-232 EIA-485/422
SG
SG
TR
TR
A
A
B
B
Câble pair tressé Câble pair tressé
L MAX= 1200m
24
Y1959A GB 29-08-2006 16:08 Pagina 25
Modbus ®
September 06
Y1959B
Y1959A GB 29-08-2006 16:08 Pagina 26
Y1959A GB 29-08-2006 16:08 Pagina 27
Contents
Modbus® Protocol . . . . . . . . . . . . . . . . . . . . . 28
Setting communication parameters . . . . . . . . . . . . 28
Address tables . . . . . . . . . . . . . . . . . . . . . . . 36
Table 2 - Measurements provided
by the communication protocol . . . . . . . . 36
Table 3 - General status Bit . . . . . . . . . . . . . . . . . 37
Table 4 - Remote controls . . . . . . . . . . . . . . . . . . 40
Table 5 - Setup parameters . . . . . . . . . . . . . . . . . 41
27
Y1959A GB 29-08-2006 16:08 Pagina 28
Modbus® Protocol
• The Unit supports the Modbus RTU® and Modbus • When working with the RS-485 interface, on the
ASCII® communication protocols on the RS-232 same bus (connecting cable), several slaves
and RS-485 serial ports. (apparatuses) can be connected which must
• Thanks to this function, it is possible to read the have a unique address, that is, different from all
status of the apparatuses and control them using the others.
specific software, standard supervision software • The Master communicates with one slave rather
provided by third parties (SCADA) or using appa- than another using the relative address.
ratuses equipped with a Modbus® interface such • The RTU protocol is of the binary type. This is the
as a PLC and intelligent terminals. most widespread and the quickest, with a message
• It is a Master-Slave protocol, where the Master length less than almost 50% compared to the ASCII
(usually a PC) is the only device that can take the protocol.
initiative to interrogate the slaves. • The ASCII protocol is used when one works with
• When they are interrogated, they reply to the mas- a modem or other apparatus that cannot guaran-
ter according to pre-set rules. They never create tee transmission/reception speed.
messages of their own initiative and normally • In order to communicate with each other, the mas-
remain passive as they wait to be interrogated. ter and all the slaves must have the same protocol
setting, speed, parity, etc.
28
Y1959A GB 29-08-2006 16:08 Pagina 29
When using the RTU Modbus® protocol, the communication message structure is as follows:
T1 T1
Address Function Data CRC
T2 T2
(8 bit) (8 bit) (N x 8 bit) (16 bit)
T3 T3
• The address field contains the address of the slave • In the event of interference on the transmission
instrument to which the message is being sent. In line, this allows one to ignore the message sent in
theory, one can connect up to a maximum of 245 order to prevent problems both on the master and
apparatuses (slaves). slave side.
• The Function field contains the function ID that has • The T1 T2 T3 sequence corresponds to the time
to be carried out by the slave. during which data must not be exchanged on the
• The Data field contains the data sent to the slave communication bus in order to allow the connect-
or the data sent by the slave as a response to a ed instruments to identify the end of one message
question. and the beginning of the next one. This time
should be 3.5 characters.
• As for the unit, the maximum permitted length for
the data field is 32, 16 bit registers (64 bytes). • The unit measures the time between the reception
of one character and the next one and if it
• The CRC field permits both the master and slave
exceeds the time needed to transmit 3.5 charac-
to check whether there are transmission errors.
ters, referring to the set baud rate, the next char-
acter is read as the beginning of a new message.
For example, if one wishes to read the main line L3 voltage value found in location 6 (06 Hex) with address
1 from the unit, this is the message to send:
01 04 00 05 00 02 61 CA
Where:
01 = slave address
04 = location reading function
00 05 = location address reduced by one unit, containing the L3 main line voltage valuen
00 02 = number of registers to be read starting from the 06 address
61 CA = checksum CRC
29
Y1959A GB 29-08-2006 16:08 Pagina 30
30
Y1959A GB 29-08-2006 16:08 Pagina 31
31
Y1959A GB 29-08-2006 16:08 Pagina 32
Errors
Should the slave receive an incorrect message, it will inform the master of this condition by replying with a
message made-up by the function requested in OR with 80 Hex, followed by an error ID.
Table 1 - Error ID
The following table contains the error codes sent to the master by the slave.
Code Error
01 Invalid function
02 Illegal register address
03 Parameter value off range
04 Unable to complete operation
06 Slave busy, function temporarily unavailable
32
Y1959A GB 29-08-2006 16:08 Pagina 33
The Modbus® ASCII protocol is normally used in applications that need to communicate via modem.
The functions and addresses available are the same as the RTU version, but the characters transmitted are in
ASCII and the termination of the message is not done via the time but with return characters.
If the Modbus® ASCII protocol is selected from the menu, the structure of the communication message on its
communication port is as follows:
• The beginning of the message is shown with the • The LRC field permits both the master and slave to
‘:’ character (ASCII 3Ah). check whether there are transmission errors.
• The address field contains the address of the slave • In the event of interference on the transmission
instrument to which the message is being sent. line, this allows one to ignore the message sent in
• The Function field contains the function ID that has order to prevent problems both on the master and
to be carried out by the slave. slave side.
• The Data field contains the data sent to the slave • The message always ends with the control charac-
or the data sent by the slave as an answer to a ters CRLF (0D 0A).
question. The maximum length allowed is 32 con-
secutive registers.
Example:
For example, if one wishes to read the equivalent line voltage value found in location 04 (04 Hex) with
address 8 from the Unit, this is the message to send:
: 0 8 0 4 0 0 0 3 0 0 0 2 E F CR LF
Where:
: =ASCII 3Ah - marker at beginning of the message
08 =ASCII 30h 38h - slave address
04 =ASCII 30h 34h - location reading function
00 03 = ASCII 30h 30h 30h 33h - location address reduced by one unit,
containing the voltage value
00 02 = ASCII 30h 30h 30h 32h - number of registers to be read starting from the 04 address
EF = ASCII 45h 46h - checksum LRC
CRLF = ASCII 0Dh 0Ah - marker at end of message
33
Y1959A GB 29-08-2006 16:08 Pagina 34
34
Y1959A GB 29-08-2006 16:08 Pagina 35
35
Y1959A GB 29-08-2006 16:08 Pagina 36
Address tables
* The words in the address 40h, 32 bits are sent back with meaning as shown in the table:
36
Y1959A GB 29-08-2006 16:08 Pagina 37
37
Y1959A GB 29-08-2006 16:08 Pagina 38
Reading the words in address 2070h, 16 bits are sent back with meaning as shown in the table:
Reading the words in address 2071h, 16 bits are sent back with meaning as shown in the table:
Reading the words in address 2072h, 16 bits are sent back with meaning as shown in the table:
Reading the words in address 2074h (main) or 2076h (sec.), 16 bits are sent back with meaning as
shown in the table:
Bit Line status Bit Line status
0 Line within the limits 7 Voltage > maximum
1 Line ok 8 Voltage outside asymmetry threshold
2 Voltage within the limits 9 Voltage < missed phase threshold
3 Voltage ok 10 Frequency < minimum
4 Frequency within the limits 11 Frequency > maximum
5 Frequency ok 12 Incorrect phase sequence
6 Voltage < minimum 13…15 (Free)
38
Y1959A GB 29-08-2006 16:08 Pagina 39
Reading the words in address 2075h (main) or 2077h (sec.), 16 bits are sent back with meaning as
shown in the table:
Bit Circuit breaker status Bit Circuit breaker status
0 Circuit breaker closed 4 Output control closure
1 Trip alarm 5 Output control opening
2 Withdrawn Alarm 6…15 (Free)
3 Controlled status (1 = closed)
Reading the word in address 2078h, 16 bits are sent back with meaning as shown in the table:
Reading the word in address 2079h, 16 bits are sent back with meaning as shown in the table:
39
Y1959A GB 29-08-2006 16:08 Pagina 40
The following table shows the values to be written in address 2F00h to obtain the corresponding functions:
Value Function
0 Move to reset mode
1 Move to manual mode
2 Move to automatic mode
The function is executed by writing the value 0001h to the specified address.
The function is executed by writing the value 00AAh to the specified address.
The following table shows the values to be written in address 2F03h to obtain the corresponding functions:
Value Function
1 Only parameter recording in EERPOM
2 Recording in EEPROM and subsequent reset of apparatus
4 Recording in EEPROM and subsequent reset of apparatus
40
Y1959A GB 29-08-2006 16:08 Pagina 41
41
Y1959A GB 29-08-2006 16:08 Pagina 42
42
Y1959A GB 29-08-2006 16:08 Pagina 43
43
Y1959A GB 29-08-2006 16:08 Pagina 44
44
Y1959A GB 29-08-2006 16:08 Pagina 45
45
Y1959A GB 29-08-2006 16:08 Pagina 46
* For these parameters, when changing the settings of the serial interface using the serial interface itself, can cause the
Master-Slave to be thrown out of line as well as a subsequent blocking of the communication line. It is therefore advis-
able to only use the function 04 (in reading).
46
Y1959A GB 29-08-2006 16:08 Pagina 47
Unit
PC
Cable 51C2
RJ6/6
RS232
47
Y1959A GB 29-08-2006 16:08 Pagina 48
Unit n Unit 01 PC
RS232
SG SG Cable
B B
51C4
A A
TR TR
PX1
RS485 RS485
RS232/RS485 CONV.
EIA-232 EIA-485/422
SG
SG
TR
TR
A
A
B
B
Twisted-pair cable Twisted-pair cable
L MAX= 1200m
48
Y1959A GB 29-08-2006 16:08 Pagina 49
Y1959A GB 29-08-2006 16:08 Pagina 50