
p. 7 / 25
Doc. code:AHIT303$0500.doc Date: 20/02/2006
PROTOCOLLO MODBUS® ASCII
Se si seleziona il parametro P.44 come protocollo Modbus® ASCII, la struttura del
messaggio di comunicazione è così costituito:
:
Indirizzo
(2 chars)
Funzione
(2 chars)
Dati
(N chars)
LRC
(2 chars)
CR
LF
•il campo Indirizzo contiene l’indirizzo dello strumento slave cui il messaggio viene inviato.
•il campo Funzione contiene il codice della funzione che deve essere eseguita dallo slave.
•il campo Dati contiene i dati inviati allo slave o quelli inviati dallo slave come risposta
ad una domanda.
•il campo LRC consente sia al master che allo slave di verificare se ci sono errori di
trasmissione.
Questo consente, in caso di disturbo sulla linea di trasmissione, di ignorare il
messaggio inviato per evitare problemi sia dal lato master che slave.
• Il messaggio termina sempre con i caratteri di controllo CRLF (0D 0A).
FUNZIONI MODBUS®
Le funzioni disponibili sono:
04 = Read input
register
Consente la lettura delle
misure disponibili nel
multimetro.
06 = Preset single
register
Permette di modificare i
parametri del setup
07 = Read exception Permette di leggere lo stato
dello strumento
16 = Preset multiple
register
Permette di modificare più
parametri del setup
contemporaneamente
17 = Report slave ID
Permette di leggere
informazioni relative al
multimetro
Esempio:
Per esempio, se si vuole leggere dal multimetro con indirizzo 8 il valore
della tensione concatenata equivalente che si trova alla locazione 16
(10 Hex), il messaggio da spedire è il seguente:
: 0 8 0 4 0 0 0 F 0 0 02 E 3 CRLF
Dove:
08 = indirizzo slave.
04 = funzione di lettura locazione.
00 0F = indirizzo della locazione diminuito di un’unità, contenente il valore di tensione
concatenata equivalente.
00 02 = numero di registri da leggere a partire dall’indirizzo 0F.
E3 = checksum LRC.
La risposta del multimetro è la seguente:
: 0 8 0 4 0 4 0 0 0 0 0 1 A 0 4 F CRLF
Dove:
08 = indirizzo del multimetro (Slave 08).
04 = funzione richiesta dal Master.
04 = numero di byte inviati dal multimetro.
00 00 01 A0 = valore esadecimale della tensione concatenata equivalente 416 V.
4F = checksum LRC.
FUNZIONE 04: READ INPUT REGISTER
La funzione 04 permette di leggere più grandezze consecutive in memoria. Ogni
grandezza è definita come “unsigned long” e quindi occupa 2 registri (4 byte). E’
possibile leggere fino a 14 grandezze consecutive.
L’indirizzo di ciascuna grandezza e’ indicato nella Tabella 2 riportata nelle pagine
seguenti. Come da standard Modbus®, l’indirizzo specificato nel messaggio va
diminuito di 1 rispetto a quello effettivo riportato nella tabella.
Se l’indirizzo richiesto non è compreso nella tabella o il numero di grandezze richieste
è maggiore di 14 il multimetro ritorna un messaggio di errore ( vedi tabella errori).
MODBUS® ASCII PROTOCOL
If one selects Modbus® ASCII protocol at parameter P.44, the communication
message has the following structure:
:
Address
(2 chars)
Function
(2 chars)
Data
(N chars)
LRC
(2 chars)
CR
LF
•The Address field holds the serial address of the slave destination device.
•The Function field holds the code of the function that must be executed by the slave.
•The Data field contains data sent to the slave or data received from the slave in
response to a query.
•The LRC field allows the master and slave devices to check the message integrity.
If a message has been corrupted by electrical noise or interference, the LRC field
allows the devices to recognize the error and thereby ignore the message.
• The message terminates always with CRLF control character (0D 0A).
MODBUS® FUNCTIONS
The available functions are:
04 = Read input
register
Allows to read the multimeter
measures.
06 = Preset single
register
Allows to set the setup
parameters
07 = Read exception Allows to read the device
status
16 = Preset multiple
register
Allows to set more than one
parameter at the same time.
17 = Report slave ID Allows to read information
about the multimeter.
Example:
For instance, to read the value of the equivalent phase-to-phase
voltage, which resides at location 16 (10 Hex) from the multimeter with
serial address 08, the message to send is the following:
: 0 8 0 4 0 0 0 F 0 0 02 E 3 CRLF
Whereas:
08 = Slave address
04 = Modbus® function ‘Read input register’
00 0F = Address of the required register (equivalent phase-to-phase voltage)
decreased by one
00 02 = Number of registers to be read beginning from address 0F
E3 = LRC Checksum
The multimeter answer is the following:
: 0 8 0 4 0 4 0 0 0 0 0 1 A 0 4 F CRLF
Whereas:
08 = Multimeter address (Slave 08)
04 = Function requested by the master
04 = Number of bytes sent by the multimeter
00 00 01 A0 = Hex value of the equivalent phase-to-phase voltage (416 V)
4F = LRC checksum
FUNCTION 04: READ INPUT REGISTER
The Modbus® function 04 allows to read one or more consecutive measures from the
slave memory. In this case, each measure is defined as ‘unsigned long’, so it has a
length of 2 registers (4 bytes). It is possible to read up to 14 consecutive measures.
The address of each measure is given in Table 2 (see following pages). As for
Modbus® standard, the address in the query message must be decreased by one
from the effective address reported in the table.
If the measure address is not included in the table or the number of requested
measures exceeds 14, the multimeter will return an error code (see error table).