SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Comm.SEC di Valter Foresto
Cell +39 347 0144028 – valter.foresto@commsec.it - valter.foresto@gmail.com
Sede Operativa: Strada della Pronda 66/8bis - 10142 Torino
Sede Legale: Via Francesco Millio 57 – 10141 Torino – Tel. +39 011 337101
Partita IVA: 08775700019 Codice Fiscale: FRSVTR54A11C665T REA: 999654
Revisione 2013-07-01
Valter Foresto
Licenze firmware CAMILLO
Soluzioni e Prodotti Configurabili
per Sistemi di Automazione, Monitoraggio e Controllo Distribuito
• Con le licenze firmware CAMILLO le risorse hardware della piattaforma ospite (come ad
esempio CHAMELEON di EurogiDevices) vengono esposte sulle porte di comunicazione
wired come Ethernet / RS485 / USB-Seriale e sulle porte di comunicazione wireless
come Z-Wave / ZigBee / WiFi e Bluetooth.
• L'uso del Protocollo InterLINK per accedere e gestire le risorse hardware della
piattaforma ospite rende i prodotti hardware con le licenze firmware CAMILLO
estremamente attraenti per rapporto prestazioni/prezzo ed applicabili facilmente nella
realizzazione di applicazioni per Sistemi di Misura, Automazione e Controllo Distribuito
sia locale che remoto.
• Le applicazioni possono essere sviluppate tramite SCADA 'Supervisory Control And Data
Acquisition' o con qualsiasi linguaggio di programmazione che supporti lo scambio di
stringhe ASCII tramite linee Seriali ed Ethernet-Internet TCP/IP che vedono il prodotti
con firmware CAMILLO installato come risorse distribuite in rete accessibili e
controllabili esternamente dal software applicativo sviluppato ad-hoc dal Cliente stesso
o da Comm.SEC su specifica del Cliente.
• Parallelamente al Protocollo InterLINK, sempre presente su tutte le licenze CAMILLO per
permetterne una semplice configurabilità ed utilizzo dell'hardware della piattaforma
ospite, le licenze CAMILLO ROSSO e CAMILLO GIALLO integrano anche il Protocollo
ModbusTCP Server sulla porta di comunicazione Ethernet e ModbusRTU sulla porta di
comunicazione RS485 sia in versione Server (CAMILLO ROSSO) che Client (CAMILLO
GIALLO).
• Il firmware CAMILLO GIALLO realizza inoltre un Gateway sia InterLINK che ModbusTCP
verso ModbusRTU.
Le caratteristiche principali delle Licenze Firmware CAMILLO sono :
----------------------------------------------------------------------
Licenze Firmware "CAMILLO" VERDE ROSSO GIALLO
----------------------------------------------------------------------
Indirizzo IP / DHCP Client X X X
Indirizzo InterLINK Server X X X
InterLINK Server via USB-Seriale X X X
InterLINK Server via HTTP X X X
InterLINK Server via RS485 X - -
----------------------------------------------------------------------
InterLINK / ModbusRTU Gateway - - X
Indirizzo ModbusTCP Server - X X
Indirizzo ModbusRTU Server - X -
Indirizzo ModbusRTU Client - - X
ModbusTCP Server via Ethernet - X X
ModbusRTU Server via RS485 - X -
ModbusRTU Client su RS485 - - X
ModbusTCP / ModbusRTU Gateway - - X
----------------------------------------------------------------------
Sincronizzazione RTC via Internet NTP X X X
Acquisizione Automatica STATO X X X
Trasmissione STATO via SYSLOG/Multicast X X X
Rilevazione Automatica EVENTI X X X
Trasmissione EVENTI via SYSLOG/Multicast X X X
1 / 17
Caratteristiche del Protocollo InterLINK
• Semplice e veloce da comprendere
• Semplice ed immediato da usare
• Utilizzabile manualmente o programmaticamente tramite applicazioni ad-hoc
• Basato sul set di caratteri ASCII raccolti in pacchetti trasmessi velocemente ed in unica
soluzione
• I comandi sono stringhe ASCII raccolte in pacchetti che vengono trasmessi con il
metodo dell'invio da riga di comando con editing di riga
• Le risposte sono stringhe ASCII raccolte in pacchetti e vengono ricevute con il metodo
del display della riga di risposta
• Utilizzabile manualmente via Terminale Seriale RS-232 o RS-485 o USB-Seriale
• Utilizzabile manualmente su Ethernet / Internet via Web-Browser HTTP ed
opzionalmente via Terminali TELNET
• Utilizzabile tramite qualsiasi applicazione scritta in un linguaggio di programmazione che
supporti linee Seriali e/o Ethernet / Internet con protocollo TCP/IP
• Protocollo con feedback degli errori formali molto robusto soprattutto quando usato su
Ethernet / Internet con protocollo TCP/IP
• Tutti i canali di comunicazione previsti dalla licenza firmware possono funzionare
contemporaneamente
• Le singole transazioni comando / risposta sui singoli canali di comunicazione sono
protette temporalmente e sono eseguite dall' inizio alla fine con il criterio first-in / first-
out in fase di acquisizione / esecuzione
• Pacchetti con 'errori di comunicazione' o 'malformati' che non rispettano il Protocollo
InterLINK vengono 'scartati in modo silente', mentre i pacchetti ben formati ottengono
sempre una risposta dal Protocollo Applicativo di InterLINK con la segnalazione puntuale
degli eventuali errori rilevati
• Tutti le licenze firmware Comm.SEC della Linea di firmware configurabili CAMILLO
utilizzano il paradigma, il protocollo di comunicazione ed il protocollo applicativo
InterLINK
2 / 17
Risorse Hardware e Registri InterLINK e Modbus
Le RISORSE di qualunque piattaforma hardware sono rappresentate dal firmware CAMILLO che
implementa InterLINK e Modbus da aree di memoria, lineari e limitate, a cui si accede tramite
Comandi di Lettura e Scrittura. Le aree di memoria associate alle RISORSE (persistenti per
EEPROM/FRAM o volatili per RAM) contengono i dati scambiati sempre e comunque in unità da
16 bits dette REGISTRI nel formato big-endian (cioè byte più significativo per primo seguito dal
byte meno significativo) indipendentemente dall' architettura del processore utilizzato dalla
piattaforma hardware ospite.
Le diverse RISORSE sono raggruppate in sezioni diverse identificate ed accessibili mediante i
seguenti criteri:
-------------------------------------------------------------------------------
'I'nputs Read-Only INPUTS hardware dependent registers variables
'C'onfigurations Read-Only EEPROM/FRAM persistent parameters
'P'arameters Read-Write EEPROM/FRAM persistent parameters
'S'tored settings Read-Write EEPROM/FRAM persistent settings
'V'olatile settings Read-Write RAM volatile settings (copyed from 'S'tored
settings at Power On Reset)
'E'rrors up-counters Read-Write RAM volatile up-counter registers
'L'CD Display image Read-Write RAM image for the Liquid Cristal Display
'T'ime RTC image Read-Write RAM image for the Real Time Clock
'H'oldings Read-Write RAM volatile registers variables and outputs
'M'odbus resources Read-Write Modbus registers / variables
-------------------------------------------------------------------------------
Tutte le RISORSE possono essere sempre LETTE 'R'ead mentre possono essere SCRITTE 'W'rite
quelle che non siano di tipo 'I'nputs o 'C'onfigurations che sono invece 'solo leggibili'
Tabella delle Risorse Hardware e dei Registri InterLINK e Modbus per piattaforma
hardware CHAMELEON di EurogiDevices
----------------------------------------------------------------------------------------------------
Tipo RISORSA Indirizzo Modbus Numero di registri Comando InterLINK
(Decimale) (16 bits, big-endian)
RW Formato: “_cc,ii,oo,ll[,dd,dd, ...]_”
----------------------------------------------------------------------------------------------------
Ingressi Hardware 000 16 X- "_ri,0,0,11_"
Uscite (Holdings RAM) 016 16 XX "_rh,0,2,4_" "wh,0,3,1,255_"
"_wh,0,0,4,xFF,255,x80,128_"
Configurazione EEPROM 032 16 X- "_rc,0,0,16_"
Parametri EEPROM 048 32 XX "_rp,0,0,16_" "_rp,0,17,13_"
"_wp,0,0,1,1234_"
Impostazioni EEPROM 080 16 XX "_rs,0,0,16_"
"_ws,0,0,4,1234,x56AB,sCI,sAO_"
Impostazioni RAM 096 16 XX "_rv,0,0,16_"
"_wv,0,0,3,x800,1,x23_"
Contatori Errore RAM 112 16 XX "_re,0,0,16_" "_re,0,17,16_"
"_we,0,15,4,0,0,0_"
Display (copia RAM) 600 16 XX "_rl,0,0,16_"
"_wl,0,16,3,sIC,sOA,x2020_"
Orologio (copia RAM) 700 32 XX "_rt,0,0,16_" "_rt,0,17,16_"
"_wt,0,0,3,x0230,x0116,x0522_"
3 / 17
Esempio di Power On Reset visto dalla Console su piattaforma CHAMELEON 1
La Console è accessibile dalla porta USB-Seriale alla velocità di 115200 bps N81 tamite
Terminale (es: PuTTY http://www.putty.org/ ).
Nell' ordine vengono riportati:
• Licenza Firmware installata
• Piattaforma hardware su cui è installata la licenza CAMILLO
• La revisione Firmware nel formato anno-mese-giorno
• L' indirizzo a 16 bits della porta InterLINK usata dal firmware CAMILLO
• Gli indirizzi Modbus RTU e TCP (porta 502) usati da firmware CAMILLO (presenti solo nelle
versioni ROSSO e GIALLO, essendo il VERDE esclusivamente basato su InterLINK)
• L' indirizzo IP della porta Ethernet (192.168.10.200 è il default)
• L' indirizzo IP del Server Syslog sulla porta 514 a cui il firmware CAMILLO invia STATI ed EVENTI
in modalità automatica quando impostato per farlo tramite la bitmask relativa via InterLINK o
Modbus. In questo caso sono abilitati entrambi, lo stato <STS> è alla Console ed al Server Syslog
di default ogni 20 secondi, mentri gli eventi <EVT> sono inviati ogni qualvolta viene rilevato un
cambiamento di stato sugli ingressi digitali od analogici, preceduti dal carattere '#' per
evidenziarli nella stringa XML trasmessa
• La port 80 HTTP è sempre abilitata per inviare e ricevere pacchetti InterLINK tramite web-
services
• Se la licenza CAMILLO prevede ModbusTCP viene indicato se il comportamento è Server o
Server / Gateway
• Viene specificato l' uso fatto dalla licenza per la porta RS485
• Viene letto l' RTC, quando presente, che tipicamente è impostato per lavorare in formato UTC, se
abilitata, come di default, la funzione di sincronizzazione dell' RTC questo viene eseguito
connettendosi con il Server di Tempo NTP in Internet configurato dopo 6 secondi dal Power On
Reset e ripetuto di default ogni 12 ore
*** InterLINK 'CAMILLO GIALLO' www.commsec.it ***
* Platform: CHAMELEON
* Firmware: 20130523
* USB-Serial: Console and InterLINK Server
* InterLINK ID: 0
* ModbusRTU Addr: 1, ModbusTCP Addr: 247
* Camillo IP: 192.168.10.200
* Syslog Server IP: 192.168.10.254
* HTTP: InterLINK Server
* ModbusTCP: Server / ModbusRTU Gateway
* RS485: ModbusRTU Client used by InterLINK and ModbusTCP Gateway [9600 N 8 1]
* RTC [UTC and UNIX] Time: 2013/05/23 15:09:55 [1369321795]
* <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0105 #0979 #0980 #0980 #0980 #0980 #0981 ] </EVT>
* NTP Server reference time request ...
* NTP Server response is ...
* NTP Time (seconds since Jan 1 1900): 3578303452
* UNIX Time (seconds since Jan 1 1970): 1369314652
* UTC Time: 13:10:52
* <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0106 0979 0980 0980 0980 0980 0981 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 13:11:04 [1369314664]
* <EVT> i[0] t[ 32] ao[000 000 000 000] di[#0 1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 35] ao[000 000 000 000] di[ 0 #0 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 37] ao[000 000 000 000] di[ 0 #1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 38] ao[000 000 000 000] di[ 0 #0 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 39] ao[000 000 000 000] di[#1 #1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT>
* <STS> i[0] t[ 40] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 13:11:24 [1369314684]
* <EVT> i[0] t[ 51] ao[000 000 000 000] di[ 1 1 1 1] ai[#0000 0979 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 56] ao[000 000 000 000] di[ 1 1 1 1] ai[#0047 0979 0980 0980 0980 0980 0981 ] </EVT>
4 / 17
Esempi di Comandi InterLINK
I commenti sono riportati in rosso nel log seguente
* Console CAMILLO riporta sempre sulla Console l' origine del canale di comunicazione con cui stà eseguendo l'
attuale transazione
_RI,0,0,11_
_RI,0,0,11,x0001,x0001,x0001,x0001,x03C7,x03D4,x03D4,x03D4,x03D5,x03D4,x03D5_
Read Inputs, i primi quattro registri rappresentano i 4 tasti di un CHAMELEON 1, i successivi 7 gli ingressi
analogici a 10 bits (0...10Vdc)
* Console
_WI,0,0,1,1_
_-2_
Gli Inputs non possono essere scritti !
Errore con causa 2 (dalla tabella Errori InterLINK → COMMAND_UNKNOWN_ERROR)
* Console
_RC,0,0,16_
_RC,0,0,16,xA5A5,x001F,x97FF,x0000,x0000,x0001,x0000,x0001,x436F,x6D6D,x2E53,x4543,x2D54,x6F72,x696E,x6F20_
I valori di Configurazione possono essere letti, per il loro significato vedere la descrizione dei Registri di
Configurazione
* Console
_WC,0,0,1,0_
_-2_
I valori di Configurazione non possono essere scritti !
Errore con causa 2 (dalla tabella Errori InterLINK → COMMAND_UNKNOWN_ERROR)
* Console
_RP,0,0,16_
_RP,0,0,16,x0000,x01F7,xC0A8,x0AC8,xFFFF,xFF00,xC0A8,x0A01,xC0A8,x0AFE,xC0A8,x0AFF,xC1CC,x72E8,x0000,x0000_
I valori dei Parametri operativi possono essere essere letti, per il loro significato vedere la descrizione dei
Registri dei Parametri
* Console
_RP,0,17,12_
_RP,0,17,12,x0000,x0000,x0000,x0000,x0000,x0808,x0808,x0000,x0000,x0050,x01F6,x0202_
InterLINK non legge/scrive più di 16 registri per volta per mantenere ridotti i buffer RAM con cui vengono
scambiati dati con il mondo esterno, così, come in questo caso, essendo 29 i Registri dei Parametri sono stati
letti i primi sedici seguiti poi dai rimanenti 13
* Console
_WP,0,0,1,X1234_
_WP,0,0,1,X1234_
I Parametri operativi possono essere variati, qui ad esempio di stà variando l' indirizzo InterLINK che verrà
utilizzato, come avviene anche per tutti gli altri parametri come ad esempio l' indirizzo IP, SOLO al successivo
Power On Reset … così con il comando seguente leggiamo e riportiamo al default il registro precedentemente
modificato
* Console
_RP,0,0,1_
_RP,0,0,1,x1234_
* Console
_WP,0,0,1,0_
_WP,0,0,1,0_
* Console
_RS,0,0,16_
_RS,0,0,16,x0000,x0014,x0005,xA8C0,xFFFF,xFFFF,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_
I Setting sono registri operativi in EEPROM che vengono copiati nei registri RAM Volatiles al successivo Power On
Reset
* Console
_WS,0,0,1,3_
_WS,0,0,1,3_
Quì stiamo impostando la trasmissione automatica di STATO ed EVENTI ...
* Console
_WV,0,0,1,X8000_
_WV,0,0,1,X8000_
… che rendiamo operativi immediatamente richiedendo un Power On Reset programmatico scrivendo la maschera
REMOTE_SOFT_RESET nel registro RAM Volatiles 0 detto 'utilityFunctionsMasks' e descritto nel seguito …
… viene eseguito il Power On Reset indotto dalla presenza della maschera REMOTE_SOFT_RESET nel registro Volatile
'utilityFunctionsMasks'
*** InterLINK 'CAMILLO GIALLO' www.commsec.it ***
* Platform: CHAMELEON
* Firmware: 20130523
* USB-Serial: Console and InterLINK Server
* InterLINK ID: 0
* ModbusRTU Addr: 1, ModbusTCP Addr: 247
* Camillo IP: 192.168.10.200
* Syslog Server IP: 192.168.10.254
5 / 17
* HTTP: InterLINK Server
* ModbusTCP: Server / ModbusRTU Gateway
* RS485: ModbusRTU Client used by InterLINK and ModbusTCP Gateway [9600 N 8 1]
* RTC [UTC and UNIX] Time: 2013/05/23 13:29:41 [1369315781]
* <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0967 #0980 #0980 #0980 #0980 #0980 #0981 ] </EVT>
* <EVT> i[0] t[ 8] ao[000 000 000 000] di[#0 1 1 1] ai[ 0967 0980 0980 0980 0980 0980 0981 ] </EVT>
* <EVT> i[0] t[ 9] ao[000 000 000 000] di[#1 1 1 1] ai[ 0967 0980 0980 0980 0980 0980 0981 ] </EVT>
* <EVT> i[0] t[ 15] ao[000 000 000 000] di[ 1 1 1 1] ai[#0944 0980 0980 0980 0980 0980 0981 ] </EVT>
* <EVT> i[0] t[ 16] ao[000 000 000 000] di[ 1 1 1 1] ai[#0934 0980 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 17] ao[000 000 000 000] di[ 1 1 1 1] ai[#0911 0980 0980 0980 0981 0980 0981 ] </EVT>
* <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0910 0980 0980 0980 0980 0980 0981 ] </STS>
* <STS> i[0] t[ 40] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0911 0980 0980 0980 0981 0980 0982 ] </STS>
… la maschera REMOTE_SOFT_RESET nel registro Volatile 'utilityFunctionsMasks' è stata riportata a 0 dal Power On
Reset e come si visto si sono attivate le funzionalità richieste.
Ora per comodità le fermiamo …
* Console
_WV,0,0,1,0_
_WV,0,0,1,0_
… e leggiamo i valori dei registri Variables (vedi valori dei registri Settings e Variables nel seguito)
* Console
_RV,0,0,16_
_RV,0,0,16,x0000,x0014,x0005,xA8C0,xFFFF,xFFFF,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_
Leggiamo ora i registri che conteggiano gli Errors di sistema invrementando il loro valore (vedi tabella Errori
di sistema più avanti) ...
* Console
_RE,0,0,16_
_RE,0,0,16,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_
… scriviamo e poi rileggiamo il registro 2 (HTTP_OVERRUN_ERROR)
* Console
_WE,0,2,1,X1234_
_WE,0,2,1,X1234_
* Console
_RE,0,0,4_
_RE,0,0,4,x0000,x0000,x1234,x0000_
Leggiamo l' intero contenuto dell' LCD di CHAMELEON 1 (il valore nei registri relativi ai caratteri ASCII
attualmente visualizzati dall' LCD sono in formato Little-Endian a causa dell'architettura del processore ospite
sul quale InterLINK scrive e legge in formato Big-Endian)
* Console
_RL,0,0,16_
_RL,0,0,16,x6920,x694C,x6B6E,x2020,x4143,x494D,x4C4C,x204F,x4720,x6169,x6C6C,x206F,x3032,x3331,x3530,x3332_
Leggiamo qui invece i primi 32 bytes (16 registri) dei 64 bytes (32 registri) dell' RTC di CHAMELEON 1
* Console
_RT,0,0,16_
_RT,0,0,16,x3123,x0013,x0523,x0013,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_
… dovrebbe, rileggendo i 16 registri, risultare evidente in quale byte l' RTC rappresenta i secondi
* Console
_RT,0,0,6_
_RT,0,0,6,x3140,x0013,x0523,x0013,x0000,x0000_
Essendo un CAMILLO GIALLO quello usato in questo momento, sono disponibili le funzioni di Gateway InterLINK /
ModbusRTU che sono qui usate per connettersi ad un DAT3011 di DATEXEL per leggerne i primi 16 registri ...
* Console
_RM,1,0,16_
* Tx RS485: 01 03 00 00 00 10 44 06
* Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 02 07 00 04 00 00 03 00 0A 00 00 00 00 00
00 0A 04
_RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0202,x0700,x0400,x0003,x000A,x0000,x0000,x0000_
… attuare l' uscita 1 nel byte alto del registro 9 ...
* Console
_WM,1,8,2,0,X200_
* Tx RS485: 01 10 00 08 00 02 04 00 00 02 00 F3 69
* Rx RS485: 01 10 00 08 00 02 C0 0A
_WM,1,8,2,0,X200_
… e rileggendo lo stato dei 16 registri per verificarne l' esecuzione
* Console
_RM,1,0,16_
* Tx RS485: 01 03 00 00 00 10 44 06
* Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 02 00 04 00 00 03 00 0A 00 00 00 00 00
00 8D 00
_RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0200,x0200,x0400,x0003,x000A,x0000,x0000,x0000_
6 / 17
HTTP Web-Services
I comandi InterLINK sono stati dati negli esempi precedenti da Console, ma si può utilizzare un
qualsiasi browser web invece della Console per comandare un Server InterLINK remoto via
HTTP web-services:
Il comando viene scritto nell' URL (nell'immagine di esempio
“http://192.168.10.200/_wm,1,9,1,x100_”) ed inviato premento il tasto Return o F5, si ottiene
una pagina web dal Server InterLINK con la risposta al comando inviato.
Esempi di Comandi Modbus
Per questa dimostrazione viene utilizzato come Client ModbusTCP e ModbusRTU il software
ComTestPro di BaseBlock Software (http://www.baseblock.com/).
Gli indirizzi ModbusTCP e ModbusRTU sono contenuti nel registro 1 dei Parametri EEPROM che
ha come default il valore esadecimale 0x01F7, in particolare il byte più significativo (default 1)
è l' indirizzo ModbusRTU mentre il meno significativo (default 247 decimale pari a 0xF7
esadecimale) è l' indirizzo ModbusTCP.
Il valore 1 e 247 sono i limiti di indirizzamento del protocollo Modbus ed il firmware CAMILLO
usa nella gestione lato InterLINK il concetto che “qualunque indirizzo nel range 1 … 247 è
sempre considerato un indirizzo Modbus, mentre tutti gli altri (0, 248, … , 65535) possono
essere indirizzi InterLINK” contenuto nel registro 0 dei Parametri EEPROM che ha come default
il valore 0 come indirizzo InterLINK. Questo concetto è utilizzato dal firmware CAMILLO GIALLO
per effettuare il Gateway da InterLINK lato Ethernet a ModbusRTU sul bus RS485.
La documentazione Modbus di riferimento, sia a livello applicativo che a livello di struttura dei
pacchetti TCP che Seriale RS485 che vedremo negli esempi seguenti, è reperibile sul sito
ufficiale http://www.modbus.org/specs.php come “Modbus Specifications and Implementation
Guides” che rappresentano le uniche specifiche ufficiali e pubbliche del protocollo Modbus.
L' obbiettivo di InterLINK nei confronti di Modbus è quello di RENDERE
TRASPARENTE ALL' UTILIZZATORE LE DIFFICOLTA' DI MODBUS come nel prodotto
firmware CAMILLO GIALLO, essendo però Modbus uno standard industriale molto
affermato le versioni CAMILLO ROSSO e CAMILLO GIALLO espongono oltre a
InterLINK tutte le funzionalità Modbus di Client, Server e Gateway come descritto nella
tabella, presentata in precedenza, che ne sintetizza le funzionalità nei confronti di ModbusTCP
7 / 17
e ModbusRTU.
Questa prima serie di esempi usa CAMILLO ROSSO che espone un Server Modbus sia sulla
porta 502 TCP che sulla porta RTU su bus RS485.
Vengono presentati i comandi Modbus su entrambe le porte di comunicazione TCP e
RTU/RS485, per questo la presentazione è un po' lunga ma non particolarmente complessa, i
commenti sono al solito in rosso.
Power On Reset di un CAMILLO ROSSO
*** InterLINK 'CAMILLO ROSSO' www.commsec.it ***
* Platform: CHAMELEON
* Firmware: 20130523
* USB-Serial: Console and InterLINK Server
* InterLINK ID: 0
* ModbusRTU Addr: 1, ModbusTCP Addr: 247
* Camillo IP: 192.168.10.200
* Syslog Server IP: 192.168.10.254
* HTTP: InterLINK Server
* ModbusTCP: Server
* RS485: ModbusRTU Server [9600 N 8 1]
* RTC [UTC and UNIX] Time: 2013/05/23 18:22:25 [1369333345]
* <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0978 #0978 #1015 #1015 #0979 #0977 #0978 ] </EVT>
* NTP Server reference time request ...
* NTP Server response is ...
* NTP Time (seconds since Jan 1 1900): 3578315906
* UNIX Time (seconds since Jan 1 1970): 1369327106
* UTC Time: 16:38:26
* <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS>
Togliamo l' invio automatico di STATO es EVENTI usando la Console (disattiviamo tutte le funzioni azzerando il
registro 0 Volatiles)
* Console
_WV,0,0,1,0_
_WV,0,0,1,0_
Nel pacchetto TCP trascuriamo i primi 5 bytes (vedi documenti ufficiali Modbus consigliati in precedenza), il
sesto (0x06) è la lunghezza PDU comando che riporta:
• 0xF7 indirizzo ModbusTCP di destinazione
• 0x03 funzione di Read Multiple Registers
• 0x0000 indirizzo registro Modbus iniziale
• 0x000B lunghezza / numero di registri da leggere, 11 in questo caso
• non c'è controllo CRC in quanto realizzato a livello IP tramite CRC-32
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 00 00 0B
* Tx ModbusTCP: 00 00 00 00 00 19 F7 03 16 00 01 00 01 00 01 00 01 03 D2 03 D2 03 F7 03 F7 03 D3 03 D1 03 D2
La risposta riporta 0x19 (25 decimale) bytes di PDU nella risposta:
• 0xF7 indirizzo ModbusTCP
• 0x03 funzione di Read Multiple Registers, senza errori
• 0x16 (22 bytes) lunghezza degli 11 valori dei registri letti
• 22 bytes contenenti gli 11 registri rappresentati in forma Big-Endian
Lettura dei 16 registri Configurations (indirizzo Modbus iniziale 100 decimale, come da Tabella delle Risorse
Modbus vista in precedenza)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 64 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 A5 A5 00 1F 97 FF 00 00 00 00 00 01 00 00 00 01 43 6F 6D 6D 2E 53 45
43 2D 54 6F 72 69 6E 6F 20
Lettura dei primi 16 registri Parameters (indirizzo Modbus iniziale 200 decimale, come da Tabella delle Risorse
Modbus vista in precedenza)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 C8 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 00 00 01 F7 C0 A8 0A C8 FF FF FF 00 C0 A8 0A 01 C0 A8 0A FE C0 A8 0A
FF C1 CC 72 E8 00 00 00 00
Lettura della seconda parte di registro Settings (indirizzo Modbus iniziale 317 decimale, con lunghezza 12)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 D9 00 0C
* Tx ModbusTCP: 00 00 00 00 00 1B F7 03 18 00 00 00 00 00 00 00 00 00 00 08 08 08 08 00 00 00 00 00 50 01 F6 02
02
Lettura dei 16 registri Settings (indirizzo Modbus iniziale 300 decimale, come da Tabella delle Risorse Modbus
vista in precedenza)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 01 90 00 0C
* Tx ModbusTCP: 00 00 00 00 00 1B F7 03 18 00 00 00 14 00 05 A8 C0 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00
00
Scrittura del registro 0 Volatiles (indirizzo Modbus iniziale 400 decimale, con valore 0x0007 per l'attivazione
8 / 17
delle funzioni automatiche di reports STATO, EVENTI e TEMPO UTC)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 09 F7 10 01 90 00 01 02 00 07
* Tx ModbusTCP: 00 00 00 00 00 06 F7 10 02 90 00 01
* <STS> i[0] t[220] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 16:42:08 [1369327328]
* <EVT> i[0] t[233] ao[000 000 000 000] di[ 1 1 1 #0] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </EVT>
* <EVT> i[0] t[236] ao[000 000 000 000] di[ 1 1 1 #1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </EVT>
* <STS> i[0] t[240] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 16:42:28 [1369327348]
Riscrittura del registro 0 Volatiles per disabilitare le funzioni automatiche di reports STATO, EVENTI e TEMPO
UTC attivate dal comando precedente
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 09 F7 10 01 90 00 01 02 00 00
* Tx ModbusTCP: 00 00 00 00 00 06 F7 10 02 90 00 01
Lettura dei primi 16 registri Errors
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 01 F4 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00
Scrittura dei primi due registri Errors con i valori 0x4142 e 0x4243
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 0B F7 10 01 F4 00 02 04 41 42 42 43
* Tx ModbusTCP: 00 00 00 00 00 06 F7 10 04 F4 00 02
Rilettura dei primi 16 registri Errors per verifica
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 01 F4 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 41 42 42 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00
Scrittura dei primi 4 caratteri (2 registri) LCD all' indirizzo Modbus iniziale 600
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 0B F7 10 02 58 00 02 04 41 42 42 43
* Tx ModbusTCP: 00 00 00 00 00 06 F7 10 04 58 00 02
Rilettura dei 16 registri LDC
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 58 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 41 42 42 43 6B 6E 20 20 41 43 49 4D 4C 4C 20 4F 52 20 73 6F 6F 73 20
20 30 32 33 31 35 30 33 32
Lettura dei 16 registri LCD
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 BC 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 45 53 00 16 05 23 00 13 61 E9 D4 D6 5E 45 45 94 45 FE DC 65 E5 49 3C
14 6A 7E 00 20 5B 59 3B DC
Rilettura dei primi 16 registri RTC
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 BC 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 46 01 00 16 05 23 00 13 61 E9 D4 D6 5E 45 45 94 45 FE DC 65 E5 49 3C
14 6A 7E 00 20 5B 59 3B DC
Rilettura dei primi 16 registri RTC, notare che sono trascorsi 2 secondi dal precedente comando (byte in verde)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 BC 00 10
* Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 46 03 00 16 05 23 00 13 61 E9 D4 D6 5E 45 45 94 45 FE DC 65 E5 49 3C
14 6A 7E 00 20 5B 59 3B DC
Lettura dei 6 registri Holdings
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 03 20 00 06
* Tx ModbusTCP: 00 00 00 00 00 0F F7 03 0C 00 00 00 00 00 00 00 00 00 00 00 00
Scrittura dei registri Holdings 0 con valore 0x00FF ed 1 con valore 0x0000 (le uscite PWM sono valori ad 8 bits
che vanno così da 0x0000 a 0x00FF)
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 0B F7 10 03 20 00 02 04 00 FF 00 00
* Tx ModbusTCP: 00 00 00 00 00 06 F7 10 04 20 00 02
Rilettura dei 6 registri Holdings per veriica
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 F7 03 03 20 00 06
* Tx ModbusTCP: 00 00 00 00 00 0F F7 03 0C 00 FF 00 00 00 00 00 00 00 00 00 00
#### da questo punto in poi vengono ripetuti in senso inverso i comandi sul lato ModbusRTU ####
… si provi a descrivere autonomamente le azioni svolte partendo dalle informazioni acquisite nelle descrizioni
precedenti delle azioni eseguite lato ModbusTCP
...
* ModbusRTU
* Rx RS485: 01 03 03 20 00 06 C4 46
* Tx RS485: 01 03 0C 00 FF 00 00 00 00 00 00 00 00 00 00 A0 67
9 / 17
...
* ModbusRTU
* Rx RS485: 01 10 03 20 00 02 04 00 00 00 FF A5 07
* Tx RS485: 01 10 04 20 00 02 41 32
...
* ModbusRTU
* Rx RS485: 01 03 03 20 00 06 C4 46
* Tx RS485: 01 03 0C 00 00 00 FF 00 00 00 00 00 00 00 00 D6 84
...
* ModbusRTU
* Rx RS485: 01 03 02 BC 00 06 05 94
* Tx RS485: 01 03 0C 48 11 00 16 05 23 00 13 61 E9 D4 D6 82 64
...
* ModbusRTU
* Rx RS485: 01 03 02 BC 00 06 05 94
* Tx RS485: 01 03 0C 48 12 00 16 05 23 00 13 61 E9 D4 D6 8D 20
...
* ModbusRTU
* Rx RS485: 01 03 02 58 00 06 45 A3
* Tx RS485: 01 03 0C 41 42 42 43 6B 6E 20 20 41 43 49 4D EB 6F
...
* ModbusRTU
* Rx RS485: 01 10 02 58 00 02 04 20 20 21 21 3C 17
* Tx RS485: 01 10 04 58 00 02 C1 2B
...
* ModbusRTU
* Rx RS485: 01 03 02 58 00 06 45 A3
* Tx RS485: 01 03 0C 20 20 21 21 6B 6E 20 20 41 43 49 4D 21 46
...
* ModbusRTU
* Rx RS485: 01 03 01 F4 00 06 85 C6
* Tx RS485: 01 03 0C 41 42 42 43 00 00 00 00 00 00 00 00 B7 D8
...
* ModbusRTU
* Rx RS485: 01 10 01 F4 00 02 04 00 00 00 00 F0 88
* Tx RS485: 01 10 04 F4 00 02 01 0A
...
* ModbusRTU
* Rx RS485: 01 03 01 F4 00 06 85 C6
* Tx RS485: 01 03 0C 00 00 00 00 00 00 00 00 00 00 00 00 93 70
...
* ModbusRTU
* Rx RS485: 01 03 01 90 00 06 C4 19
* Tx RS485: 01 03 0C 00 00 00 14 00 05 A8 C0 FF FF FF FF 21 1D
...
* ModbusRTU
* Rx RS485: 01 10 01 90 00 01 02 00 07 EA 02
* Tx RS485: 01 10 02 90 00 01 00 5C
* <STS> i[0] t[700] ao[000 255 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 16:50:30 [1369327830]
* <EVT> i[0] t[709] ao[000 255 000 000] di[ 1 1 1 #0] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </EVT>
* <EVT> i[0] t[710] ao[000 255 000 000] di[ 1 1 1 #1] ai[ 0978 0978 1016 1015 0979 0977 0978 ] </EVT>
...
* ModbusRTU
* Rx RS485: 01 10 01 90 00 01 02 00 00 AB C0
* Tx RS485: 01 10 02 90 00 01 00 5C
...
* ModbusRTU
* Rx RS485: 01 10 01 2C 00 01 02 00 00 B1 3C
* Tx RS485: 01 10 02 2C 00 01 C1 B8
...
* ModbusRTU
* Rx RS485: 01 03 01 2C 00 06 05 FD
* Tx RS485: 01 03 0C 00 00 00 14 00 05 A8 C0 FF FF FF FF 21 1D
...
* ModbusRTU
* Rx RS485: 01 10 00 C8 00 01 02 12 34 BB 6F
* Tx RS485: 01 10 02 C8 00 01 81 8F
...
* Console
_RI,0,0,11_
_RI,0,0,11,x0001,x0001,x0001,x0001,x03D2,x03D2,x03F7,x03F7,x03D3,x03D1,x03D2_
10 / 17
...
* ModbusRTU
* Rx RS485: 01 10 00 C8 00 01 02 00 00 B6 18
* Tx RS485: 01 10 02 C8 00 01 81 8F
...
* ModbusRTU
* Rx RS485: 01 03 00 C8 00 06 44 36
* Tx RS485: 01 03 0C 00 00 01 F7 C0 A8 0A C8 FF FF FF 00 65 B5
...
* ModbusRTU
* Rx RS485: 01 03 00 64 00 06 84 17
* Tx RS485: 01 03 0C A5 A5 00 1F 97 FF 00 00 00 00 00 01 05 06
...
* ModbusRTU
* Rx RS485: 01 10 00 64 00 01 02 00 00 AE 74
* Tx RS485: 01 90 01 8D C0
...
* ModbusRTU
* Rx RS485: 01 03 00 00 00 06 C5 C8
* Tx RS485: 01 03 0C 00 01 00 01 00 01 00 01 03 D2 03 D2 97 CC
...
* ModbusRTU
* Rx RS485: 01 10 00 00 00 01 02 00 00 A6 50
* Tx RS485: 01 90 01 8D C0
...
* ModbusRTU
* Rx RS485: 01 10 01 90 00 01 02 04 00 A9 00
* Tx RS485: 01 10 02 90 00 01 00 5C
...
* ModbusRTU
* Rx RS485: 01 10 01 90 00 01 02 40 00 9A 00
* Tx RS485: 01 10 02 90 00 01 00 5C
...
*** InterLINK 'CAMILLO ROSSO' www.commsec.it ***
* Platform: CHAMELEON
* Firmware: 20130523
* USB-Serial: Console and InterLINK Server
* Set EEPROM Configurations and Parameters default
* InterLINK ID: 0
* ModbusRTU Addr: 1, ModbusTCP Addr: 247
* Camillo IP: 192.168.10.200
* Syslog Server IP: 192.168.10.254
* HTTP: InterLINK Server
* ModbusTCP: Server
* RS485: ModbusRTU Server [9600 N 8 1]
* RTC [UTC and UNIX] Time: 2013/05/23 18:37:39 [1369334259]
* <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0978 #0978 #1015 #1015 #0979 #0977 #0978 ] </EVT>
* <EVT> i[0] t[ 13] ao[000 000 000 000] di[ 1 1 1 #0] ai[ 0978 0978 1015 1015 0979 0977 0977 ] </EVT>
* <EVT> i[0] t[ 15] ao[000 000 000 000] di[ 1 1 1 #1] ai[ 0978 0978 1016 1015 0979 0977 0978 ] </EVT>
* <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 18:37:59 [1369334279]
* <STS> i[0] t[ 40] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0977 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 18:38:20 [1369334300]
* <STS> i[0] t[ 60] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1016 1015 0979 0977 0978 ] </STS>
* RTC [UTC and UNIX] Time: 2013/05/23 18:38:40 [1369334320]
11 / 17
Questa seconda serie di esempi usa invece CAMILLO GIALLO che espone un Server
ModbusTCP sulla porta 502 e che fa anche da Gateway ModbusTCP verso la porta ModbusRTU
su bus RS485. Gli stessi esempi visti per CAMILLO ROSSO lato ModbusTCP valgono anche per
CAMILLO GIALLO. La rete RS485 è questa volta però Client ModbusRTU che viene pilotato
tramite ModbusTCP fornendo come indirizzo ModbusTCP non quello relativo a CAMILLO
GIALLO ma bensì dei componenti ModbusRTU connessi sul lato Client della rete RS485, in
questo caso un DAT3011 di DATEXEL.
*** InterLINK 'CAMILLO GIALLO' www.commsec.it ***
* Platform: CHAMELEON
* Firmware: 20130523
* USB-Serial: Console and InterLINK Server
* InterLINK ID: 0
* ModbusRTU Addr: 1, ModbusTCP Addr: 247
* Camillo IP: 192.168.10.200
* Syslog Server IP: 192.168.10.254
* HTTP: InterLINK Server
* ModbusTCP: Server / ModbusRTU Gateway
* RS485: ModbusRTU Client used by InterLINK and ModbusTCP Gateway [9600 N 8 1]
* RTC [UTC and UNIX] Time: 2013/05/23 17:03:41 [1369328621]
* <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0910 #0980 #0980 #0980 #0980 #0980 #0982 ] </EVT>
* <EVT> i[0] t[ 17] ao[000 000 000 000] di[ 1 1 1 #0] ai[ 0910 0980 0980 0980 0981 0980 0982 ] </EVT>
* <EVT> i[0] t[ 18] ao[000 000 000 000] di[ 1 1 1 #1] ai[ 0910 0980 0980 0980 0981 0980 0982 ] </EVT>
* <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0910 0980 0980 0980 0980 0980 0981 ] </STS>
Disabilitazione delle funzioni automatiche di trasmissione STATO ed EVENTI
* Console
_WV,0,0,1,0_
_WV,0,0,1,0_
Lettura dei primi 16 registri del modulo DAT3011 con indirizzo ModbusRTU 1 dalla porta RS485 utilizzata come
Client ModbusRTU dal Gateway ModbusTCP
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 01 03 00 00 00 10
* Tx RS485: 01 03 00 00 00 10 44 06
* Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 02 00 04 00 00 03 00 0A 00 00 00 00 00
00 8D 00
* Tx ModbusTCP: 00 00 00 00 00 23 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 02 00 04 00 00
03 00 0A 00 00 00 00 00 00
Attivazione delle 3 uscite del DAT3011 tramite scrittura remota del suo registro 9 con il valore 0x0700
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 09 01 10 00 09 00 01 02 07 00
* Tx RS485: 01 10 00 09 00 01 02 07 00 A4 F9
* Rx RS485: 01 10 00 09 00 01 D1 CB
* Tx ModbusTCP: 00 00 00 00 00 06 01 10 00 09 00 01
Rilettura dei 16 registri del modulo DAT3011 con indirizzo ModbusRTU 1 a partire dal suo registro 9
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 01 03 00 09 00 10
* Tx RS485: 01 03 00 09 00 10 94 04
* Rx RS485: 01 03 20 07 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF FF 06 00 00 00 00 00 00
00 78 E1
* Tx ModbusTCP: 00 00 00 00 00 23 01 03 20 07 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF
FF 06 00 00 00 00 00 00 00
Rilettura manuale da Console tramite comando InteLINK dei primi 16 registri del modulo DAT3011 … si noti la
semplicità e la potenza del comando manuale del Gateway InterLINK / ModbusRTU di CAMILLO GIALLO
* Console
_RM,1,0,16_
* Tx RS485: 01 03 00 00 00 10 44 06
* Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 07 00 04 00 00 03 00 0A 00 00 00 00 00
00 88 05
_RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0200,x0700,x0400,x0003,x000A,x0000,x0000,x0000_
Comando InterLINK di attivazione delle uscite 1 e 3 del Modulo DAT3011 impostate dalla parte alta del registro 9
… si noti la semplicità e la potenza del comando manuale del Gateway InterLINK / ModbusRTU di CAMILLO GIALLO
* Console
_WM,1,9,1,X500_
* Tx RS485: 01 10 00 09 00 01 02 05 00 A5 99
* Rx RS485: 01 10 00 09 00 01 D1 CB
_WM,1,9,1,X500_
Rilettura manuale da Console dei primi 16 registri del modulo DAT3011
* Console
_RM,1,0,16_
* Tx RS485: 01 03 00 00 00 10 44 06
* Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 05 00 04 00 00 03 00 0A 00 00 00 00 00
00 8B C7
_RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0200,x0500,x0400,x0003,x000A,x0000,x0000,x0000_
12 / 17
Rilettura via Gateway ModbusTCP dei primi 16 registri del modulo DAT3011 posto sul bus ModbusRTU
* ModbusTCP Remote_IP: 192.168.10.254
* Rx ModbusTCP: 00 00 00 00 00 06 01 03 00 09 00 10
* Tx RS485: 01 03 00 09 00 10 94 04
* Rx RS485: 01 03 20 05 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF FF 0E 00 00 00 00 00 00
00 78 5F
* Tx ModbusTCP: 00 00 00 00 00 23 01 03 20 05 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF
FF 0E 00 00 00 00 00 00 00
Dettaglio RISORSE per piattaforme hardware CHAMELEON di EurogiDevices
//--- InterLINK Errors ---
// Transmitted with minus sign inside InterLINK packet response like "_-2_"
(COMMAND_UNKNOWN_ERROR)
#define PACKET_FORMAT_ERROR 1
#define COMMAND_UNKNOWN_ERROR 2
#define ID_DESTINATION_ERROR 3
#define ID_RESOURCE_ERROR 4
#define LENGTH_ERROR 5
#define FIELD_ERROR 6
#define RTC_ERROR 7
#define MODBUS_EXCEPTION_ERROR 10 //--- MODBUS EXCEPTION
plus following Exception Code ---
#define MODBUS_RESPONSE_TIMEOUT_ERROR 0 // RESPONSE TIMEOUT Exception Code
#define MODBUS_ILLEGAL_FUNCTION 1 // ILLEGAL FUNCTION Exception Code
#define MODBUS_ILLEGAL_DATA_ADDRESS 2 // ILLEGAL DATA ADDRESS Exception Code
#define MODBUS_ILLEGAL_DATA_VALUE 3 // ILLEGAL DATA VALUE Exception Code
//--- Read-Only INPUTS 'I' ---
--------------------------------------------------------------------------------
offset length description
--------------------------------------------------------------------------------
(0) (1) KEY_1 / Digital Input 1
(1) (1) KEY_2 / Digital Input 2
(2) (1) KEY_3 / Digital Input 3
(3) (1) KEY_4 / Digital Input 4
(4) (1) INPUT_1 / Analog Input 1 Passivi (no pull-up a 10Vdc)
(5) (1) INPUT_2 / Analog Input 2 Passivi (no pull-up a 10Vdc)
(6) (1) INPUT_3 / Analog Input 3 Analog Output su CHAMELEON 2
(7) (1) INPUT_4 / Analog Input 4 Analog Output su CHAMELEON 2
(8) (1) INPUT_5 / Analog Input 5 Attivi (pull-up a 10Vdc)
(9) (1) INPUT_6 / Analog Input 6 Attivi (pull-up a 10Vdc)
(10) (1) INPUT_7 / Analog Input 7 Non presente su CHAMELEON 2
//--- Persistent CONFIGURATIONS 'C' on EEPROM ---
--------------------------------------------------------------------------------
offset length description
--------------------------------------------------------------------------------
(0) (1) Products Hardware Configured (0xA5A5)
(1) (3) Ethernet MAC Address (progressively changed on EEPROM in the
laboratory before shipping,
13 / 17
[0x00, 0x1F, 0x97, 0xFF, 0x00, 0x00] is the firmware default
(4) (2) Product Serial Number on EEPROM
(6) (2) Product Identifier Number on EEPROM
(8) (8) Product Information String on EEPROM 16 characters
//--- Persistent PARAMETERS 'P' on EEPROM ---
--------------------------------------------------------------------------------
offset length description
--------------------------------------------------------------------------------
(0) (1) InterLINK Server ID
[0 default, 248, 249, ... , 256, 257, ... , 65535]
(1) (1) ModbusRTU (MSB byte) and ModbusTCP (LSB byte) addresses
[1 default ModbusRTU, 2, 3, ... , 247 default ModbusTCP]
(2) (2) Ethernet / Internet IP Address,
[192.168.10.200] default,
32 bits big-endian (224.0.0.0 ... 239.255.255.255 for
Multicast IPs - UDP)
(4) (2) IP Netmask, [255.255.255.0] local default,
32 bits big-endian (not used for Multicast IPs)
(6) (2) IP Gateway [192.168.10.1] local default,
32 bits big-endian
(8) (2) SYSLOG Server(s) Address, [192.168.10.254] local Syslog default,
32 bits big-endian
(10) (2) Broadcast/Multicast Server(s) Address,
[192.168.10.255] local Broadcast default, 32 bits big-endian
(12) (2) NTP Network Time Server Address
[193.204.114.232] internet default (ntp1.ien.it),
32 bits big-endian
(14) (2) T_IP_1 Trusted CLIENT Ethernet / Internet IP Address,
32 bits big-endian *** actually not used ***
(16) (2) T_IP_2 Trusted CLIENT Ethernet / Internet IP Address,
32 bits big-endian *** actually not used ***
(18) (2) T_IP_3 Trusted CLIENT Ethernet / Internet IP Address,
32 bits big-endian *** actually not used ***
(20) (2) T_IP_4 Trusted CLIENT Ethernet / Internet IP Address,
32 bits big-endian *** actually not used ***
(22) (2) DNS Server Address,
[8.8.8.8] internet default (Google), 32 bits big-endian
(24) (1) spare register, reserved for future use
(25) (1) RS485 / ModbusRTU baud rate (0=9600 default,
1=19200, 2=38400),
always no parity, 8 bits, 1 stop bit minimum
(26) (1) spare register, reserved for future use
(HTTP Port, default 80)
(27) (1) spare register, reserved for future use
(MODBUS_TCP Port, default 502)
(28) (1) spare register, reserved for future use
(SYSLOG or Broadcast/Multicast Port, default 514)
//--- Persistent 'S'ettings registers EEPROM ---
// Note: SETTINGS area is copyed into VOLATILE area at CAMILLO Power On Reset
// Changing SETTING area make changes persistent
// Changing VOLATILE area make changes temporary
(restored from SETTINGS at next CAMILLO Power On Reset
// System Utility Functions defines for SETTING 'utilityFunctionsMasks' (into
persistent S area and volatile V area)
14 / 17
#define utilityFunctionsMasks volatilesRegisters[0]
// Bit Masks into 'utilityFunctionsMasks' :
#define SYSTEM_EVENTS_ENABLED 0x0001 // Automatic transmission of STATE
CHANGES on Analog and Digital Inputs
#define SYSTEM_STATE_ENABLED 0x0002 // Automatic transmission of STATE
#define SYSTEM_TIME_ENABLED 0x0004 // Automatic TIME display on Consolle
(use same temporization of
SYSTEM_STATE_ENABLED)
#define DHCP_ENABLED 0x0010 // DHCP is Not Recommended in Measure,
Automation and Control Applications
#define NTP_ENABLED 0x0020
#define TRUSTED_IP_ENABLED 0x0040 // Not yet implemented, ready for future
security improvements
starting September 2013
#define DEBUG 0x0800 // Verbose CONSOLE messages,
set on for troubleshooting
#define RTC_RAM_CLEAR 0x1000
#define RELOAD_DEFAULTS 0x4000 // The Configuration table is not
reloaded (MAC, Serial Number,
Identification ... untouched)
#define REMOTE_SOFT_RESET 0x8000 // Restart from remote
'S'ettings registers defaults ('S' and 'V' resource at Power On Reset)
--------------------------------------------------------------------------------
offset length description
--------------------------------------------------------------------------------
(0) (1) 'utilityFunctionsMasks' EEPROM image
(1) (1) Automatic Display and Transmission of System Image
and TIME display on Console any 'x' seconds
(2) (1) Acquire any 'x' per 100 milliseconds the Inputs Image
and Transmit any Inputs Events if enabled
(3) (1) Syncronize with NTP Time Server any 'x' seconds,
default is 12 hours = 43200 sec (0xA8C0)
(4) (1) Inputs without (bit_mask=0) or with (bit_mask=1) 10Vcc pull-up
1k8 ohm (bit0=input1, ... , bitN-1=inputN),
default 10Vcc pull-up
(5) (1) Outputs PWM (bit_mask=0) or DIM (bit_mask=1),
(bit0=output1, ... , bitN-1=outputN) , default to DIM
(6) reserved for future use
… ...
(15) reserved for future use
//--- Volatile 'V'olatile registers on RAM ---
VOLATILE, RAM copy of SETTINGs Registers area at Power On Reset
//--- 'E'rrors 16 bits up-counters on RAM ---
// ERRORS are counted on a 16 bit up-counters at offset 'error' into the
'errorResgister[]' array using function 'void Error(unsigned char error)'
// ERRORS can be readed / writed using InterLINK commands 'RE' and 'WE'
//--- System ERRORS registers ---
#define RTC_ACCESS_ERROR 0
#define CONSOLE_OVERRUN_ERROR 1
#define HTTP_OVERRUN_ERROR 2
15 / 17
#define TELNET_OVERRUN_ERROR 3
#define MODBUS_TCP_OVERRUN_ERROR 4
#define MODBUS_RTU_OVERRUN_ERROR 5
#define RS485_OVERRUN_ERROR 6
#define NTP_SYNCRONIZATION_ERROR 7
…
up to 32 registers
//--- LCD Display Image ---
*Non presente su CHAMELEON 2
16 bits registers
(0..8 first LCD row in "Little Endian" mode, swapped couple of characters)
(9..15 second LCD row in "Little Endian" mode, swapped couple of
characters)
//--- RTC and backup RAM Image ---
*Non presente su CHAMELEON 2
16 bits registers
(0) secondsBcd, minutesBcd
(1) hoursBcd, weekdayBcd
(2) dayBcd, monthBcd
(3) yearBcd, controlBits
(4...31) ramBackupUserRegisters
//--- Volatile REGISTERS 'H' OUTPUTs and RAM ---
--------------------------------------------------------------------------------
offset length description
--------------------------------------------------------------------------------
*Su CHAMELEON 1
(0) (1) OUTPUT_1 8 bits PWM Register
(1) (1) OUTPUT_2 8 bits PWM Register
(2) (1) OUTPUT_3 8 bits PWM Register
(3) (1) OUTPUT_4 8 bits PWM Register
(4) (1) Backligth LCD * seconds
(5) (1) Buzzer ALARM * 0.1 seconds
*Su CHAMELEON 2
(0) (1) OUTPUT_1 8 bits PWM Register
(1) (1) OUTPUT_2 8 bits PWM Register
(2) (1) OUTPUT_3 8 bits PWM Register
(3) (1) OUTPUT_4 8 bits PWM Register
(4) (1) OUTPUT_5 8 bits PWM Register
(5) (1) OUTPUT_6 8 bits PWM Register
(6) (1) OUTPUT_7 1 bits Digital Register State (Read Only)
(7) (1) OUTPUT_8 1 bits Digital Register State (Read Only)
(8) (1) OUTPUT_78 Digital Register Command (Read/Write)
bit 8 = OUTPUT_7 Command (0=Off, 1=On)
bit 9 = OUTPUT_8 Command (0=Off, 1=On)
… i bits sono numerati da 0 (lsb) a 15 (msb)
(9) (1) ANALOG_OUTPUT_3 8 bits Analog I/O 3
(10) (1) ANALOG_OUTPUT_4 8 bits Analog I/O 4
16 / 17
Questo documento si propone di descrivere sinteticamente le funzioni e facilitare l' utilizzo
delle piattaforme hardware che montano il firmware CAMILLO.
Inviate i vostri commenti, segnalazioni e suggerimenti a valter.foresto@commsec.it con
oggetto “Firmware CAMILLO” che pensate possano essere utili a migliorarne la qualità e la
chiarezza espositiva di questa documentazione.
Grazie sin d'ora per la collaborazione, Valter Foresto.
17 / 17

Contenu connexe

En vedette

Strategic skills management in a VUCA world
Strategic skills management in a VUCA worldStrategic skills management in a VUCA world
Strategic skills management in a VUCA worldJoao Paulo Feijoo
 
iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...
iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...
iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...iBLio
 
Dream Vacation 2
Dream Vacation 2Dream Vacation 2
Dream Vacation 2Drew_123456
 
3R - Riduci, Ricicla e Riusa
3R - Riduci, Ricicla e Riusa3R - Riduci, Ricicla e Riusa
3R - Riduci, Ricicla e RiusaiBLio
 
Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...
Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...
Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...Bond & Play
 
Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...
Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...
Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...iBLio
 
Le Plastic Optical Fiber e le Telecomunicazioni
Le Plastic Optical Fiber e le TelecomunicazioniLe Plastic Optical Fiber e le Telecomunicazioni
Le Plastic Optical Fiber e le TelecomunicazioniiBLio
 
Presentazione POF - ElectronicBRICKS™
Presentazione POF - ElectronicBRICKS™Presentazione POF - ElectronicBRICKS™
Presentazione POF - ElectronicBRICKS™iBLio
 
Marketing in India Series - Nature of Indian Market
Marketing in India Series - Nature of Indian MarketMarketing in India Series - Nature of Indian Market
Marketing in India Series - Nature of Indian MarketRajesh Aithal
 
Rural Retail Options – Traditional Vs Emerging
Rural Retail Options – Traditional Vs EmergingRural Retail Options – Traditional Vs Emerging
Rural Retail Options – Traditional Vs EmergingRajesh Aithal
 
Ilovepdf.com
Ilovepdf.comIlovepdf.com
Ilovepdf.comlazone11
 
Proceso toma de decisión
Proceso toma de decisiónProceso toma de decisión
Proceso toma de decisiónjotiji
 
Autortiesības Youtube.com
Autortiesības Youtube.comAutortiesības Youtube.com
Autortiesības Youtube.comLKK_kmrs
 
Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"
Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"
Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"Bernadetecebs .
 
Baraja de numeros manzana
Baraja de numeros manzanaBaraja de numeros manzana
Baraja de numeros manzanaceiprueda
 
14 04 29 informe diário
14 04 29 informe diário14 04 29 informe diário
14 04 29 informe diárioMB Associados
 

En vedette (20)

Strategic skills management in a VUCA world
Strategic skills management in a VUCA worldStrategic skills management in a VUCA world
Strategic skills management in a VUCA world
 
iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...
iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...
iBLIO - Riferimenti per Beacons e Bluetooth Low Energy - Workshop 18-06-2015 ...
 
Dream Vacation 2
Dream Vacation 2Dream Vacation 2
Dream Vacation 2
 
3R - Riduci, Ricicla e Riusa
3R - Riduci, Ricicla e Riusa3R - Riduci, Ricicla e Riusa
3R - Riduci, Ricicla e Riusa
 
Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...
Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...
Barnaby Station - A Global Briefing on the Culture, People and Ideas Driving ...
 
Parent Acts 08
Parent Acts 08Parent Acts 08
Parent Acts 08
 
Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...
Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...
Linea prodotti configurabili CAMILLO per la Misura, l' Automazione ed il Cont...
 
Le Plastic Optical Fiber e le Telecomunicazioni
Le Plastic Optical Fiber e le TelecomunicazioniLe Plastic Optical Fiber e le Telecomunicazioni
Le Plastic Optical Fiber e le Telecomunicazioni
 
Presentazione POF - ElectronicBRICKS™
Presentazione POF - ElectronicBRICKS™Presentazione POF - ElectronicBRICKS™
Presentazione POF - ElectronicBRICKS™
 
Marketing in India Series - Nature of Indian Market
Marketing in India Series - Nature of Indian MarketMarketing in India Series - Nature of Indian Market
Marketing in India Series - Nature of Indian Market
 
Rural Retail Options – Traditional Vs Emerging
Rural Retail Options – Traditional Vs EmergingRural Retail Options – Traditional Vs Emerging
Rural Retail Options – Traditional Vs Emerging
 
Jocs florals
Jocs floralsJocs florals
Jocs florals
 
Ilovepdf.com
Ilovepdf.comIlovepdf.com
Ilovepdf.com
 
Impacto de las tic
Impacto de las ticImpacto de las tic
Impacto de las tic
 
84933120
8493312084933120
84933120
 
Proceso toma de decisión
Proceso toma de decisiónProceso toma de decisión
Proceso toma de decisión
 
Autortiesības Youtube.com
Autortiesības Youtube.comAutortiesības Youtube.com
Autortiesības Youtube.com
 
Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"
Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"
Novena de Natal 2012 - "Cremos Senhor, mas aumentai a nossa Fé!"
 
Baraja de numeros manzana
Baraja de numeros manzanaBaraja de numeros manzana
Baraja de numeros manzana
 
14 04 29 informe diário
14 04 29 informe diário14 04 29 informe diário
14 04 29 informe diário
 

Similaire à Descrizione protocollo InterLINK e licenze firmware CAMILLO

Crouzet Automation - em4 Ethernet opuscolo, versione italiana
Crouzet Automation - em4 Ethernet opuscolo, versione italiana Crouzet Automation - em4 Ethernet opuscolo, versione italiana
Crouzet Automation - em4 Ethernet opuscolo, versione italiana Crouzet
 
Portfolio SELTA per le Reti di Accesso 2018
Portfolio SELTA per le Reti di Accesso 2018Portfolio SELTA per le Reti di Accesso 2018
Portfolio SELTA per le Reti di Accesso 2018SELTA
 
IoT: protocolli, dispositivi, architetture
IoT: protocolli, dispositivi, architettureIoT: protocolli, dispositivi, architetture
IoT: protocolli, dispositivi, architettureStefano Valle
 
Crouzet Automation - em4 Guida alla scelta
Crouzet Automation - em4 Guida alla sceltaCrouzet Automation - em4 Guida alla scelta
Crouzet Automation - em4 Guida alla sceltaCrouzet
 
118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...
118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...
118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...Cristian Randieri PhD
 
SOFREL S4W - La telegestione 4.0 per reti idriche connesse
SOFREL S4W - La telegestione 4.0 per reti idriche connesseSOFREL S4W - La telegestione 4.0 per reti idriche connesse
SOFREL S4W - La telegestione 4.0 per reti idriche connesseLACROIX Sofrel Srl
 
Smart Technology 3 novembre
Smart Technology 3 novembreSmart Technology 3 novembre
Smart Technology 3 novembrecanaleenergia
 
Portfolio Energy Automation SELTA 2018
Portfolio Energy Automation SELTA 2018Portfolio Energy Automation SELTA 2018
Portfolio Energy Automation SELTA 2018SELTA
 
Corso VoIP per Area Commerciale 2006
Corso VoIP per Area Commerciale 2006Corso VoIP per Area Commerciale 2006
Corso VoIP per Area Commerciale 2006rosariolatorre
 
SMART WATER 4 novembre
SMART WATER 4 novembreSMART WATER 4 novembre
SMART WATER 4 novembrecanaleenergia
 
Presentazione Securforce
Presentazione  SecurforcePresentazione  Securforce
Presentazione SecurforceClaudio N.
 
ATEN - Gestire i server: sempre e ovunque
ATEN - Gestire i server: sempre e ovunqueATEN - Gestire i server: sempre e ovunque
ATEN - Gestire i server: sempre e ovunqueATEN Infotech
 
Il web service e i sistemi embedded - Tesi - cap2
Il web service e i sistemi embedded - Tesi - cap2Il web service e i sistemi embedded - Tesi - cap2
Il web service e i sistemi embedded - Tesi - cap2pma77
 
Aten - Gestire i server: sempre e ovunque
Aten - Gestire i server: sempre e ovunqueAten - Gestire i server: sempre e ovunque
Aten - Gestire i server: sempre e ovunqueATEN Infotech
 
Iperf 090524073201-phpapp01
Iperf 090524073201-phpapp01Iperf 090524073201-phpapp01
Iperf 090524073201-phpapp01Jamil Jamil
 
Scheda CAMILLO InterLINK Server / ModbusRTU Gateway
Scheda CAMILLO InterLINK Server / ModbusRTU GatewayScheda CAMILLO InterLINK Server / ModbusRTU Gateway
Scheda CAMILLO InterLINK Server / ModbusRTU GatewayiBLio
 

Similaire à Descrizione protocollo InterLINK e licenze firmware CAMILLO (20)

Crouzet Automation - em4 Ethernet opuscolo, versione italiana
Crouzet Automation - em4 Ethernet opuscolo, versione italiana Crouzet Automation - em4 Ethernet opuscolo, versione italiana
Crouzet Automation - em4 Ethernet opuscolo, versione italiana
 
Portfolio SELTA per le Reti di Accesso 2018
Portfolio SELTA per le Reti di Accesso 2018Portfolio SELTA per le Reti di Accesso 2018
Portfolio SELTA per le Reti di Accesso 2018
 
Iperf
IperfIperf
Iperf
 
IoT: protocolli, dispositivi, architetture
IoT: protocolli, dispositivi, architettureIoT: protocolli, dispositivi, architetture
IoT: protocolli, dispositivi, architetture
 
Crouzet Automation - em4 Guida alla scelta
Crouzet Automation - em4 Guida alla sceltaCrouzet Automation - em4 Guida alla scelta
Crouzet Automation - em4 Guida alla scelta
 
118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...
118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...
118 Primo Piano “Dispositivi ethernet-based” - Fieldbus & Networks N. 88 – Se...
 
SOFREL S4W - La telegestione 4.0 per reti idriche connesse
SOFREL S4W - La telegestione 4.0 per reti idriche connesseSOFREL S4W - La telegestione 4.0 per reti idriche connesse
SOFREL S4W - La telegestione 4.0 per reti idriche connesse
 
Smart Technology 3 novembre
Smart Technology 3 novembreSmart Technology 3 novembre
Smart Technology 3 novembre
 
Portfolio Energy Automation SELTA 2018
Portfolio Energy Automation SELTA 2018Portfolio Energy Automation SELTA 2018
Portfolio Energy Automation SELTA 2018
 
Corso VoIP per Area Commerciale 2006
Corso VoIP per Area Commerciale 2006Corso VoIP per Area Commerciale 2006
Corso VoIP per Area Commerciale 2006
 
SMART WATER 4 novembre
SMART WATER 4 novembreSMART WATER 4 novembre
SMART WATER 4 novembre
 
Presentazione Securforce
Presentazione  SecurforcePresentazione  Securforce
Presentazione Securforce
 
ATEN - Gestire i server: sempre e ovunque
ATEN - Gestire i server: sempre e ovunqueATEN - Gestire i server: sempre e ovunque
ATEN - Gestire i server: sempre e ovunque
 
Il web service e i sistemi embedded - Tesi - cap2
Il web service e i sistemi embedded - Tesi - cap2Il web service e i sistemi embedded - Tesi - cap2
Il web service e i sistemi embedded - Tesi - cap2
 
Aten - Gestire i server: sempre e ovunque
Aten - Gestire i server: sempre e ovunqueAten - Gestire i server: sempre e ovunque
Aten - Gestire i server: sempre e ovunque
 
beroNet GmbH
beroNet GmbHberoNet GmbH
beroNet GmbH
 
Iperf 090524073201-phpapp01
Iperf 090524073201-phpapp01Iperf 090524073201-phpapp01
Iperf 090524073201-phpapp01
 
Avaya Unified Collaboration
Avaya Unified CollaborationAvaya Unified Collaboration
Avaya Unified Collaboration
 
Scheda CAMILLO InterLINK Server / ModbusRTU Gateway
Scheda CAMILLO InterLINK Server / ModbusRTU GatewayScheda CAMILLO InterLINK Server / ModbusRTU Gateway
Scheda CAMILLO InterLINK Server / ModbusRTU Gateway
 
3D-DRESD RABAN
3D-DRESD RABAN3D-DRESD RABAN
3D-DRESD RABAN
 

Plus de iBLio

Comm.SEC hardware, firmware and software products, solutions and services
Comm.SEC hardware, firmware and software products, solutions and servicesComm.SEC hardware, firmware and software products, solutions and services
Comm.SEC hardware, firmware and software products, solutions and servicesiBLio
 
CommSEC - InterLINK products line (EN)
CommSEC - InterLINK products line (EN)CommSEC - InterLINK products line (EN)
CommSEC - InterLINK products line (EN)iBLio
 
Scheda CAMILLO InterlLINK Server / ModbusRTU Slave
Scheda CAMILLO InterlLINK Server / ModbusRTU SlaveScheda CAMILLO InterlLINK Server / ModbusRTU Slave
Scheda CAMILLO InterlLINK Server / ModbusRTU SlaveiBLio
 
Scheda CAMILLO InterLINK Server
Scheda CAMILLO InterLINK ServerScheda CAMILLO InterLINK Server
Scheda CAMILLO InterLINK ServeriBLio
 
POF advantages vs others technologies
POF advantages vs others technologiesPOF advantages vs others technologies
POF advantages vs others technologiesiBLio
 
Electronic BRICKS™ - Presentazione 2010
Electronic BRICKS™ - Presentazione 2010Electronic BRICKS™ - Presentazione 2010
Electronic BRICKS™ - Presentazione 2010iBLio
 
ElectronicBRICKS™
ElectronicBRICKS™ElectronicBRICKS™
ElectronicBRICKS™iBLio
 
Tecnologie power line e plastic optical fiber
Tecnologie power line e plastic optical fiberTecnologie power line e plastic optical fiber
Tecnologie power line e plastic optical fiberiBLio
 
Perchè conviene la Fibra Ottica Plastica
Perchè conviene la Fibra Ottica PlasticaPerchè conviene la Fibra Ottica Plastica
Perchè conviene la Fibra Ottica PlasticaiBLio
 
Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...
Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...
Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...iBLio
 
POF Newsletter Mar Apr 2010
POF Newsletter Mar Apr 2010POF Newsletter Mar Apr 2010
POF Newsletter Mar Apr 2010iBLio
 
Optical Home Backbone Network
Optical Home Backbone NetworkOptical Home Backbone Network
Optical Home Backbone NetworkiBLio
 
Connecting Home Networks [Firecomms - Thorne]
Connecting Home Networks [Firecomms - Thorne]Connecting Home Networks [Firecomms - Thorne]
Connecting Home Networks [Firecomms - Thorne]iBLio
 

Plus de iBLio (13)

Comm.SEC hardware, firmware and software products, solutions and services
Comm.SEC hardware, firmware and software products, solutions and servicesComm.SEC hardware, firmware and software products, solutions and services
Comm.SEC hardware, firmware and software products, solutions and services
 
CommSEC - InterLINK products line (EN)
CommSEC - InterLINK products line (EN)CommSEC - InterLINK products line (EN)
CommSEC - InterLINK products line (EN)
 
Scheda CAMILLO InterlLINK Server / ModbusRTU Slave
Scheda CAMILLO InterlLINK Server / ModbusRTU SlaveScheda CAMILLO InterlLINK Server / ModbusRTU Slave
Scheda CAMILLO InterlLINK Server / ModbusRTU Slave
 
Scheda CAMILLO InterLINK Server
Scheda CAMILLO InterLINK ServerScheda CAMILLO InterLINK Server
Scheda CAMILLO InterLINK Server
 
POF advantages vs others technologies
POF advantages vs others technologiesPOF advantages vs others technologies
POF advantages vs others technologies
 
Electronic BRICKS™ - Presentazione 2010
Electronic BRICKS™ - Presentazione 2010Electronic BRICKS™ - Presentazione 2010
Electronic BRICKS™ - Presentazione 2010
 
ElectronicBRICKS™
ElectronicBRICKS™ElectronicBRICKS™
ElectronicBRICKS™
 
Tecnologie power line e plastic optical fiber
Tecnologie power line e plastic optical fiberTecnologie power line e plastic optical fiber
Tecnologie power line e plastic optical fiber
 
Perchè conviene la Fibra Ottica Plastica
Perchè conviene la Fibra Ottica PlasticaPerchè conviene la Fibra Ottica Plastica
Perchè conviene la Fibra Ottica Plastica
 
Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...
Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...
Connect anythings to the Internet with Electronic BRICKS™ - EoPOF Modules, Pr...
 
POF Newsletter Mar Apr 2010
POF Newsletter Mar Apr 2010POF Newsletter Mar Apr 2010
POF Newsletter Mar Apr 2010
 
Optical Home Backbone Network
Optical Home Backbone NetworkOptical Home Backbone Network
Optical Home Backbone Network
 
Connecting Home Networks [Firecomms - Thorne]
Connecting Home Networks [Firecomms - Thorne]Connecting Home Networks [Firecomms - Thorne]
Connecting Home Networks [Firecomms - Thorne]
 

Descrizione protocollo InterLINK e licenze firmware CAMILLO

  • 1. Comm.SEC di Valter Foresto Cell +39 347 0144028 – valter.foresto@commsec.it - valter.foresto@gmail.com Sede Operativa: Strada della Pronda 66/8bis - 10142 Torino Sede Legale: Via Francesco Millio 57 – 10141 Torino – Tel. +39 011 337101 Partita IVA: 08775700019 Codice Fiscale: FRSVTR54A11C665T REA: 999654 Revisione 2013-07-01 Valter Foresto Licenze firmware CAMILLO Soluzioni e Prodotti Configurabili per Sistemi di Automazione, Monitoraggio e Controllo Distribuito • Con le licenze firmware CAMILLO le risorse hardware della piattaforma ospite (come ad esempio CHAMELEON di EurogiDevices) vengono esposte sulle porte di comunicazione wired come Ethernet / RS485 / USB-Seriale e sulle porte di comunicazione wireless come Z-Wave / ZigBee / WiFi e Bluetooth. • L'uso del Protocollo InterLINK per accedere e gestire le risorse hardware della piattaforma ospite rende i prodotti hardware con le licenze firmware CAMILLO estremamente attraenti per rapporto prestazioni/prezzo ed applicabili facilmente nella realizzazione di applicazioni per Sistemi di Misura, Automazione e Controllo Distribuito sia locale che remoto. • Le applicazioni possono essere sviluppate tramite SCADA 'Supervisory Control And Data Acquisition' o con qualsiasi linguaggio di programmazione che supporti lo scambio di stringhe ASCII tramite linee Seriali ed Ethernet-Internet TCP/IP che vedono il prodotti con firmware CAMILLO installato come risorse distribuite in rete accessibili e controllabili esternamente dal software applicativo sviluppato ad-hoc dal Cliente stesso o da Comm.SEC su specifica del Cliente. • Parallelamente al Protocollo InterLINK, sempre presente su tutte le licenze CAMILLO per permetterne una semplice configurabilità ed utilizzo dell'hardware della piattaforma ospite, le licenze CAMILLO ROSSO e CAMILLO GIALLO integrano anche il Protocollo ModbusTCP Server sulla porta di comunicazione Ethernet e ModbusRTU sulla porta di comunicazione RS485 sia in versione Server (CAMILLO ROSSO) che Client (CAMILLO GIALLO). • Il firmware CAMILLO GIALLO realizza inoltre un Gateway sia InterLINK che ModbusTCP verso ModbusRTU. Le caratteristiche principali delle Licenze Firmware CAMILLO sono : ---------------------------------------------------------------------- Licenze Firmware "CAMILLO" VERDE ROSSO GIALLO ---------------------------------------------------------------------- Indirizzo IP / DHCP Client X X X Indirizzo InterLINK Server X X X InterLINK Server via USB-Seriale X X X InterLINK Server via HTTP X X X InterLINK Server via RS485 X - - ---------------------------------------------------------------------- InterLINK / ModbusRTU Gateway - - X Indirizzo ModbusTCP Server - X X Indirizzo ModbusRTU Server - X - Indirizzo ModbusRTU Client - - X ModbusTCP Server via Ethernet - X X ModbusRTU Server via RS485 - X - ModbusRTU Client su RS485 - - X ModbusTCP / ModbusRTU Gateway - - X ---------------------------------------------------------------------- Sincronizzazione RTC via Internet NTP X X X Acquisizione Automatica STATO X X X Trasmissione STATO via SYSLOG/Multicast X X X Rilevazione Automatica EVENTI X X X Trasmissione EVENTI via SYSLOG/Multicast X X X 1 / 17
  • 2. Caratteristiche del Protocollo InterLINK • Semplice e veloce da comprendere • Semplice ed immediato da usare • Utilizzabile manualmente o programmaticamente tramite applicazioni ad-hoc • Basato sul set di caratteri ASCII raccolti in pacchetti trasmessi velocemente ed in unica soluzione • I comandi sono stringhe ASCII raccolte in pacchetti che vengono trasmessi con il metodo dell'invio da riga di comando con editing di riga • Le risposte sono stringhe ASCII raccolte in pacchetti e vengono ricevute con il metodo del display della riga di risposta • Utilizzabile manualmente via Terminale Seriale RS-232 o RS-485 o USB-Seriale • Utilizzabile manualmente su Ethernet / Internet via Web-Browser HTTP ed opzionalmente via Terminali TELNET • Utilizzabile tramite qualsiasi applicazione scritta in un linguaggio di programmazione che supporti linee Seriali e/o Ethernet / Internet con protocollo TCP/IP • Protocollo con feedback degli errori formali molto robusto soprattutto quando usato su Ethernet / Internet con protocollo TCP/IP • Tutti i canali di comunicazione previsti dalla licenza firmware possono funzionare contemporaneamente • Le singole transazioni comando / risposta sui singoli canali di comunicazione sono protette temporalmente e sono eseguite dall' inizio alla fine con il criterio first-in / first- out in fase di acquisizione / esecuzione • Pacchetti con 'errori di comunicazione' o 'malformati' che non rispettano il Protocollo InterLINK vengono 'scartati in modo silente', mentre i pacchetti ben formati ottengono sempre una risposta dal Protocollo Applicativo di InterLINK con la segnalazione puntuale degli eventuali errori rilevati • Tutti le licenze firmware Comm.SEC della Linea di firmware configurabili CAMILLO utilizzano il paradigma, il protocollo di comunicazione ed il protocollo applicativo InterLINK 2 / 17
  • 3. Risorse Hardware e Registri InterLINK e Modbus Le RISORSE di qualunque piattaforma hardware sono rappresentate dal firmware CAMILLO che implementa InterLINK e Modbus da aree di memoria, lineari e limitate, a cui si accede tramite Comandi di Lettura e Scrittura. Le aree di memoria associate alle RISORSE (persistenti per EEPROM/FRAM o volatili per RAM) contengono i dati scambiati sempre e comunque in unità da 16 bits dette REGISTRI nel formato big-endian (cioè byte più significativo per primo seguito dal byte meno significativo) indipendentemente dall' architettura del processore utilizzato dalla piattaforma hardware ospite. Le diverse RISORSE sono raggruppate in sezioni diverse identificate ed accessibili mediante i seguenti criteri: ------------------------------------------------------------------------------- 'I'nputs Read-Only INPUTS hardware dependent registers variables 'C'onfigurations Read-Only EEPROM/FRAM persistent parameters 'P'arameters Read-Write EEPROM/FRAM persistent parameters 'S'tored settings Read-Write EEPROM/FRAM persistent settings 'V'olatile settings Read-Write RAM volatile settings (copyed from 'S'tored settings at Power On Reset) 'E'rrors up-counters Read-Write RAM volatile up-counter registers 'L'CD Display image Read-Write RAM image for the Liquid Cristal Display 'T'ime RTC image Read-Write RAM image for the Real Time Clock 'H'oldings Read-Write RAM volatile registers variables and outputs 'M'odbus resources Read-Write Modbus registers / variables ------------------------------------------------------------------------------- Tutte le RISORSE possono essere sempre LETTE 'R'ead mentre possono essere SCRITTE 'W'rite quelle che non siano di tipo 'I'nputs o 'C'onfigurations che sono invece 'solo leggibili' Tabella delle Risorse Hardware e dei Registri InterLINK e Modbus per piattaforma hardware CHAMELEON di EurogiDevices ---------------------------------------------------------------------------------------------------- Tipo RISORSA Indirizzo Modbus Numero di registri Comando InterLINK (Decimale) (16 bits, big-endian) RW Formato: “_cc,ii,oo,ll[,dd,dd, ...]_” ---------------------------------------------------------------------------------------------------- Ingressi Hardware 000 16 X- "_ri,0,0,11_" Uscite (Holdings RAM) 016 16 XX "_rh,0,2,4_" "wh,0,3,1,255_" "_wh,0,0,4,xFF,255,x80,128_" Configurazione EEPROM 032 16 X- "_rc,0,0,16_" Parametri EEPROM 048 32 XX "_rp,0,0,16_" "_rp,0,17,13_" "_wp,0,0,1,1234_" Impostazioni EEPROM 080 16 XX "_rs,0,0,16_" "_ws,0,0,4,1234,x56AB,sCI,sAO_" Impostazioni RAM 096 16 XX "_rv,0,0,16_" "_wv,0,0,3,x800,1,x23_" Contatori Errore RAM 112 16 XX "_re,0,0,16_" "_re,0,17,16_" "_we,0,15,4,0,0,0_" Display (copia RAM) 600 16 XX "_rl,0,0,16_" "_wl,0,16,3,sIC,sOA,x2020_" Orologio (copia RAM) 700 32 XX "_rt,0,0,16_" "_rt,0,17,16_" "_wt,0,0,3,x0230,x0116,x0522_" 3 / 17
  • 4. Esempio di Power On Reset visto dalla Console su piattaforma CHAMELEON 1 La Console è accessibile dalla porta USB-Seriale alla velocità di 115200 bps N81 tamite Terminale (es: PuTTY http://www.putty.org/ ). Nell' ordine vengono riportati: • Licenza Firmware installata • Piattaforma hardware su cui è installata la licenza CAMILLO • La revisione Firmware nel formato anno-mese-giorno • L' indirizzo a 16 bits della porta InterLINK usata dal firmware CAMILLO • Gli indirizzi Modbus RTU e TCP (porta 502) usati da firmware CAMILLO (presenti solo nelle versioni ROSSO e GIALLO, essendo il VERDE esclusivamente basato su InterLINK) • L' indirizzo IP della porta Ethernet (192.168.10.200 è il default) • L' indirizzo IP del Server Syslog sulla porta 514 a cui il firmware CAMILLO invia STATI ed EVENTI in modalità automatica quando impostato per farlo tramite la bitmask relativa via InterLINK o Modbus. In questo caso sono abilitati entrambi, lo stato <STS> è alla Console ed al Server Syslog di default ogni 20 secondi, mentri gli eventi <EVT> sono inviati ogni qualvolta viene rilevato un cambiamento di stato sugli ingressi digitali od analogici, preceduti dal carattere '#' per evidenziarli nella stringa XML trasmessa • La port 80 HTTP è sempre abilitata per inviare e ricevere pacchetti InterLINK tramite web- services • Se la licenza CAMILLO prevede ModbusTCP viene indicato se il comportamento è Server o Server / Gateway • Viene specificato l' uso fatto dalla licenza per la porta RS485 • Viene letto l' RTC, quando presente, che tipicamente è impostato per lavorare in formato UTC, se abilitata, come di default, la funzione di sincronizzazione dell' RTC questo viene eseguito connettendosi con il Server di Tempo NTP in Internet configurato dopo 6 secondi dal Power On Reset e ripetuto di default ogni 12 ore *** InterLINK 'CAMILLO GIALLO' www.commsec.it *** * Platform: CHAMELEON * Firmware: 20130523 * USB-Serial: Console and InterLINK Server * InterLINK ID: 0 * ModbusRTU Addr: 1, ModbusTCP Addr: 247 * Camillo IP: 192.168.10.200 * Syslog Server IP: 192.168.10.254 * HTTP: InterLINK Server * ModbusTCP: Server / ModbusRTU Gateway * RS485: ModbusRTU Client used by InterLINK and ModbusTCP Gateway [9600 N 8 1] * RTC [UTC and UNIX] Time: 2013/05/23 15:09:55 [1369321795] * <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0105 #0979 #0980 #0980 #0980 #0980 #0981 ] </EVT> * NTP Server reference time request ... * NTP Server response is ... * NTP Time (seconds since Jan 1 1900): 3578303452 * UNIX Time (seconds since Jan 1 1970): 1369314652 * UTC Time: 13:10:52 * <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0106 0979 0980 0980 0980 0980 0981 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 13:11:04 [1369314664] * <EVT> i[0] t[ 32] ao[000 000 000 000] di[#0 1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 35] ao[000 000 000 000] di[ 0 #0 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 37] ao[000 000 000 000] di[ 0 #1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 38] ao[000 000 000 000] di[ 0 #0 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 39] ao[000 000 000 000] di[#1 #1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </EVT> * <STS> i[0] t[ 40] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0106 0979 0980 0980 0981 0980 0982 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 13:11:24 [1369314684] * <EVT> i[0] t[ 51] ao[000 000 000 000] di[ 1 1 1 1] ai[#0000 0979 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 56] ao[000 000 000 000] di[ 1 1 1 1] ai[#0047 0979 0980 0980 0980 0980 0981 ] </EVT> 4 / 17
  • 5. Esempi di Comandi InterLINK I commenti sono riportati in rosso nel log seguente * Console CAMILLO riporta sempre sulla Console l' origine del canale di comunicazione con cui stà eseguendo l' attuale transazione _RI,0,0,11_ _RI,0,0,11,x0001,x0001,x0001,x0001,x03C7,x03D4,x03D4,x03D4,x03D5,x03D4,x03D5_ Read Inputs, i primi quattro registri rappresentano i 4 tasti di un CHAMELEON 1, i successivi 7 gli ingressi analogici a 10 bits (0...10Vdc) * Console _WI,0,0,1,1_ _-2_ Gli Inputs non possono essere scritti ! Errore con causa 2 (dalla tabella Errori InterLINK → COMMAND_UNKNOWN_ERROR) * Console _RC,0,0,16_ _RC,0,0,16,xA5A5,x001F,x97FF,x0000,x0000,x0001,x0000,x0001,x436F,x6D6D,x2E53,x4543,x2D54,x6F72,x696E,x6F20_ I valori di Configurazione possono essere letti, per il loro significato vedere la descrizione dei Registri di Configurazione * Console _WC,0,0,1,0_ _-2_ I valori di Configurazione non possono essere scritti ! Errore con causa 2 (dalla tabella Errori InterLINK → COMMAND_UNKNOWN_ERROR) * Console _RP,0,0,16_ _RP,0,0,16,x0000,x01F7,xC0A8,x0AC8,xFFFF,xFF00,xC0A8,x0A01,xC0A8,x0AFE,xC0A8,x0AFF,xC1CC,x72E8,x0000,x0000_ I valori dei Parametri operativi possono essere essere letti, per il loro significato vedere la descrizione dei Registri dei Parametri * Console _RP,0,17,12_ _RP,0,17,12,x0000,x0000,x0000,x0000,x0000,x0808,x0808,x0000,x0000,x0050,x01F6,x0202_ InterLINK non legge/scrive più di 16 registri per volta per mantenere ridotti i buffer RAM con cui vengono scambiati dati con il mondo esterno, così, come in questo caso, essendo 29 i Registri dei Parametri sono stati letti i primi sedici seguiti poi dai rimanenti 13 * Console _WP,0,0,1,X1234_ _WP,0,0,1,X1234_ I Parametri operativi possono essere variati, qui ad esempio di stà variando l' indirizzo InterLINK che verrà utilizzato, come avviene anche per tutti gli altri parametri come ad esempio l' indirizzo IP, SOLO al successivo Power On Reset … così con il comando seguente leggiamo e riportiamo al default il registro precedentemente modificato * Console _RP,0,0,1_ _RP,0,0,1,x1234_ * Console _WP,0,0,1,0_ _WP,0,0,1,0_ * Console _RS,0,0,16_ _RS,0,0,16,x0000,x0014,x0005,xA8C0,xFFFF,xFFFF,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_ I Setting sono registri operativi in EEPROM che vengono copiati nei registri RAM Volatiles al successivo Power On Reset * Console _WS,0,0,1,3_ _WS,0,0,1,3_ Quì stiamo impostando la trasmissione automatica di STATO ed EVENTI ... * Console _WV,0,0,1,X8000_ _WV,0,0,1,X8000_ … che rendiamo operativi immediatamente richiedendo un Power On Reset programmatico scrivendo la maschera REMOTE_SOFT_RESET nel registro RAM Volatiles 0 detto 'utilityFunctionsMasks' e descritto nel seguito … … viene eseguito il Power On Reset indotto dalla presenza della maschera REMOTE_SOFT_RESET nel registro Volatile 'utilityFunctionsMasks' *** InterLINK 'CAMILLO GIALLO' www.commsec.it *** * Platform: CHAMELEON * Firmware: 20130523 * USB-Serial: Console and InterLINK Server * InterLINK ID: 0 * ModbusRTU Addr: 1, ModbusTCP Addr: 247 * Camillo IP: 192.168.10.200 * Syslog Server IP: 192.168.10.254 5 / 17
  • 6. * HTTP: InterLINK Server * ModbusTCP: Server / ModbusRTU Gateway * RS485: ModbusRTU Client used by InterLINK and ModbusTCP Gateway [9600 N 8 1] * RTC [UTC and UNIX] Time: 2013/05/23 13:29:41 [1369315781] * <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0967 #0980 #0980 #0980 #0980 #0980 #0981 ] </EVT> * <EVT> i[0] t[ 8] ao[000 000 000 000] di[#0 1 1 1] ai[ 0967 0980 0980 0980 0980 0980 0981 ] </EVT> * <EVT> i[0] t[ 9] ao[000 000 000 000] di[#1 1 1 1] ai[ 0967 0980 0980 0980 0980 0980 0981 ] </EVT> * <EVT> i[0] t[ 15] ao[000 000 000 000] di[ 1 1 1 1] ai[#0944 0980 0980 0980 0980 0980 0981 ] </EVT> * <EVT> i[0] t[ 16] ao[000 000 000 000] di[ 1 1 1 1] ai[#0934 0980 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 17] ao[000 000 000 000] di[ 1 1 1 1] ai[#0911 0980 0980 0980 0981 0980 0981 ] </EVT> * <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0910 0980 0980 0980 0980 0980 0981 ] </STS> * <STS> i[0] t[ 40] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0911 0980 0980 0980 0981 0980 0982 ] </STS> … la maschera REMOTE_SOFT_RESET nel registro Volatile 'utilityFunctionsMasks' è stata riportata a 0 dal Power On Reset e come si visto si sono attivate le funzionalità richieste. Ora per comodità le fermiamo … * Console _WV,0,0,1,0_ _WV,0,0,1,0_ … e leggiamo i valori dei registri Variables (vedi valori dei registri Settings e Variables nel seguito) * Console _RV,0,0,16_ _RV,0,0,16,x0000,x0014,x0005,xA8C0,xFFFF,xFFFF,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_ Leggiamo ora i registri che conteggiano gli Errors di sistema invrementando il loro valore (vedi tabella Errori di sistema più avanti) ... * Console _RE,0,0,16_ _RE,0,0,16,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_ … scriviamo e poi rileggiamo il registro 2 (HTTP_OVERRUN_ERROR) * Console _WE,0,2,1,X1234_ _WE,0,2,1,X1234_ * Console _RE,0,0,4_ _RE,0,0,4,x0000,x0000,x1234,x0000_ Leggiamo l' intero contenuto dell' LCD di CHAMELEON 1 (il valore nei registri relativi ai caratteri ASCII attualmente visualizzati dall' LCD sono in formato Little-Endian a causa dell'architettura del processore ospite sul quale InterLINK scrive e legge in formato Big-Endian) * Console _RL,0,0,16_ _RL,0,0,16,x6920,x694C,x6B6E,x2020,x4143,x494D,x4C4C,x204F,x4720,x6169,x6C6C,x206F,x3032,x3331,x3530,x3332_ Leggiamo qui invece i primi 32 bytes (16 registri) dei 64 bytes (32 registri) dell' RTC di CHAMELEON 1 * Console _RT,0,0,16_ _RT,0,0,16,x3123,x0013,x0523,x0013,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000,x0000_ … dovrebbe, rileggendo i 16 registri, risultare evidente in quale byte l' RTC rappresenta i secondi * Console _RT,0,0,6_ _RT,0,0,6,x3140,x0013,x0523,x0013,x0000,x0000_ Essendo un CAMILLO GIALLO quello usato in questo momento, sono disponibili le funzioni di Gateway InterLINK / ModbusRTU che sono qui usate per connettersi ad un DAT3011 di DATEXEL per leggerne i primi 16 registri ... * Console _RM,1,0,16_ * Tx RS485: 01 03 00 00 00 10 44 06 * Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 02 07 00 04 00 00 03 00 0A 00 00 00 00 00 00 0A 04 _RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0202,x0700,x0400,x0003,x000A,x0000,x0000,x0000_ … attuare l' uscita 1 nel byte alto del registro 9 ... * Console _WM,1,8,2,0,X200_ * Tx RS485: 01 10 00 08 00 02 04 00 00 02 00 F3 69 * Rx RS485: 01 10 00 08 00 02 C0 0A _WM,1,8,2,0,X200_ … e rileggendo lo stato dei 16 registri per verificarne l' esecuzione * Console _RM,1,0,16_ * Tx RS485: 01 03 00 00 00 10 44 06 * Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 02 00 04 00 00 03 00 0A 00 00 00 00 00 00 8D 00 _RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0200,x0200,x0400,x0003,x000A,x0000,x0000,x0000_ 6 / 17
  • 7. HTTP Web-Services I comandi InterLINK sono stati dati negli esempi precedenti da Console, ma si può utilizzare un qualsiasi browser web invece della Console per comandare un Server InterLINK remoto via HTTP web-services: Il comando viene scritto nell' URL (nell'immagine di esempio “http://192.168.10.200/_wm,1,9,1,x100_”) ed inviato premento il tasto Return o F5, si ottiene una pagina web dal Server InterLINK con la risposta al comando inviato. Esempi di Comandi Modbus Per questa dimostrazione viene utilizzato come Client ModbusTCP e ModbusRTU il software ComTestPro di BaseBlock Software (http://www.baseblock.com/). Gli indirizzi ModbusTCP e ModbusRTU sono contenuti nel registro 1 dei Parametri EEPROM che ha come default il valore esadecimale 0x01F7, in particolare il byte più significativo (default 1) è l' indirizzo ModbusRTU mentre il meno significativo (default 247 decimale pari a 0xF7 esadecimale) è l' indirizzo ModbusTCP. Il valore 1 e 247 sono i limiti di indirizzamento del protocollo Modbus ed il firmware CAMILLO usa nella gestione lato InterLINK il concetto che “qualunque indirizzo nel range 1 … 247 è sempre considerato un indirizzo Modbus, mentre tutti gli altri (0, 248, … , 65535) possono essere indirizzi InterLINK” contenuto nel registro 0 dei Parametri EEPROM che ha come default il valore 0 come indirizzo InterLINK. Questo concetto è utilizzato dal firmware CAMILLO GIALLO per effettuare il Gateway da InterLINK lato Ethernet a ModbusRTU sul bus RS485. La documentazione Modbus di riferimento, sia a livello applicativo che a livello di struttura dei pacchetti TCP che Seriale RS485 che vedremo negli esempi seguenti, è reperibile sul sito ufficiale http://www.modbus.org/specs.php come “Modbus Specifications and Implementation Guides” che rappresentano le uniche specifiche ufficiali e pubbliche del protocollo Modbus. L' obbiettivo di InterLINK nei confronti di Modbus è quello di RENDERE TRASPARENTE ALL' UTILIZZATORE LE DIFFICOLTA' DI MODBUS come nel prodotto firmware CAMILLO GIALLO, essendo però Modbus uno standard industriale molto affermato le versioni CAMILLO ROSSO e CAMILLO GIALLO espongono oltre a InterLINK tutte le funzionalità Modbus di Client, Server e Gateway come descritto nella tabella, presentata in precedenza, che ne sintetizza le funzionalità nei confronti di ModbusTCP 7 / 17
  • 8. e ModbusRTU. Questa prima serie di esempi usa CAMILLO ROSSO che espone un Server Modbus sia sulla porta 502 TCP che sulla porta RTU su bus RS485. Vengono presentati i comandi Modbus su entrambe le porte di comunicazione TCP e RTU/RS485, per questo la presentazione è un po' lunga ma non particolarmente complessa, i commenti sono al solito in rosso. Power On Reset di un CAMILLO ROSSO *** InterLINK 'CAMILLO ROSSO' www.commsec.it *** * Platform: CHAMELEON * Firmware: 20130523 * USB-Serial: Console and InterLINK Server * InterLINK ID: 0 * ModbusRTU Addr: 1, ModbusTCP Addr: 247 * Camillo IP: 192.168.10.200 * Syslog Server IP: 192.168.10.254 * HTTP: InterLINK Server * ModbusTCP: Server * RS485: ModbusRTU Server [9600 N 8 1] * RTC [UTC and UNIX] Time: 2013/05/23 18:22:25 [1369333345] * <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0978 #0978 #1015 #1015 #0979 #0977 #0978 ] </EVT> * NTP Server reference time request ... * NTP Server response is ... * NTP Time (seconds since Jan 1 1900): 3578315906 * UNIX Time (seconds since Jan 1 1970): 1369327106 * UTC Time: 16:38:26 * <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS> Togliamo l' invio automatico di STATO es EVENTI usando la Console (disattiviamo tutte le funzioni azzerando il registro 0 Volatiles) * Console _WV,0,0,1,0_ _WV,0,0,1,0_ Nel pacchetto TCP trascuriamo i primi 5 bytes (vedi documenti ufficiali Modbus consigliati in precedenza), il sesto (0x06) è la lunghezza PDU comando che riporta: • 0xF7 indirizzo ModbusTCP di destinazione • 0x03 funzione di Read Multiple Registers • 0x0000 indirizzo registro Modbus iniziale • 0x000B lunghezza / numero di registri da leggere, 11 in questo caso • non c'è controllo CRC in quanto realizzato a livello IP tramite CRC-32 * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 00 00 0B * Tx ModbusTCP: 00 00 00 00 00 19 F7 03 16 00 01 00 01 00 01 00 01 03 D2 03 D2 03 F7 03 F7 03 D3 03 D1 03 D2 La risposta riporta 0x19 (25 decimale) bytes di PDU nella risposta: • 0xF7 indirizzo ModbusTCP • 0x03 funzione di Read Multiple Registers, senza errori • 0x16 (22 bytes) lunghezza degli 11 valori dei registri letti • 22 bytes contenenti gli 11 registri rappresentati in forma Big-Endian Lettura dei 16 registri Configurations (indirizzo Modbus iniziale 100 decimale, come da Tabella delle Risorse Modbus vista in precedenza) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 64 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 A5 A5 00 1F 97 FF 00 00 00 00 00 01 00 00 00 01 43 6F 6D 6D 2E 53 45 43 2D 54 6F 72 69 6E 6F 20 Lettura dei primi 16 registri Parameters (indirizzo Modbus iniziale 200 decimale, come da Tabella delle Risorse Modbus vista in precedenza) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 C8 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 00 00 01 F7 C0 A8 0A C8 FF FF FF 00 C0 A8 0A 01 C0 A8 0A FE C0 A8 0A FF C1 CC 72 E8 00 00 00 00 Lettura della seconda parte di registro Settings (indirizzo Modbus iniziale 317 decimale, con lunghezza 12) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 00 D9 00 0C * Tx ModbusTCP: 00 00 00 00 00 1B F7 03 18 00 00 00 00 00 00 00 00 00 00 08 08 08 08 00 00 00 00 00 50 01 F6 02 02 Lettura dei 16 registri Settings (indirizzo Modbus iniziale 300 decimale, come da Tabella delle Risorse Modbus vista in precedenza) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 01 90 00 0C * Tx ModbusTCP: 00 00 00 00 00 1B F7 03 18 00 00 00 14 00 05 A8 C0 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 Scrittura del registro 0 Volatiles (indirizzo Modbus iniziale 400 decimale, con valore 0x0007 per l'attivazione 8 / 17
  • 9. delle funzioni automatiche di reports STATO, EVENTI e TEMPO UTC) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 09 F7 10 01 90 00 01 02 00 07 * Tx ModbusTCP: 00 00 00 00 00 06 F7 10 02 90 00 01 * <STS> i[0] t[220] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 16:42:08 [1369327328] * <EVT> i[0] t[233] ao[000 000 000 000] di[ 1 1 1 #0] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </EVT> * <EVT> i[0] t[236] ao[000 000 000 000] di[ 1 1 1 #1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </EVT> * <STS> i[0] t[240] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 16:42:28 [1369327348] Riscrittura del registro 0 Volatiles per disabilitare le funzioni automatiche di reports STATO, EVENTI e TEMPO UTC attivate dal comando precedente * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 09 F7 10 01 90 00 01 02 00 00 * Tx ModbusTCP: 00 00 00 00 00 06 F7 10 02 90 00 01 Lettura dei primi 16 registri Errors * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 01 F4 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Scrittura dei primi due registri Errors con i valori 0x4142 e 0x4243 * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 0B F7 10 01 F4 00 02 04 41 42 42 43 * Tx ModbusTCP: 00 00 00 00 00 06 F7 10 04 F4 00 02 Rilettura dei primi 16 registri Errors per verifica * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 01 F4 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 41 42 42 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Scrittura dei primi 4 caratteri (2 registri) LCD all' indirizzo Modbus iniziale 600 * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 0B F7 10 02 58 00 02 04 41 42 42 43 * Tx ModbusTCP: 00 00 00 00 00 06 F7 10 04 58 00 02 Rilettura dei 16 registri LDC * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 58 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 41 42 42 43 6B 6E 20 20 41 43 49 4D 4C 4C 20 4F 52 20 73 6F 6F 73 20 20 30 32 33 31 35 30 33 32 Lettura dei 16 registri LCD * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 BC 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 45 53 00 16 05 23 00 13 61 E9 D4 D6 5E 45 45 94 45 FE DC 65 E5 49 3C 14 6A 7E 00 20 5B 59 3B DC Rilettura dei primi 16 registri RTC * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 BC 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 46 01 00 16 05 23 00 13 61 E9 D4 D6 5E 45 45 94 45 FE DC 65 E5 49 3C 14 6A 7E 00 20 5B 59 3B DC Rilettura dei primi 16 registri RTC, notare che sono trascorsi 2 secondi dal precedente comando (byte in verde) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 02 BC 00 10 * Tx ModbusTCP: 00 00 00 00 00 23 F7 03 20 46 03 00 16 05 23 00 13 61 E9 D4 D6 5E 45 45 94 45 FE DC 65 E5 49 3C 14 6A 7E 00 20 5B 59 3B DC Lettura dei 6 registri Holdings * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 03 20 00 06 * Tx ModbusTCP: 00 00 00 00 00 0F F7 03 0C 00 00 00 00 00 00 00 00 00 00 00 00 Scrittura dei registri Holdings 0 con valore 0x00FF ed 1 con valore 0x0000 (le uscite PWM sono valori ad 8 bits che vanno così da 0x0000 a 0x00FF) * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 0B F7 10 03 20 00 02 04 00 FF 00 00 * Tx ModbusTCP: 00 00 00 00 00 06 F7 10 04 20 00 02 Rilettura dei 6 registri Holdings per veriica * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 F7 03 03 20 00 06 * Tx ModbusTCP: 00 00 00 00 00 0F F7 03 0C 00 FF 00 00 00 00 00 00 00 00 00 00 #### da questo punto in poi vengono ripetuti in senso inverso i comandi sul lato ModbusRTU #### … si provi a descrivere autonomamente le azioni svolte partendo dalle informazioni acquisite nelle descrizioni precedenti delle azioni eseguite lato ModbusTCP ... * ModbusRTU * Rx RS485: 01 03 03 20 00 06 C4 46 * Tx RS485: 01 03 0C 00 FF 00 00 00 00 00 00 00 00 00 00 A0 67 9 / 17
  • 10. ... * ModbusRTU * Rx RS485: 01 10 03 20 00 02 04 00 00 00 FF A5 07 * Tx RS485: 01 10 04 20 00 02 41 32 ... * ModbusRTU * Rx RS485: 01 03 03 20 00 06 C4 46 * Tx RS485: 01 03 0C 00 00 00 FF 00 00 00 00 00 00 00 00 D6 84 ... * ModbusRTU * Rx RS485: 01 03 02 BC 00 06 05 94 * Tx RS485: 01 03 0C 48 11 00 16 05 23 00 13 61 E9 D4 D6 82 64 ... * ModbusRTU * Rx RS485: 01 03 02 BC 00 06 05 94 * Tx RS485: 01 03 0C 48 12 00 16 05 23 00 13 61 E9 D4 D6 8D 20 ... * ModbusRTU * Rx RS485: 01 03 02 58 00 06 45 A3 * Tx RS485: 01 03 0C 41 42 42 43 6B 6E 20 20 41 43 49 4D EB 6F ... * ModbusRTU * Rx RS485: 01 10 02 58 00 02 04 20 20 21 21 3C 17 * Tx RS485: 01 10 04 58 00 02 C1 2B ... * ModbusRTU * Rx RS485: 01 03 02 58 00 06 45 A3 * Tx RS485: 01 03 0C 20 20 21 21 6B 6E 20 20 41 43 49 4D 21 46 ... * ModbusRTU * Rx RS485: 01 03 01 F4 00 06 85 C6 * Tx RS485: 01 03 0C 41 42 42 43 00 00 00 00 00 00 00 00 B7 D8 ... * ModbusRTU * Rx RS485: 01 10 01 F4 00 02 04 00 00 00 00 F0 88 * Tx RS485: 01 10 04 F4 00 02 01 0A ... * ModbusRTU * Rx RS485: 01 03 01 F4 00 06 85 C6 * Tx RS485: 01 03 0C 00 00 00 00 00 00 00 00 00 00 00 00 93 70 ... * ModbusRTU * Rx RS485: 01 03 01 90 00 06 C4 19 * Tx RS485: 01 03 0C 00 00 00 14 00 05 A8 C0 FF FF FF FF 21 1D ... * ModbusRTU * Rx RS485: 01 10 01 90 00 01 02 00 07 EA 02 * Tx RS485: 01 10 02 90 00 01 00 5C * <STS> i[0] t[700] ao[000 255 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 16:50:30 [1369327830] * <EVT> i[0] t[709] ao[000 255 000 000] di[ 1 1 1 #0] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </EVT> * <EVT> i[0] t[710] ao[000 255 000 000] di[ 1 1 1 #1] ai[ 0978 0978 1016 1015 0979 0977 0978 ] </EVT> ... * ModbusRTU * Rx RS485: 01 10 01 90 00 01 02 00 00 AB C0 * Tx RS485: 01 10 02 90 00 01 00 5C ... * ModbusRTU * Rx RS485: 01 10 01 2C 00 01 02 00 00 B1 3C * Tx RS485: 01 10 02 2C 00 01 C1 B8 ... * ModbusRTU * Rx RS485: 01 03 01 2C 00 06 05 FD * Tx RS485: 01 03 0C 00 00 00 14 00 05 A8 C0 FF FF FF FF 21 1D ... * ModbusRTU * Rx RS485: 01 10 00 C8 00 01 02 12 34 BB 6F * Tx RS485: 01 10 02 C8 00 01 81 8F ... * Console _RI,0,0,11_ _RI,0,0,11,x0001,x0001,x0001,x0001,x03D2,x03D2,x03F7,x03F7,x03D3,x03D1,x03D2_ 10 / 17
  • 11. ... * ModbusRTU * Rx RS485: 01 10 00 C8 00 01 02 00 00 B6 18 * Tx RS485: 01 10 02 C8 00 01 81 8F ... * ModbusRTU * Rx RS485: 01 03 00 C8 00 06 44 36 * Tx RS485: 01 03 0C 00 00 01 F7 C0 A8 0A C8 FF FF FF 00 65 B5 ... * ModbusRTU * Rx RS485: 01 03 00 64 00 06 84 17 * Tx RS485: 01 03 0C A5 A5 00 1F 97 FF 00 00 00 00 00 01 05 06 ... * ModbusRTU * Rx RS485: 01 10 00 64 00 01 02 00 00 AE 74 * Tx RS485: 01 90 01 8D C0 ... * ModbusRTU * Rx RS485: 01 03 00 00 00 06 C5 C8 * Tx RS485: 01 03 0C 00 01 00 01 00 01 00 01 03 D2 03 D2 97 CC ... * ModbusRTU * Rx RS485: 01 10 00 00 00 01 02 00 00 A6 50 * Tx RS485: 01 90 01 8D C0 ... * ModbusRTU * Rx RS485: 01 10 01 90 00 01 02 04 00 A9 00 * Tx RS485: 01 10 02 90 00 01 00 5C ... * ModbusRTU * Rx RS485: 01 10 01 90 00 01 02 40 00 9A 00 * Tx RS485: 01 10 02 90 00 01 00 5C ... *** InterLINK 'CAMILLO ROSSO' www.commsec.it *** * Platform: CHAMELEON * Firmware: 20130523 * USB-Serial: Console and InterLINK Server * Set EEPROM Configurations and Parameters default * InterLINK ID: 0 * ModbusRTU Addr: 1, ModbusTCP Addr: 247 * Camillo IP: 192.168.10.200 * Syslog Server IP: 192.168.10.254 * HTTP: InterLINK Server * ModbusTCP: Server * RS485: ModbusRTU Server [9600 N 8 1] * RTC [UTC and UNIX] Time: 2013/05/23 18:37:39 [1369334259] * <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0978 #0978 #1015 #1015 #0979 #0977 #0978 ] </EVT> * <EVT> i[0] t[ 13] ao[000 000 000 000] di[ 1 1 1 #0] ai[ 0978 0978 1015 1015 0979 0977 0977 ] </EVT> * <EVT> i[0] t[ 15] ao[000 000 000 000] di[ 1 1 1 #1] ai[ 0978 0978 1016 1015 0979 0977 0978 ] </EVT> * <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0978 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 18:37:59 [1369334279] * <STS> i[0] t[ 40] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1015 1015 0979 0977 0977 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 18:38:20 [1369334300] * <STS> i[0] t[ 60] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0978 0978 1016 1015 0979 0977 0978 ] </STS> * RTC [UTC and UNIX] Time: 2013/05/23 18:38:40 [1369334320] 11 / 17
  • 12. Questa seconda serie di esempi usa invece CAMILLO GIALLO che espone un Server ModbusTCP sulla porta 502 e che fa anche da Gateway ModbusTCP verso la porta ModbusRTU su bus RS485. Gli stessi esempi visti per CAMILLO ROSSO lato ModbusTCP valgono anche per CAMILLO GIALLO. La rete RS485 è questa volta però Client ModbusRTU che viene pilotato tramite ModbusTCP fornendo come indirizzo ModbusTCP non quello relativo a CAMILLO GIALLO ma bensì dei componenti ModbusRTU connessi sul lato Client della rete RS485, in questo caso un DAT3011 di DATEXEL. *** InterLINK 'CAMILLO GIALLO' www.commsec.it *** * Platform: CHAMELEON * Firmware: 20130523 * USB-Serial: Console and InterLINK Server * InterLINK ID: 0 * ModbusRTU Addr: 1, ModbusTCP Addr: 247 * Camillo IP: 192.168.10.200 * Syslog Server IP: 192.168.10.254 * HTTP: InterLINK Server * ModbusTCP: Server / ModbusRTU Gateway * RS485: ModbusRTU Client used by InterLINK and ModbusTCP Gateway [9600 N 8 1] * RTC [UTC and UNIX] Time: 2013/05/23 17:03:41 [1369328621] * <EVT> i[0] t[ 0] ao[000 000 000 000] di[#1 #1 #1 #1] ai[#0910 #0980 #0980 #0980 #0980 #0980 #0982 ] </EVT> * <EVT> i[0] t[ 17] ao[000 000 000 000] di[ 1 1 1 #0] ai[ 0910 0980 0980 0980 0981 0980 0982 ] </EVT> * <EVT> i[0] t[ 18] ao[000 000 000 000] di[ 1 1 1 #1] ai[ 0910 0980 0980 0980 0981 0980 0982 ] </EVT> * <STS> i[0] t[ 20] ao[000 000 000 000] di[ 1 1 1 1] ai[ 0910 0980 0980 0980 0980 0980 0981 ] </STS> Disabilitazione delle funzioni automatiche di trasmissione STATO ed EVENTI * Console _WV,0,0,1,0_ _WV,0,0,1,0_ Lettura dei primi 16 registri del modulo DAT3011 con indirizzo ModbusRTU 1 dalla porta RS485 utilizzata come Client ModbusRTU dal Gateway ModbusTCP * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 01 03 00 00 00 10 * Tx RS485: 01 03 00 00 00 10 44 06 * Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 02 00 04 00 00 03 00 0A 00 00 00 00 00 00 8D 00 * Tx ModbusTCP: 00 00 00 00 00 23 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 02 00 04 00 00 03 00 0A 00 00 00 00 00 00 Attivazione delle 3 uscite del DAT3011 tramite scrittura remota del suo registro 9 con il valore 0x0700 * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 09 01 10 00 09 00 01 02 07 00 * Tx RS485: 01 10 00 09 00 01 02 07 00 A4 F9 * Rx RS485: 01 10 00 09 00 01 D1 CB * Tx ModbusTCP: 00 00 00 00 00 06 01 10 00 09 00 01 Rilettura dei 16 registri del modulo DAT3011 con indirizzo ModbusRTU 1 a partire dal suo registro 9 * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 01 03 00 09 00 10 * Tx RS485: 01 03 00 09 00 10 94 04 * Rx RS485: 01 03 20 07 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF FF 06 00 00 00 00 00 00 00 78 E1 * Tx ModbusTCP: 00 00 00 00 00 23 01 03 20 07 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF FF 06 00 00 00 00 00 00 00 Rilettura manuale da Console tramite comando InteLINK dei primi 16 registri del modulo DAT3011 … si noti la semplicità e la potenza del comando manuale del Gateway InterLINK / ModbusRTU di CAMILLO GIALLO * Console _RM,1,0,16_ * Tx RS485: 01 03 00 00 00 10 44 06 * Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 07 00 04 00 00 03 00 0A 00 00 00 00 00 00 88 05 _RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0200,x0700,x0400,x0003,x000A,x0000,x0000,x0000_ Comando InterLINK di attivazione delle uscite 1 e 3 del Modulo DAT3011 impostate dalla parte alta del registro 9 … si noti la semplicità e la potenza del comando manuale del Gateway InterLINK / ModbusRTU di CAMILLO GIALLO * Console _WM,1,9,1,X500_ * Tx RS485: 01 10 00 09 00 01 02 05 00 A5 99 * Rx RS485: 01 10 00 09 00 01 D1 CB _WM,1,9,1,X500_ Rilettura manuale da Console dei primi 16 registri del modulo DAT3011 * Console _RM,1,0,16_ * Tx RS485: 01 03 00 00 00 10 44 06 * Rx RS485: 01 03 20 00 65 09 00 00 00 30 33 31 31 00 07 00 01 00 64 02 00 05 00 04 00 00 03 00 0A 00 00 00 00 00 00 8B C7 _RM,1,0,16,x0065,x0900,x0000,x3033,x3131,x0007,x0001,x0064,x0200,x0500,x0400,x0003,x000A,x0000,x0000,x0000_ 12 / 17
  • 13. Rilettura via Gateway ModbusTCP dei primi 16 registri del modulo DAT3011 posto sul bus ModbusRTU * ModbusTCP Remote_IP: 192.168.10.254 * Rx ModbusTCP: 00 00 00 00 00 06 01 03 00 09 00 10 * Tx RS485: 01 03 00 09 00 10 94 04 * Rx RS485: 01 03 20 05 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF FF 0E 00 00 00 00 00 00 00 78 5F * Tx ModbusTCP: 00 00 00 00 00 23 01 03 20 05 00 04 00 00 03 00 0A 00 00 00 00 00 00 00 00 00 00 03 0A 03 00 FF FF 0E 00 00 00 00 00 00 00 Dettaglio RISORSE per piattaforme hardware CHAMELEON di EurogiDevices //--- InterLINK Errors --- // Transmitted with minus sign inside InterLINK packet response like "_-2_" (COMMAND_UNKNOWN_ERROR) #define PACKET_FORMAT_ERROR 1 #define COMMAND_UNKNOWN_ERROR 2 #define ID_DESTINATION_ERROR 3 #define ID_RESOURCE_ERROR 4 #define LENGTH_ERROR 5 #define FIELD_ERROR 6 #define RTC_ERROR 7 #define MODBUS_EXCEPTION_ERROR 10 //--- MODBUS EXCEPTION plus following Exception Code --- #define MODBUS_RESPONSE_TIMEOUT_ERROR 0 // RESPONSE TIMEOUT Exception Code #define MODBUS_ILLEGAL_FUNCTION 1 // ILLEGAL FUNCTION Exception Code #define MODBUS_ILLEGAL_DATA_ADDRESS 2 // ILLEGAL DATA ADDRESS Exception Code #define MODBUS_ILLEGAL_DATA_VALUE 3 // ILLEGAL DATA VALUE Exception Code //--- Read-Only INPUTS 'I' --- -------------------------------------------------------------------------------- offset length description -------------------------------------------------------------------------------- (0) (1) KEY_1 / Digital Input 1 (1) (1) KEY_2 / Digital Input 2 (2) (1) KEY_3 / Digital Input 3 (3) (1) KEY_4 / Digital Input 4 (4) (1) INPUT_1 / Analog Input 1 Passivi (no pull-up a 10Vdc) (5) (1) INPUT_2 / Analog Input 2 Passivi (no pull-up a 10Vdc) (6) (1) INPUT_3 / Analog Input 3 Analog Output su CHAMELEON 2 (7) (1) INPUT_4 / Analog Input 4 Analog Output su CHAMELEON 2 (8) (1) INPUT_5 / Analog Input 5 Attivi (pull-up a 10Vdc) (9) (1) INPUT_6 / Analog Input 6 Attivi (pull-up a 10Vdc) (10) (1) INPUT_7 / Analog Input 7 Non presente su CHAMELEON 2 //--- Persistent CONFIGURATIONS 'C' on EEPROM --- -------------------------------------------------------------------------------- offset length description -------------------------------------------------------------------------------- (0) (1) Products Hardware Configured (0xA5A5) (1) (3) Ethernet MAC Address (progressively changed on EEPROM in the laboratory before shipping, 13 / 17
  • 14. [0x00, 0x1F, 0x97, 0xFF, 0x00, 0x00] is the firmware default (4) (2) Product Serial Number on EEPROM (6) (2) Product Identifier Number on EEPROM (8) (8) Product Information String on EEPROM 16 characters //--- Persistent PARAMETERS 'P' on EEPROM --- -------------------------------------------------------------------------------- offset length description -------------------------------------------------------------------------------- (0) (1) InterLINK Server ID [0 default, 248, 249, ... , 256, 257, ... , 65535] (1) (1) ModbusRTU (MSB byte) and ModbusTCP (LSB byte) addresses [1 default ModbusRTU, 2, 3, ... , 247 default ModbusTCP] (2) (2) Ethernet / Internet IP Address, [192.168.10.200] default, 32 bits big-endian (224.0.0.0 ... 239.255.255.255 for Multicast IPs - UDP) (4) (2) IP Netmask, [255.255.255.0] local default, 32 bits big-endian (not used for Multicast IPs) (6) (2) IP Gateway [192.168.10.1] local default, 32 bits big-endian (8) (2) SYSLOG Server(s) Address, [192.168.10.254] local Syslog default, 32 bits big-endian (10) (2) Broadcast/Multicast Server(s) Address, [192.168.10.255] local Broadcast default, 32 bits big-endian (12) (2) NTP Network Time Server Address [193.204.114.232] internet default (ntp1.ien.it), 32 bits big-endian (14) (2) T_IP_1 Trusted CLIENT Ethernet / Internet IP Address, 32 bits big-endian *** actually not used *** (16) (2) T_IP_2 Trusted CLIENT Ethernet / Internet IP Address, 32 bits big-endian *** actually not used *** (18) (2) T_IP_3 Trusted CLIENT Ethernet / Internet IP Address, 32 bits big-endian *** actually not used *** (20) (2) T_IP_4 Trusted CLIENT Ethernet / Internet IP Address, 32 bits big-endian *** actually not used *** (22) (2) DNS Server Address, [8.8.8.8] internet default (Google), 32 bits big-endian (24) (1) spare register, reserved for future use (25) (1) RS485 / ModbusRTU baud rate (0=9600 default, 1=19200, 2=38400), always no parity, 8 bits, 1 stop bit minimum (26) (1) spare register, reserved for future use (HTTP Port, default 80) (27) (1) spare register, reserved for future use (MODBUS_TCP Port, default 502) (28) (1) spare register, reserved for future use (SYSLOG or Broadcast/Multicast Port, default 514) //--- Persistent 'S'ettings registers EEPROM --- // Note: SETTINGS area is copyed into VOLATILE area at CAMILLO Power On Reset // Changing SETTING area make changes persistent // Changing VOLATILE area make changes temporary (restored from SETTINGS at next CAMILLO Power On Reset // System Utility Functions defines for SETTING 'utilityFunctionsMasks' (into persistent S area and volatile V area) 14 / 17
  • 15. #define utilityFunctionsMasks volatilesRegisters[0] // Bit Masks into 'utilityFunctionsMasks' : #define SYSTEM_EVENTS_ENABLED 0x0001 // Automatic transmission of STATE CHANGES on Analog and Digital Inputs #define SYSTEM_STATE_ENABLED 0x0002 // Automatic transmission of STATE #define SYSTEM_TIME_ENABLED 0x0004 // Automatic TIME display on Consolle (use same temporization of SYSTEM_STATE_ENABLED) #define DHCP_ENABLED 0x0010 // DHCP is Not Recommended in Measure, Automation and Control Applications #define NTP_ENABLED 0x0020 #define TRUSTED_IP_ENABLED 0x0040 // Not yet implemented, ready for future security improvements starting September 2013 #define DEBUG 0x0800 // Verbose CONSOLE messages, set on for troubleshooting #define RTC_RAM_CLEAR 0x1000 #define RELOAD_DEFAULTS 0x4000 // The Configuration table is not reloaded (MAC, Serial Number, Identification ... untouched) #define REMOTE_SOFT_RESET 0x8000 // Restart from remote 'S'ettings registers defaults ('S' and 'V' resource at Power On Reset) -------------------------------------------------------------------------------- offset length description -------------------------------------------------------------------------------- (0) (1) 'utilityFunctionsMasks' EEPROM image (1) (1) Automatic Display and Transmission of System Image and TIME display on Console any 'x' seconds (2) (1) Acquire any 'x' per 100 milliseconds the Inputs Image and Transmit any Inputs Events if enabled (3) (1) Syncronize with NTP Time Server any 'x' seconds, default is 12 hours = 43200 sec (0xA8C0) (4) (1) Inputs without (bit_mask=0) or with (bit_mask=1) 10Vcc pull-up 1k8 ohm (bit0=input1, ... , bitN-1=inputN), default 10Vcc pull-up (5) (1) Outputs PWM (bit_mask=0) or DIM (bit_mask=1), (bit0=output1, ... , bitN-1=outputN) , default to DIM (6) reserved for future use … ... (15) reserved for future use //--- Volatile 'V'olatile registers on RAM --- VOLATILE, RAM copy of SETTINGs Registers area at Power On Reset //--- 'E'rrors 16 bits up-counters on RAM --- // ERRORS are counted on a 16 bit up-counters at offset 'error' into the 'errorResgister[]' array using function 'void Error(unsigned char error)' // ERRORS can be readed / writed using InterLINK commands 'RE' and 'WE' //--- System ERRORS registers --- #define RTC_ACCESS_ERROR 0 #define CONSOLE_OVERRUN_ERROR 1 #define HTTP_OVERRUN_ERROR 2 15 / 17
  • 16. #define TELNET_OVERRUN_ERROR 3 #define MODBUS_TCP_OVERRUN_ERROR 4 #define MODBUS_RTU_OVERRUN_ERROR 5 #define RS485_OVERRUN_ERROR 6 #define NTP_SYNCRONIZATION_ERROR 7 … up to 32 registers //--- LCD Display Image --- *Non presente su CHAMELEON 2 16 bits registers (0..8 first LCD row in "Little Endian" mode, swapped couple of characters) (9..15 second LCD row in "Little Endian" mode, swapped couple of characters) //--- RTC and backup RAM Image --- *Non presente su CHAMELEON 2 16 bits registers (0) secondsBcd, minutesBcd (1) hoursBcd, weekdayBcd (2) dayBcd, monthBcd (3) yearBcd, controlBits (4...31) ramBackupUserRegisters //--- Volatile REGISTERS 'H' OUTPUTs and RAM --- -------------------------------------------------------------------------------- offset length description -------------------------------------------------------------------------------- *Su CHAMELEON 1 (0) (1) OUTPUT_1 8 bits PWM Register (1) (1) OUTPUT_2 8 bits PWM Register (2) (1) OUTPUT_3 8 bits PWM Register (3) (1) OUTPUT_4 8 bits PWM Register (4) (1) Backligth LCD * seconds (5) (1) Buzzer ALARM * 0.1 seconds *Su CHAMELEON 2 (0) (1) OUTPUT_1 8 bits PWM Register (1) (1) OUTPUT_2 8 bits PWM Register (2) (1) OUTPUT_3 8 bits PWM Register (3) (1) OUTPUT_4 8 bits PWM Register (4) (1) OUTPUT_5 8 bits PWM Register (5) (1) OUTPUT_6 8 bits PWM Register (6) (1) OUTPUT_7 1 bits Digital Register State (Read Only) (7) (1) OUTPUT_8 1 bits Digital Register State (Read Only) (8) (1) OUTPUT_78 Digital Register Command (Read/Write) bit 8 = OUTPUT_7 Command (0=Off, 1=On) bit 9 = OUTPUT_8 Command (0=Off, 1=On) … i bits sono numerati da 0 (lsb) a 15 (msb) (9) (1) ANALOG_OUTPUT_3 8 bits Analog I/O 3 (10) (1) ANALOG_OUTPUT_4 8 bits Analog I/O 4 16 / 17
  • 17. Questo documento si propone di descrivere sinteticamente le funzioni e facilitare l' utilizzo delle piattaforme hardware che montano il firmware CAMILLO. Inviate i vostri commenti, segnalazioni e suggerimenti a valter.foresto@commsec.it con oggetto “Firmware CAMILLO” che pensate possano essere utili a migliorarne la qualità e la chiarezza espositiva di questa documentazione. Grazie sin d'ora per la collaborazione, Valter Foresto. 17 / 17