Protocollo Modbus
Protocollo Modbus per le applicazioni MarioCotta
Modbus-TCP
Configurazione
Nel Menu Service ModBUS impostare le variabili
Unit ID : Modbus.id (default 1)
PORT: ModBus.port (default 502)
Letture e scritture con Endian: Little
| Menu "Service ModBUS" | |||
|---|---|---|---|
| Variabile | Descrizione | ||
| modbus.port | Per ModBUS-NET porta di connessione di default 502 | ||
| modbus.id | Identificativo del dispositivo nella rete ModBUS default 1 | ||
| modbus.error | Indica l'errore dell'ultima operazione ModBUS in formato stringa | ||
| modbus.pktRecvCnt | Indica il numero di pacchetti ricevuti | ||
| modbus.pktErrCnt | Indica il numero di errori | ||
Descrizione comandi e registri
| Tipo di comando | |||
|---|---|---|---|
| Per | Operazione | Function Code | N. di registri |
| WORD | READ | Read Holding Register (0x03) | 1 |
| WORD | WRITE | Write Multiple Register (0x10) | 1 |
| INT | READ | Read Holding Register (0x03) | 1 |
| INT | WRITE | Write Multiple Register (0x10) | 1 |
| DINT | READ | Read Holding Register (0x03) | 2 |
| DINT | WRITE | Write Multiple Register (0x10) | 2 |
| FLOAT | READ | Read Holding Register (0x03) | 2 |
| FLOAT | WRITE | Write Multiple Register (0x10) | 2 |
| Base Addr = 0 Address 9000 |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | WORD | Status Word Bit0 1=motore abilitatoBit1 1=ricevuto comando di startBit2 1=comando terminatoBit3 1=motore in movimentoBit4 1=driver in erroreBit5 1=asse con homing eseguitoBit6..15 N.U. |
| 1 | WORD | Control WordBit0 1=abilita motore, 0=disabilita Bit1 1=attiva il comando, 0=abortisceBit2 1=stop in emergenza (quick_stop)Bit3 N.U.Bit4 1=reset erroriBit5 1=pulisce lista erroriBit6..7 N.U.Bit8..11 0..15=comando Bit12..15 N.U. |
| 2..11 | INT | Error List[0..9] |
Control Word Bits 8..11 |
||
|---|---|---|
| valore | comando | Descrizione |
| 0 | CMD_NO_COMMAND | Nessun comando attivo |
| 1 | CMD_HOME | Comando di Home.homeTorquehomeOffsethomeSpeedaccdec |
| 2 | CMD_ABSMOVE | Comando di movimento a posizione assoluta.spaToMoveAbsspeedaccdec |
| 3 | CMD_RELMOVE | Comando di movimento a posizione relativa.spaToMoveRelspeedaccdec |
| 4 | CMD_VELMOVE | Comando di movimento in velocità.speedaccdec |
| 5 | CMD_TORQUE | Comando di applicazione coppia.Torque |
| 10 | CMD_KNF_START | Applicazione: Comando di coltello in lavoro (con elettrovalvole).Vedi parametri Address 9200/9500 |
| 11 | CMD_KNF_STOP | Applicazione: Comando di fine coltello in lavoro (con elettrovalvole).Vedi parametri Address 9200/9500 |
| 12 | CMD_HOMMOVE | Comando di ricerca e posizionamento in Home.Vedi parametri Address 9200/9500 |
| 13 | CMD_MOV2POS | Comando di movimento a posizione.Vedi parametri Address 9200/9500 |
| 14 | CMD_SRC_CURR | Comando di ricerca corrente up/down.Vedi parametri Address 9200/9500 |
| 15 | CMD_SRC_LIMIT | Comando di ricerca limite up/down.Vedi parametri Address 9200/9500 |
| Base Addr = 0 Address 9100 |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | DINT | spaToMoveAbs |
| 2 | DINT | spaToMoveRel |
| 4 | DINT | limTorque |
| 6 | DINT | homeTorque |
| 8 | DINT | homeOffset |
| 10 | DINT | speed |
| 12 | DINT | homeSpeed |
| 14 | DINT | acc |
| 16 | DINT | dec |
| 18 | DINT | maxdec |
| 20 | INT | homeMode |
| Base Addr = 0 Address 9200 Registri custom |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | INT | um_dist Unità di misura - Distanza0=mm, 1=inch |
| 1 | INT | um_press Unità di misura - Pressione0=bar, 1=psi |
| 2 | INT | um_force Unità di misura - Forza0=kg, 1=lb |
| 3 | INT | am_blade_diam Impostazione diametro lama0=auto, 1=manuale |
| 4 | INT | am_blade_dist Impostazione distanza lama0=auto, 1=manuale |
| 5 | INT | EmergencyAction Azione in emergenza0=ferma tutto, 1=non fermare |
| 6 | INT | VA_TStart Tempo di inizio valvola di corsa (msec) |
| 7 | INT | VA_TEnd Tempo di fine valvola di corsa (msec) |
| 8 | INT | VR_TStart Tempo di inizio valvola di disinnesto (msec) |
| 9 | INT | VR_TEnd Tempo di fine valvola di disinnesto (msec) |
| 10 | FLOAT | Y1 |
| 12 | FLOAT | Y2 |
| 14 | FLOAT | A |
| 16 | FLOAT | B |
| 18 | FLOAT | D0 |
| 20 | FLOAT | D |
| 22 | FLOAT | P |
| 24 | FLOAT | Pr Set point valvola prop. |
| 26 | FLOAT | ValvPrMin Pressione valvola prop., min |
| 28 | FLOAT | ValvPrMax Pressione valvola prop., max |
| 30 | INT | ValvPrRangePct Range di validità valvola prop. (%) |
| 31 | INT | dac_corr Correzione DAC (per valvola) |
| 32 | FLOAT | JogStepFine Passo jog fine |
| 34 | FLOAT | JogStepCoarse Passo jog grossolano |
| 36 | FLOAT | A_min Limite impostabile A_min |
| 38 | FLOAT | A_max Limite impostabile A_max |
| 40 | FLOAT | D_min Limite impostabile D_min |
| 42 | FLOAT | D_max Limite impostabile D_max |
| 44 | FLOAT | P_min Limite impostabile P_min |
| 46 | FLOAT | P_max Limite impostabile P_max |
| 48 | FLOAT | Pr_min Limite impostabile Pr_min |
| 50 | FLOAT | Pr_max Limite impostabile Pr_max |
| 52 | FLOAT | coe_kg Coefficiente dell'equazione della forza |
| 54 | FLOAT | errUp Parametro di correzione errore (salita) |
| 56 | FLOAT | errDn Parametro di correzione errore (discesa) |
| 58 | FLOAT | PrMinAlarm Pressione: valore minimo di validità/allarme |
| 60 | FLOAT | var_q Intercetta dell'equazione della forza |
| 62 | FLOAT | ValvPrRangeAbs Range di validità valvola prop. (assoluto) |
| Base Addr = 0 Address 9300 |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | DINT | actPosition |
| 2 | DINT | actTorque |
| 4 | DINT | actSpeed |
| 6 | DINT | actAnalogInput |
| Base Addr = 0 Address 9400 |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | INT | position_notation_index |
| 1 | INT | velocity_notation_index |
| 2 | INT | acceleration_notation_index |
| 3 | INT | torque_notation_index |
| Base Addr = 0 Address 9500 Registri custom |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | FLOAT | fndZr_srcSpeed Velocità (ricerca) |
| 2 | FLOAT | fndZr_getSpeed Velocità (movimento) |
| 4 | FLOAT | fndZr_acc Accelerazione |
| 6 | FLOAT | fndZr_dec Decelerazione |
| 7 | FLOAT | fndZr_homing_offset Offset di homing |
| 10 | FLOAT | fndZr_homing_park Posizione di parcheggio |
| 12 | FLOAT | fndCur_srcSpeed Velocità |
| 14 | FLOAT | fndCur_acc Accelerazione |
| 16 | FLOAT | fndCur_dec Decelerazione |
| 18 | INT | fndCur_direction Direzione (1=giù; -1=su) |
| 20 | FLOAT | lmtPos_zrSpeed Velocità |
| 22 | FLOAT | lmtPos_srcSpeed Velocità (ricerca) |
| 24 | FLOAT | lmtPos_acc Accelerazione |
| 26 | FLOAT | lmtPos_dec Decelerazione |
| 28 | INT | lmtPos_direction Direzione (1=giù; -1=su) |
| 30 | FLOAT | goPos_srcSpeed Velocità |
| 32 | FLOAT | goPos_acc Accelerazione |
| 34 | FLOAT | goPos_dec Decelerazione |
| 36 | FLOAT | goPos_srcSpeedJog Velocità (jog) |
| 38 | FLOAT | goPos_accJog Accelerazione (jog) |
| 40 | FLOAT | goPos_decJog Decelerazione (jog) |
| Base Addr = 0 Address 9600 Registri custom |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | DINT | On counter |
| 2 | DINT | Work counter |
| 4 | WORD | Inputs Bit0 FCHBit1 FCHBit2 FCIBit3 ON/OFF remotoBit4 EmergenzaBit5..15 N.U. |
| 5 | WORD | Outputs Bit0 Valvola di corsaBit1 Valvola di disinnestoBit2 Valvola frenoBit3..15 N.U. |
| 6 | FLOAT | Board temperature |
| 8 | FLOAT | V power |
| 10 | FLOAT | Pression measured |
| 12 | FLOAT | Current position |
| 14 | FLOAT | Work position |
| Base Addr = 0 Address 9700 Registri custom (log eventi) |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | INT | Read command (idx to read)>0 dalla testa, all'indietro (dal più recente al più vecchio); <0 dalla coda, in avanti (dal più vecchio al più recente) |
| 1 | WORD | EventCount |
| 2 | DINT | Date/Time (packed) |
| 4 | WORD | EventCode |
| 5 | WORD | EventStatus |
| 6 | FLOAT | Data_1 |
| 8 | FLOAT | Data_2 |
Struttura del campo Date/Time:
struct __attribute__((packed)) {
unsigned second :6;
unsigned minute :6;
unsigned hour :5;
unsigned day :5;
unsigned month :4;
unsigned year :6;
} EventDateTime;
| Base Addr = 0 Address 9800 Registri custom (accelerometro) |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | WORD | Alarm |
| 1 | INT | N.U. |
| 2 | FLOAT | acc temp [°C] |
| 4 | FLOAT | acc x [mg] |
| 6 | FLOAT | acc y [mg] |
| 8 | FLOAT | acc z [mg] |
| 10 | FLOAT | ang rate x [mdps] |
| 12 | FLOAT | ang rate y [mdps] |
| 14 | FLOAT | ang rate z [mdps] |
| Base Addr = 0 Address 9900 Registri custom (accelerometro) |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | WORD | Alarm enable |
| 1 | INT | alarm time acc x [ms] |
| 2 | INT | alarm time acc y [ms] |
| 3 | INT | alarm time acc z [ms] |
| 4 | FLOAT | threshold preal up x [mg] |
| 6 | FLOAT | threshold alarm up x [mg] |
| 8 | FLOAT | threshold preal dn x [mg] |
| 10 | FLOAT | threshold alarm dn x [mg] |
| 12 | FLOAT | threshold preal up y [mg] |
| 14 | FLOAT | threshold alarm up y [mg] |
| 16 | FLOAT | threshold preal dn y [mg] |
| 18 | FLOAT | threshold alarm dn y [mg] |
| 20 | FLOAT | threshold preal up z [mg] |
| 22 | FLOAT | threshold alarm up z [mg] |
| 24 | FLOAT | threshold preal dn z [mg] |
| 36 | FLOAT | threshold alarm dn z [mg] |
| Bit per allarme e configurazione: | ||
|---|---|---|
| Bit | Valore | Descrizione |
| 0 | 0x0001 | Prealarm up, x |
| 1 | 0x0002 | Alarm up, x |
| 2 | 0x0004 | Prealarm down, x |
| 3 | 0x0008 | Alarm down, x |
| 4 | 0x0010 | Prealarm up, y |
| 5 | 0x0020 | Alarm up, y |
| 6 | 0x0040 | Prealarm down, y |
| 7 | 0x0080 | Alarm down, y |
| 8 | 0x0100 | Prealarm up, z |
| 9 | 0x0200 | Alarm up, z |
| 10 | 0x0400 | Prealarm down, z |
| 11 | 0x0800 | Alarm down, z |
| 12-14 | not used |
|
| 15 | 0x8000 | Generic error |
| Base Addr = 0 Address 10000 Registri custom (configurazione) |
||
|---|---|---|
| + Indice | Tipo | Descrizione |
| 0 | INT | Date.Year (es: 2025) |
| 1 | INT | Date.Month (1..12) |
| 2 | INT | Date.Day (1..31) |
| 3 | INT | Date.Hour (0..23) |
| 4 | INT | Date.Minute (0..59) |
| 5 | INT | Date.Second (0..59) |
| 6 | DINT | Network config: IP address |
| 8 | DINT | Network config: netmask |
| 10 | DINT | Network config: gateway |
| 12 | INT | UnlockCode |