Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:software:devices:modbus [2016/12/27 14:32] – [6.3.2. Parameters] qem103 | en:software:devices:modbus [2020/07/13 14:58] (current) – qem103 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== DEVICE MODBUS ====== | ====== DEVICE MODBUS ====== | ||
- | ===== - Introduction ===== | + | ====== - Introduction |
The MODBUS< | The MODBUS< | ||
Line 550: | Line 550: | ||
- | === - Variabili | + | === - Variables |
- | ^Nome^D^R^A^Condizioni^ Descrizione^ | + | |
- | |serr|B|0|R/ | + | |
- | === - Stati === | + | ^Name^D^R^A^Conditions^Description^ |
- | ^Nome^D^R^A^Condizioni^ Descrizione^ | + | |serr|B|0|R/W|-|**Serial Errors**\\ Indicates if errors occurred |
- | |st_msgrx|F|0|R||-|**Message received**\\ Stato utilizzato solo in modalitá slave. Indica che un messagio del master ha eseguito una scrittura nell’area scambio dati QCL. Lo stato viene resettato con il comando RECEIVED.| | + | |
- | |st_opencom|F|0|R|-|**Open communication port**\\ L' | + | |
- | |wdata|F|0|R|-|**Warning Data**\\ Questo bit segnala che è stato tentato un inserimento di un valore non valido in un parametro.| | + | |
- | |wcmd|F|0|R|-|**Warning Command**\\ Questo bit segnala che è non è stato eseguito un comando perchè mancano le condizioni necessarie.| | + | |
- | === - Comandi | + | === - States |
- | I comandi a disposizione per gestire il device sono elencati sotto in ordine di priorità decrescente.\\ | + | |
- | Il device esegue tutti i comandi ricevuti entro lo stesso tempo di campionamento iniziando da quello con la priorità maggiore.\\ | + | |
- | Per esempio se il device riceve nello stesso tempo di campionamento i comandi CLOSECOM e OPENCOM, per primo esegue il comando OPENCOM e poi quello di CLOSECOM lasciando perciò la porta di comunicazione chiusa. | + | |
- | ^ Nome ^ D ^ R ^ A ^ Condizioni | + | |
- | | RECEIVED | + | |
- | | VALIDATE | + | |
- | | CLRWDATA | + | |
- | | CLRWCMD | + | |
- | | OPENCOM | + | |
- | | CLOSECOM | + | |
+ | ^Name^D^R^A^Conditions^Description^ | ||
+ | |st_msgrx|F|0|R|-|**Message received**\\ State used only in slave mode. Indicates that a message from the master has executed a write in the QCL data exchange area. The state is reset with the RECEIVED command.| | ||
+ | |st_opencom|F|0|R|-|**Open communication port**\\ Activation indicates that the device is working with the serial communications port. To set this state use the OPENCOM command, for reset use CLOSECOM.| | ||
+ | |wdata|F|0|R|-|**Warning Data**\\ This bit indicates that an attempt was made to insert an invalid value in a parameter.| | ||
+ | |wcmd|F|0|R|-|**Warning Command**\\ This bit indicates that it did not execute a command because they lack the necessary conditions.| | ||
+ | === - Commands === | ||
- | ===== - Migrazione dal device | + | The available commands to manage the device |
+ | The device | ||
+ | For example if the device receives the same sampling time CLOSECOM and OPENCOM commands, first run the OPENCOM command and than to CLOSECOM leaving therefore the communication port closed. | ||
- | Il primo aspetto da tenere presente per la migrazione è il fatto che il device MODBUS01 è esterno mentre il MODBUS è | + | ^ Name ^ D ^ R ^ A ^ Conditions |
- | interno. Questo implica che la dichiarazione del device deve essere eseguita nella sezione “INTDEVICE” dell’unità di | + | | RECEIVED |
- | configurazione del progetto. Inoltre, questo comporta la scelta, durante la definizione del device MODBUS, del tempo di | + | | VALIDATE |
- | campionamento. Il valore del tempo di campionamento che mantiene inalterate le prestazioni della comunicazione tra i | + | | CLRWDATA |
- | due device è pari a 5 ms. Bisogna inoltre, in fase di definizione, | + | | CLRWCMD |
- | Il device MODBUS ha aumentato il numero di variabili di scambio (da 16 word a 32 word) ma questo non influenza il funzionamento | + | | OPENCOM |
- | per le impostazioni che utilizzano al massimo 16 word come sono quelle pensate per il device MODBUS01.\\ | + | | CLOSECOM |
- | Il device MODBUS ha limitato la variabile “num” a 128, mentre per il device MODBUS01 il limite è 256. Questo si è reso | + | |
- | necessario per permettere un’ottimizzazione del tempo di campionamento. La scelta è stata presa in considerazione del | + | |
- | fatto che tali valori venivano impiegati unicamente per la gestione dei Coils, ma che perdeva di logica la lettura/ | + | |
- | più di 128 coils consecutivi.\\ | + | |
- | Il device | + | |
- | del device. Questa nuova funzionalitá è interessante nell' | + | |
- | devices che possono utilizzare la stessa seriale.\\ | + | |
- | Se un applicativo era stato scritto per il device | + | |
- | solo una volta) come mostrato nel seguente esempio. | + | |
- | ==== Esempio: ==== | + | |
+ | |||
+ | ===== - Migration from MODBUS01 device to MODBUS device ===== | ||
+ | |||
+ | The first thing to note for migration is the fact that the MODBUS01 device is external, while the MODBUS is internal. This implies that the device declaration must be done in “INTDEVICE” section in the configuration unit of the project. In addition, this entails choosing, when defining the MODBUS device, of the sampling time. The value of the sample time that keeps the performance of communication between the two devices is 5 ms. Being defined, you must select the serial port to be committed.\\ | ||
+ | The MODBUS device increased the number of exchange variables (from 16 word to 32 word) but this does not affect the operation for settings that use the maximum 16 word How are those designed for the MODBUS01 device.\\ | ||
+ | The MODBUS device has restricted the “num” variable to 128, while the MODBUS01 device the limit is 256. This was necessary to allow an optimization of sampling time. The decision was taken in view of the fact that those values were used only for Coils managing, but that was logic leaking more than read/write 128 consecutive coils.\\ | ||
+ | The MODBUS device allows you to control (using 2 new commands) communication serial' | ||
+ | If an application was written for the MODBUS01 device you must add the OPENCOM command (executed only once) as shown in the following example. | ||
+ | |||
+ | ==== Example: ==== | ||
<code QCL> | <code QCL> | ||
- | ; impostazione dei parametri di comunicazione | + | ; setting communication parameters |
modbus.mode = 0 | modbus.mode = 0 | ||
modbus.brate = 38400 | modbus.brate = 38400 | ||
Line 612: | Line 605: | ||
WAIT modbus.st_sended | WAIT modbus.st_sended | ||
IF (modbus.err) | IF (modbus.err) | ||
- | CALL ErroreModbus | + | CALL ErrorModbus |
ENDIF | ENDIF | ||
</ | </ | ||