en:software:devices:modbus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
en:software:devices:modbus [2016/12/20 17:34] – created qem103en:software:devices:modbus [2016/12/21 15:13] – [5.2.1. Parametri per formattare il messaggio:] qem103
Line 1: Line 1:
 ====== DEVICE MODBUS ====== ====== DEVICE MODBUS ======
-===== - Introduzione =====+===== - Introduction =====
  
-Il protocollo MODBUS<sup>®</sup> rappresenta un sistema di comunicazione industriale distribuita sviluppata da Gould-Modicon per +The MODBUS<sup>®</sup> protocol represents an industrial communication system distributed and developed by Gould-Modicon to integrate PLC’s, computers, terminals, inverter and other devices. MODBUS is a Master/Slave communication protocol where only one device can be Master and monitors all activities of the serial line or TCPIP. As for the serial line can be connected up to a maximum of 247 slave along the same linesEach device is assigned an address that distinguishes it from all other connected devices.\\ 
-integrare PLC’s, computers, terminals, inverter e altre apparecchiature. MODBUS è un protocollo di comunicazione +The MODBUS device lets you choose which serial port use for connectionThe features s of data transmission (number of device, baud rate, parity, stop bits) and the transmission mode must be selected on each station and cannot be changed during the operation.\\ 
-Master/Slave in cui solo un dispositivo può essere Master e controlla tutte le attività della linea seriale o TCPIP. Per quanto riguarda la linea seriale possono essere collegati fino ad un massimo 247 slave sulla stessa lineaAd ogni dispositivo è assegnato un indirizzo che distingue esso +With using a serial linethere are two modes of transmission used in the Modbus ProtocolBoth ways allow the same communication skillsThe mode is selected by the master and must be unique for all devices connected to the networkThe modes are:
-da tutti gli altri dispositivi connessi.\\ +
-Il device MODBUS permette di scegliere quale porta seriale, presente sullo strumento, usare per il collegamento. +
-Le caratteristiche della trasmissione dati (nr. dispositivo fisico, baud rate, parità, stop bits) e del modo di trasmissione devono +
-essere selezionate su ogni stazione e non possono essere modificate durante il funzionamento.\\ +
-Con l'utilizzo di una linea serialeci sono due modi di trasmissione utilizzabili nel protocollo Modbus. Ambedue i modi permettono le stesse capacità di +
-comunicazioneIl modo è selezionato dal master e deve essere unico per tutti i dispositivi connessi alla reteI modi sono:+
   * ASCII (American Standard Code for Information Interchange)   * ASCII (American Standard Code for Information Interchange)
   * RTU, (Remote Terminal Unit.)   * RTU, (Remote Terminal Unit.)
  
-Il presente manuale si suddivide in due parti:\\ +This manual is divided into two parts:\\ 
-Parte I - Descrizione funzionamento come master\\ +Part I - Operation as master\\ 
-Parte II - Descrizione funzionamento come slave.+Part II - Operation as slave.
  
  
-===== - Convenzioni =====+===== - Conventions =====
  
-Il protocollo di comunicazione modbus standard definisce tipi di dati di scambio+The modbus communication protocol standard defines types of Exchange data
-  * INPUT STATUS = Ingressi digitali (Digital Inputs) +  * INPUT STATUS = Digital Inputs 
-  * COIL STATUS = Uscite digitali (Digital Outputs) +  * COIL STATUS = UDigital Outputs 
-  * INPUT REGISTER = Ingressi analogici (Analog Inputs) +  * INPUT REGISTER = Analog Inputs 
-  * HOLDING REGISTER. = Uscite analogiche (Analog Outputs). +  * HOLDING REGISTER. = Analog Outputs 
-Nel corso del manuale si deve tener conto delle convenzioni presenti.+Throughout the manual you have to take into account existing conventions.
  
  
  
  
-===== - Dichiarazione device nella unit di configurazione =====+===== - Device declaration in the configuration unit ===== 
 + 
 +Declaration of the used device (internal device): device name assigned, MODBUS, slot location and number of the device.
  
-Dichiarazione del device utilizzato (device interno): nome del device assegnato, MODBUS, posizione dello slot e numero 
-del device. 
 <code QCL> <code QCL>
 INTDEVICE INTDEVICE
 ... ...
-<nome_device>      MODBUS    TCamp    channel+<device_name>      MODBUS    TCamp    channel
 ... ...
 </code> </code>
  
-Dove+Where
-|INTDEVICE|è la parola chiave che indica l’inizio della definizione di devices interni,| +|INTDEVICE|is a keyword indicating the beginning of the definition of internal devices,| 
-|<nome_device>|è il nome del device,| +|<device_name>|is the device name,| 
-|MODBUS|è la parola chiave che identifica il device descritto in questo documento,| +|MODBUS|is the keyword that identifies the device described in this document,| 
-|TCamp|è tempo di campionamento del device,| +|TCamp|is the sampling time of the device,| 
-|channel|è la definizione del tipo di canale di comunicazione collegato (0 = Prog, 1 = User, per le altre porte il numero identificativo dipende dal tipo hardware firmware dello strumento utilizzato, 43 = Ethernet port per un modbus TCPIP).|+|channel|is the definition of the type of communications channel connected (0 = Prog, 1 = User, for the other ports the ID number depends on the hardware and firmware of the instrument used, 43 = Ethernet port to a modbus TCPIP).|
  
-Per quanto riguarda la dichiarazione dell’hardware utilizzato nella sezione “BUS” dell’unità di configurazione si dovrà fare +To declare the hardware used in the “BUS” section of the configuration unit you will have to refer to the firmware of the hardware itself.
-riferimento al manuale firmware dell’hardware stesso.+
  
-**Esempio**+**Example**
 <code QCL> <code QCL>
 INTDEVICE INTDEVICE
Line 58: Line 51:
 </code> </code>
  
-===== - Tabelle “scambio dati” per il MODBUS =====+===== - Tables "data exchange" for MODBUS =====
  
-==== - Dati letti dal device ====+==== - Data read from the device ====
  
-|:::^1^2^3^4^5^6^7^  8  ^9^10^11^12^13^14^15^16^Indice tabella+|:::^1^2^3^4^5^6^7^  8  ^9^10^11^12^13^14^15^16^Index table
-|:::^15^14^13^12^11^10^9^  8  ^7^6^5^4^6^2^1^0^Peso dei bit(2<sup>N</sup>)^ +|:::^15^14^13^12^11^10^9^  8  ^7^6^5^4^6^2^1^0^Weight of the bits(2<sup>N</sup>)^ 
-^Registro\\ Modbus| |||||||||||||||||+^Modbus\\ register| |||||||||||||||||
 |0001| |||||||iword1| |||||||2<sup>16</sup>|ilong1| |0001| |||||||iword1| |||||||2<sup>16</sup>|ilong1|
 |0002| |||||||iword2| |||||||2<sup>0</sup>|:::| |0002| |||||||iword2| |||||||2<sup>0</sup>|:::|
Line 98: Line 91:
 |0032| |||||||iword32| |||||||2<sup>0</sup>|:::| |0032| |||||||iword32| |||||||2<sup>0</sup>|:::|
  
-NOTA 1: la “ iword1 ” è la word più significativa della “ ilong1 ” (long = doppia word), la “iword3” è la word più significativa +NOTE 1: the “ iword1 ” is the most significant word of the “ ilong1 ” (long = double word), the “iword3” is the most significant word of the “ ilong2 ”, ...\\ 
-della “ ilong2 ”, ...\\ +NOTE 2: the “ st_ibit0 ” parameter less significant bit (with weight 0) of the “ iword1 ”, while the “ st_ibit15 ” bit is the most significant (with weight 15) of the “ iword1 ”.
-NOTA 2: il parametro “ st_ibit0 ” è il bit meno significativo (con peso 0) della “ iword1 ”, mentre il bit “ st_ibit15 ” è il bit più +
-significativo (con peso 15) della “ iword1 ”.+
  
-==== - Dati scrivibili da QCL e condivisibili in MODBUS ====+==== - Writable data from QCL and sharable in MODBUS ====
  
-|:::^1^2^3^4^5^6^7^  8  ^9^10^11^12^13^14^15^16^Indice tabella+|:::^1^2^3^4^5^6^7^  8  ^9^10^11^12^13^14^15^16^Index table
-|:::^15^14^13^12^11^10^9^  8  ^7^6^5^4^6^2^1^0^Peso dei bit(2<sup>N</sup>)^ +|:::^15^14^13^12^11^10^9^  8  ^7^6^5^4^6^2^1^0^Weight of the bits(2<sup>N</sup>)^ 
-^Registro\\ Modbus| |||||||||||||||||+^Modbus\\ register| |||||||||||||||||
 |0001| |||||||oword1| |||||||2<sup>16</sup>|olong1| |0001| |||||||oword1| |||||||2<sup>16</sup>|olong1|
 |0002| |||||||oword2| |||||||2<sup>0</sup>|:::| |0002| |||||||oword2| |||||||2<sup>0</sup>|:::|
Line 141: Line 132:
 |0032| |||||||oword32| |||||||2<sup>0</sup>|:::| |0032| |||||||oword32| |||||||2<sup>0</sup>|:::|
  
-NOTA 1: la “ oword1 ” è la word più significativa della “ olong1 ” (long = doppia word), la “oword3” è la word più significativa +NOTE 1: the “ oword1 ” is the most significant word of the “ olong1 ” (long = double word), the “oword3” is the most significant word of the “ olong2 ”, ...\\ 
-della “ olong2 ”, ...\\ +NOTE 2: the “ st_obit0 ” parameter is the less significant bit (with weight 0) of the “ oword1 ”, while the “ st_obit15 ” bit is the most significant (with weight 15) of the “ oword1 ”. 
-NOTA 2: il parametro “ st_obit0 ” è il bit meno significativo (con peso 0) della “ oword1 ”, mentre il bit “ st_obit15 ” è il bit + 
-più significativo (con peso 15) della “ oword1 ”.+ 
 +===== - Master operation description =====
  
 +The MODBUS device can use a serial port or TCPIP to communicate in master mode (parameter //mode// = 0). Allows (via parameters, states and commands) all instruments to be able to communicate with any equipment utilizing Modbus.\\
 +The device provides a data exchange area where the QCL can write or read values shared with the slaves on the network. This area is represented by a list of parameters of the device divided into two groups to differentiate the type of access of the data by the device. The first section is identified as INPUT the second as OUTPUT. The INPUT section, for master operation, is the storage area of reads data. It is used by all reader functions (parameter //type// = 1, 2, 3 o 4). The OUTPUT section, in the master operation, is the area of data storage that the master should transfer to the slaves. It is used by all writing functions (parameter //type// = 5, 6, 15 o 16). To facilitate the exchange of data between devices, the structure of the Exchange area includes data types commonly used in QCL namely WORD, LONG and FLAG. The “BYTE” type does not appear because the modbus usually uses the word size for each address registers. The modbus protocol selects data based on the number of access log register, while the QCL selects based on the parameter symbol, you create a reference table in which each QCL symbol find the corresponding number in the register of access in Modbus protocol. To obtain greater flexibility for addressing, the same area of Exchange data can be manipulated by the QCL with different dimension parameterized. All the symbols that appear in the same row of the table refer to the same memory locations.
  
-===== - Descrizione funzionamento come master ===== +==== - Input and coil Data Access ====
-Il device MODBUS può utilizzare una porta seriale o TCPIP per comunicare in modalità master (parametro //mode// 0). Esso da la +
-possibilità (tramite parametri, stati e comandi) a tutti gli strumenti di poter colloquiare con qualsiasi apparecchiatura utilizzante +
-protocollo Modbus.\\ +
-Il device rende disponibile una area di scambio dati dove il QCL può scrivere o leggere i valori condivisi con gli slave della +
-rete. Questa area è rappresentata da una lista di parametri del device suddivisa in due gruppi per differenziare il tipo di +
-accesso dei dati da parte del device. La prima sezione è identificata come INPUT la seconda come OUTPUT. +
-La sezione INPUT, per il funzionamento master, è l’area di deposito dei dati letti. Viene utilizzata quindi da tutte le funzioni +
-di lettura (parametro //type// 1, 2, 3 o 4). La sezione OUTPUT, nel funzionamento master, è l’area di deposito dei dati +
-che il master deve trasferire agli slave. Viene utilizzata da tutte le funzioni di scrittura (parametro //type// 5, 6, 15 o 16). +
-Per semplificare lo scambio dati tra apparecchiature, la struttura dell’area di scambio include tipi di dato comunemente +
-usati in QCL e cioè WORD, LONG e FLAG. Il tipo “BYTE” non compare perché il modbus utilizza solitamente la dimensione +
-word per ogni indirizzo dei registri. Siccome il protocollo modbus seleziona i dati in base al numero di registro di accesso, +
-mentre il QCL seleziona in base al simbolo del parametro, si crea una tabella di riferimento in cui ogni simbolo +
-QCL trova il corrispondente numero del registro di accesso nel protocollo Modbus. Per ottenere una maggior flessibilità di +
-indirizzamento, la stessa area di scambio dati può essere manipolata dal QCL con parametri di dimensione diversa. Tutti i +
-simboli che compaiono nella stessa riga della tabella si riferiscono alle medesime locazioni di memoria.+
  
-==== - Accesso dei dati input coil ====+The data input or //coil// type have in the modbus Protocol a bit size. To store this information in the table of data exchange is defined as follows mode: each register (and then every word parameter of the device) represents 16 elements that are numbered from left to right. For the Scriptures or multiple readings when bits read are higher than those contained in the register the operation continues in the next register.\\ 
 +The //st_ibit0//... and //st_obit1//... states are useful in order to facilitate access to information bit, only in the first table log.
  
-I dati tipo input o //coi//l hanno nel protocollo modbus una dimensione a bit. Per la memorizzazione di queste informazioni +==== - Mode of MASTER operation ====
-nella tabella di scambio dati è definita la seguente modalità: ogni registro (e quindi ogni parametro word del device) rappresenta +
-16 elementi che vengono numerati da sinistra verso destra. Per le scritture o letture multiple quando i bit da leggere +
-sono superiori a quelli contenuti nel registro l’operazione continua nel registro successivo.\\ +
-Gli stati //st_ibit0//... e //st_obit1//... sono utili per agevolare l’accesso alle informazioni di tipo bit solo nel primo registro della +
-tabella.+
  
-==== - Modo di funzionamento MASTER ====+The master mode is set with the mode parameter 0. The card generates modbus messages only on QCL ordering and does not automatically. To "format" the modbus message string there are a number of parameters.\\ 
 +Using the two commands SEND or SENDSYC you send the read or write request to the slave, a number of States allow an audit on the operation being executed. We see in detail:
  
-La modalità master viene impostata con il parametro mode 0. La scheda genera messaggi modbus solamente su comando +=== - Parameters for formatting the message===
-del QCL e non automaticamente. Per “formattare” la stringa del messaggio modbus vi sono una serie di parametri.\\ +
-Mediante i due comandi SEND o SENDSYC si inviano la richiesta di lettura o scrittura allo slave, una serie di stati +
-permettono una verifica sull’operazione eseguita. Vediamo in dettaglio:+
  
-=== - Parametri per formattare il messaggio: === +**type** = request type that you want to process (reading or writing word or bit).\\ 
-**type** = tipo di richiesta che si vuole processare (lettura o scrittura di word o di bit).\\ +**idcard** = address of the slave drive to which you want to send the request.\\ 
-**idcard** = indirizzo dell’unità slave verso cui si vuole inviare la richiesta.\\ +**addr** = the index from which to start reading or at which to start writing in the slave.\\  
-**addr** = indice da cui iniziare a leggere o da cui iniziare a scrivere nello slave in questione.\\  +**tabreg** = for read operations (type = 1, 2, 3, 4), This parameter indicates the position in the table of data read” where will store the read data on the slave. For write operations (type = 5, 6, 15, 16), this parameter indicates the position in the table of data to be written” where is the data to be written on the slave. Are accepted values are between and 512 for values of type parameter = 1, 2, 5, 15 (writing and reading of bits), while for type value = 3, 4, 6, 16 (writing and reading of word) the expected values are between and 32.\\ 
-**tabreg** = per le operazioni di lettura (type = 1, 2, 3, 4), questo parametro indica la posizione nella tabella dei dati letti” dove verrà memorizzato il dato letto sullo slave. Per le operazioni di scrittura (type = 5, 6, 15, 16), questo parametro indica da posizione nella tabella dei dati da scrivere” dove si trova il dato da scrivere sullo slave. Sono previsti valori tra 512 per valori del parametro type = 1, 2, 5, 15 (scrittura e lettura di bit), mentre per valori type = 3, 4, 6, 16 (scrittura e lettura di word) i valori previsti sono tra 32.\\ +**num** = number of values that are read or write (if the request type so provides). Are accepted values are between and 128 for values of type parameter = 1, 2, (reading of bits), while for type value = 3, 4, 16 (multiple word reading and writingthe accepted value are between and 32.
-**num** = numero di valori che si intendono leggere o scrivere (se il tipo richiesta type lo prevede). Sono previsti valori tra 128 per valori del parametro type = 1, 2, (lettura di bit), mentre per valori type = 3, 4, 16 (scrittura multipla e lettura di word) i valori previsti sono tra 32.+
  
 === - Comandi per inviare il messaggio: === === - Comandi per inviare il messaggio: ===
  • Last modified: 2020/07/13 14:58