Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
en:software:devices:modbus [2016/12/27 14:34] – [6.3.3. Variabili] qem103 | en:software:devices:modbus [2016/12/27 15:01] – [Esempio:] qem103 | ||
---|---|---|---|
Line 555: | Line 555: | ||
|serr|B|0|R/ | |serr|B|0|R/ | ||
- | === - Stati === | + | === - States |
- | ^Nome^D^R^A^Condizioni^ Descrizione^ | + | |
- | |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 === | + | ^Name^D^R^A^Conditions^Description^ |
- | I comandi a disposizione per gestire il device sono elencati sotto in ordine di priorità decrescente.\\ | + | |st_msgrx|F|0|R|-|**Message received**\\ State used only in slave mode. Indicates that a message from the master |
- | Il device esegue tutti i comandi ricevuti entro lo stesso tempo di campionamento iniziando da quello con la priorità maggiore.\\ | + | |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.| |
- | 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. | + | |wdata|F|0|R|-|**Warning Data**\\ |
- | ^ Nome | + | |wcmd|F|0|R|-|**Warning Command**\\ |
- | | RECEIVED | + | |
- | | VALIDATE | + | |
- | | CLRWDATA | + | |
- | | CLRWCMD | + | |
- | | OPENCOM | + | |
- | | CLOSECOM | + | |
+ | === - Commands === | ||
+ | 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. | ||
- | ===== - Migrazione dal device | + | ^ Name ^ D ^ R ^ A ^ Conditions |
+ | | RECEIVED | ||
+ | | VALIDATE | ||
+ | | CLRWDATA | ||
+ | | CLRWCMD | ||
+ | | OPENCOM | ||
+ | | CLOSECOM | ||
- | 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 613: | Line 605: | ||
WAIT modbus.st_sended | WAIT modbus.st_sended | ||
IF (modbus.err) | IF (modbus.err) | ||
- | CALL ErroreModbus | + | CALL ErrorModbus |
ENDIF | ENDIF | ||
</ | </ | ||