Doc. AHIT101A0510.doc 10/02/2011 P. 4 / 18
La risposta del DME_CD è la seguente:
01 04 04 00 00 7C C4 DA D7
Dove:
01= indirizzo del DME_CD (Slave 01)
04 = funzione richiesta dal Master
04 = numero di byte inviati dal DME_CD
00 00 7C C4 = valore esadecimale del contatore
totale 1
= 31940 = 319,40
DA D7 = checksum CRC
FUNZIONE 04: READ INPUT REGISTER
La funzione 04 permette di leggere una o più
grandezze consecutive in memoria. L’indirizzo di
ciascuna grandezza e’ indicato nelle Tabelle 2-4
riportate nelle ultime pagine del presente manuale.
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 registri richiesti è maggiore del numero
consentito il DME_CD ritorna un messaggio di errore
( vedi tabella errori).
Richiesta Master:
Indirizzo slave 08h
Funzione 04h
MSB Indirizzo registro 00h
LSB Indirizzo registro 0Fh
MSB Numero registri 00h
LSB Numero registri 08h
MSB CRC C1h
LSB CRC 56h
Nell’esempio vengono richiesti ,allo slave numero 8,
8 registri consecutivi a partire dall’indirizzo 10h.
Quindi vengono letti i registri dall’ 10h al 17h.
Il comando termina sempre con il valore di checksum
CRC.
Risposta Slave:
Indirizzo slave 08h
Funzione 04h
Numero di byte 10h
MSB Dato 10h 00h
LSB Dato 10h 00h
--------------------------------------------------- ----
MSB Dato 17h 00h
LSB Dato 17h 00h
MSB CRC 5Eh
LSB CRC 83h
La risposta è composta sempre dall’indirizzo dello
slave, dalla funzione richiesta dal Master e dai dati
dei registri richiesti. La risposta termina sempre con il
valore di checksum CRC.
The DME_CD answer is the following:
01 04 04 00 00 7C C4 DA D7
Where:
01 = DME_CD address (Slave 01)
04 = Function requested by the master
04 = Number of bytes sent by the DME_CD
00 00 7C C4 = Hex value of the total counter 1
= 31940 = 319.40
DA D7 = CRC checksum
FUNCTION 04: READ INPUT REGISTER
The Modbus® function 04 allows to read one or
more consecutive registers from the slave memory.
The address of each measure is given in the tables
2-4 on the final pages of this manual.
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 registers exceeds the
acceptable max number, the DME_CD will return an
error code (see error table).
Master query:
Slave address 08h
Function 04h
MSB address 00h
LSB address 0Fh
MSB register number 00h
LSB register number 08h
MSB CRC C1h
LSB CRC 56h
In the above example, slave 08 is requested for 8
consecutive registers beginning with address 10h.
Thus, registers from 10h to 17h will be returned. As
usual, the message ends with the CRC checksum.
Slave response:
Slave address 08h
Function 04h
Byte number 10h
MSB register 10h 00h
LSB register 10h 00h
--------------------------------------------------- ----
MSB register 17h 00h
LSB register 17h 00h
MSB CRC 5Eh
LSB CRC 83h
The response is always composed of the slave
address, the function code requested by the master
and the contents of the requested registers. The
answer ends with the CRC.