Vous êtes sur la page 1sur 11

4/3/2022

MODBUS
OBJECTIF, PROBLÈMES ET SOLUTIONS
MODBUS :
MODBUS

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

1 2

MODBUS MODBUS
OBJECTIF, PROBLÈMES ET SOLUTIONS OBJECTIF, PROBLÈMES ET SOLUTIONS
MODBUS : MODBUS :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

3 4

1
4/3/2022

MODBUS MODBUS
OBJECTIF, PROBLÈMES ET SOLUTIONS OBJECTIF, PROBLÈMES ET SOLUTIONS
LES DIFFÉRENTES VERSIONS DE MODBUS : EXEMPLE DE RÉSEAUX MODBUS :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

5 6

MODBUS MODBUS
OBJECTIF, PROBLÈMES ET SOLUTIONS OBJECTIF, PROBLÈMES ET SOLUTIONS
CONFIGURATION : EXEMPLE DE RÉSEAUX MODBUS :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

7 8

2
4/3/2022

MODBUS MODBUS
OBJECTIF, PROBLÈMES ET SOLUTIONS MODBUS TCP/IP
CONFIGURATION : CLIENT/SERVEUR EN MODBUS TCP :

For Serial it uses a terminology like For Ethernet it uses a terminology like
Master ------------- Slave Client ------------- Server

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

9 10

MODBUS MODBUS
MODBUS TCP/IP MODBUS TCP/IP
CLIENT/SERVEUR EN MODBUS TCP : TRAME MODBUS/TCP :

Le serveur est sur le PORT : 502


TRAME MODBUS/TCP
Une en tête spécifique est utilisée en TCP/IP pour identifier l'APU MODBUS :
MBAP MODBUS APPLICATION PROTOCOL HEADER

ADU= Application Data Unit

PDU= Protocol Data Unit

En tête MBAP Code fonction data

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

11 12

3
4/3/2022

MODBUS MODBUS
MODBUS TCP/IP MODBUS TCP/IP
ENCAPSULATION MODBUS TCP : STRUCTURE DU MBAP :

champ longueur description


Identifiant d'une transaction de type MODBUS:
Identifiant
2 octets Demande/réponse
de transaction

Identifiant
2 octets Protocole MODBUS = 0
de protocol

taille 2 octets Nombre d'octets à suivre (UI+DATA)

Identifiant Remplace la notion d'@ esclave


1 octet
D'unité sur le réseau TCP/IP

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

13 14

MODBUS MODBUS
MODBUS TCP/IP MODBUS TCP/IP
SERVICES SUPPORTÉS PAR MODBUS : DÉROULEMENT D’UNE TRANSACTION SANS ERREUR :
• Voici la liste des codes fonction (tous les équipements ne supportent pas tous les codes fonction)

Code Fonction
01h Lecture de n bits de sortie ,param1=adresse param2=quantité

02h Lecture de n bits d'entrée ,param1=adresse param2=quantité

03h Lecture de n mots internes ,param1=adresse param2=quantité

04h Lecture de n mots registre d'entrée ,param1=adresse param2=quantité

05h Écriture d'un bit interne ou de sortie,param1=adresse param2=0000 ('0') ou


FF00('1')
06h Écriture d'un mot registre ou registre ,param1=adresse param2=valeur

15h Écriture de n bits internes ou de sortie consécutifs ,param1=adresse


param2=Nbre bits, param3=Nbre d'octets, params[i]=valeurs
16h Écriture de n mots internes ou de registres consécutifs ,param1=adresse
param2=Nbre mots, param3=Nbre d'octets, params[i]=valeurs
Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

15 16

4
4/3/2022

MODBUS MODBUS
MODBUS TCP/IP MODBUS TCP/IP
DÉROULEMENT D’UNE TRANSACTION AVEC ERREUR : FONCTIONNEMENT DÉTAILLÉ COTÉ SERVEUR :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

17 18

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
MODBUS LIAISON SÉRIE ET LE MODÈLE OSI : PRINCIPES DU PROTOCOLE MAÎTRE-ESCLAVE MODBUS :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

19 20

5
4/3/2022

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
LA TRAME MODBUS LIAISON SÉRIE : ADRESSAGE MODE UNICAST :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

21 22

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
ADRESSAGE MODE BROADCAST : DIAGRAMME DE TEMPS EN ADRESSAGE UNICAST :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

23 24

6
4/3/2022

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
DIAGRAMME DE TEMPS EN ADRESSAGE BROADCAST : COMPORTEMENT EN CAS DE DÉTECTION ERREUR :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

25 26

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
MODES DE TRANSMISSION SÉRIE DÉFINIS : TRAME MODBUS RTU :

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

27 28

7
4/3/2022

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
TRAME MODBUS RTU : TRAME MODBUS ASCII :

TRAME  Chaque trame contient 4 types d'informations

ADU= Application Data Unit

PDU modbus PDU= Protocol Data Unit


Code CRC
Adresse data
fonction Ou LRC

1 octet 1 octet X octets 2 octets


Entre 1 et 247 Entre 1 et 127 Complément Contrôle de
Identifie d'informations validité
Le destinataire (dépend du code
Fonction)
Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

29 30

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
TRAME MODBUS RTU / ASCII : TRAME MODBUS RTU / ASCII / TCP:

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

31 32

8
4/3/2022

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
EXEMPLE DE TRAME EN MODE RTU : QUELQUES FONCTIONS !

CODE. FONCTION.

01 Lecture de N bits de sortie ou de bit interne.

02 Lecture de N bits d’entrées discrètes.

03 Lecture de N mots de sortie ou mots internes.

04 Lecture de N mots d’entrée.

05 Écriture d’un bit de sortie ou bit interne.

06 Écriture d’un mot de sortie ou d’un mot interne.

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

33 34

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
TRAME D’EXCEPTION :
Des trames d’exception sont prévues pour permettre la
gestion du réseau et le traitement des erreurs.
❑ 11 Caractères en ASCII.
❑ 5 Octets en RTU

Champ Champ Champ code


CRC.
adresse. code. erreur.
1 Octet. 1 Octet. 1 Octet. 2 Octets.

1 - Fonction inconnue.
2 - Adresse incorrecte.
3 - Donnée incorrecte.
Le code fonction retourné est celui de 4 - Esclave non prêt.
la commande avec le bit de poids le plus 5 - Acquittement.
fort forcé à 1. 8 - Défaut d’écriture.
Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

35 36

9
4/3/2022

MODBUS MODBUS
MODBUS RTU / ASCII MODBUS RTU / ASCII
CONFIGURATION :

For Serial it uses a terminology like For Ethernet it uses a terminology like
Master ------------- Slave Client ------------- Server

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

37 38

MODBUS MODBUS
EXERCICE EXERCICE

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

39 40

10
4/3/2022

MODBUS
EXERCICE

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022 Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

41 42

Pr I.Ouachtouk Réseaux Locaux Industriels 4/3/2022

43

11

Vous aimerez peut-être aussi