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:40] – [6.3.4. Stati] 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 563: | Line 563: | ||
|wcmd|F|0|R|-|**Warning Command**\\ This bit indicates that it did not execute a command because they lack the necessary conditions.| | |wcmd|F|0|R|-|**Warning Command**\\ This bit indicates that it did not execute a command because they lack the necessary conditions.| | ||
- | === - Comandi | + | === - Commands |
- | 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 | + | |
+ | The available commands to manage the device are listed below in descending order of priority.\\ | ||
+ | The device executes all commands received within the same sampling time starting from the one with the highest priority.\\ | ||
+ | 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. | ||
+ | ^ Name ^ D ^ R ^ A ^ Conditions | ||
+ | | RECEIVED | ||
+ | | VALIDATE | ||
+ | | CLRWDATA | ||
+ | | CLRWCMD | ||
+ | | OPENCOM | ||
+ | | CLOSECOM | ||
- | ===== - Migrazione dal device MODBUS01 al device MODBUS ===== | ||
- | Il primo aspetto da tenere presente per la migrazione è il fatto che il device MODBUS01 è esterno mentre il MODBUS è | ||
- | interno. Questo implica che la dichiarazione del device deve essere eseguita nella sezione “INTDEVICE” dell’unità di | ||
- | configurazione del progetto. Inoltre, questo comporta la scelta, durante la definizione del device MODBUS, del tempo di | ||
- | campionamento. Il valore del tempo di campionamento che mantiene inalterate le prestazioni della comunicazione tra i | ||
- | due device è pari a 5 ms. Bisogna inoltre, in fase di definizione, | ||
- | Il device MODBUS ha aumentato il numero di variabili di scambio (da 16 word a 32 word) ma questo non influenza il funzionamento | ||
- | per le impostazioni che utilizzano al massimo 16 word come sono quelle pensate per il device MODBUS01.\\ | ||
- | 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 MODBUS consente di controllare (mediante 2 nuovi comandi) l' | ||
- | del device. Questa nuova funzionalitá è interessante nell' | ||
- | devices che possono utilizzare la stessa seriale.\\ | ||
- | Se un applicativo era stato scritto per il device MODBUS01 bisogna aggiungere il comando OPENCOM (eseguito anche | ||
- | 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 614: | Line 605: | ||
WAIT modbus.st_sended | WAIT modbus.st_sended | ||
IF (modbus.err) | IF (modbus.err) | ||
- | CALL ErroreModbus | + | CALL ErrorModbus |
ENDIF | ENDIF | ||
</ | </ | ||