Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:appnote:an007 [2017/04/27 18:07] – [Creare una visualizzazione ricorsiva] qem103 | en:appnote:an007 [2019/08/29 17:01] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 185: | Line 185: | ||
The update operation of screenA must be continuously performed by our program with the refresh rate more appropriate for reasons of functionality that the programmer has planned for that variable. | The update operation of screenA must be continuously performed by our program with the refresh rate more appropriate for reasons of functionality that the programmer has planned for that variable. | ||
- | ==== Creare una visualizzazione di testo ==== | + | ==== Create a text view ==== |
- | Si voglia scrivere un programma | + | You want to write a Qcl program that writes on display " |
<code QCL> | <code QCL> | ||
- | ;Stampa | + | ;Print " |
dvHMI:dis6 = CHAR_ | dvHMI:dis6 = CHAR_ | ||
dvHMI:dis5 = CHAR_ | dvHMI:dis5 = CHAR_ | ||
Line 200: | Line 200: | ||
</ | </ | ||
- | <WRAP center round info 60%>Nota:\\ Per poter funzionare correttamente, non devono essere attive visualizzazioni ricorsive che sovrascriverebbero tutti o parte dei digit interessati dal nostro | + | ^:info:^Note:\\ In order to work properly, must not be active recursive views that overwrite all or part of interested |
- | ==== Creare più visualizzazioni ricorsive miste a visualizzazioni di testo ==== | + | ==== Create multiple recursive views mixed with text displays |
- | Si voglia creare una visualizzazione composta da due testi fissi e due valori ricorsivi. A titolo di esempio si pensi di visualizzare un tempo espresso | + | You want to create a view consists of two fixed texts and two recursive values. As an example, you shown a time in seconds and a program number. The desired show might be: "t51 Pr2" |
- | Innanzitutto stampiamo i testi: | + | First we print the texts: |
<code QCL> | <code QCL> | ||
Line 214: | Line 214: | ||
</ | </ | ||
- | Impostiamo poi i dati per la visualizzazione numerica del tempo tramite la screenA. | + | Then we set the data for the numerical display of the time through the screenA. |
<code QCL> | <code QCL> | ||
Line 223: | Line 223: | ||
</ | </ | ||
- | Impostiamo poi i dati per la visualizzazione numerica del programma tramite la screenB. | + | We then the data for the numerical display of the program using the screenB. |
<code QCL> | <code QCL> | ||
Line 232: | Line 232: | ||
</ | </ | ||
- | Abilitiamo le due visualizzazioni: | + | We enable the two views: |
<code QCL> | <code QCL> | ||
Line 238: | Line 238: | ||
</ | </ | ||
- | Poi ricorsivamente aggiorneremo i dati della visualizzazione: | + | Then recursively we will update the view data: |
<code QCL> | <code QCL> | ||
Line 245: | Line 245: | ||
</ | </ | ||
- | ==== Creare una introduzione dati semplice | + | ==== Create a simple data input ==== |
- | Si voglia scrivere un programma | + | You want to write a Qcl program that allows the user to input a value to a variable |
<code QCL> | <code QCL> | ||
Line 256: | Line 256: | ||
</ | </ | ||
- | La posizione del punto decimale sarà ovviamente posta a 0 ed eseguiremo la copia del valore del conta pezzi attuale nel parametro | + | The position of the decimal point will be placed to 0 and we will copy the value of the current pieces in the // |
<code QCL> | <code QCL> | ||
Line 263: | Line 263: | ||
</ | </ | ||
- | Infine abiliteremo l' | + | Finally we will enable the data input using the appropriate |
<code QCL> | <code QCL> | ||
Line 270: | Line 270: | ||
</ | </ | ||
- | A questo punto comincerà a lampeggiare sul display il digit più significativo del valore di // | + | At this point the most significant |
<code QCL> | <code QCL> | ||
Line 279: | Line 279: | ||
</ | </ | ||
- | A questo punto la variabile | + | At this point the// |
- | ==== Creare una introduzione dati complessa | + | ==== Create a complex data introduction |
- | Si voglia scrivere un programma | + | You want to write a Qcl program that allows the user to input a value to a variable, as in the previous example, but with the following additional features: |
- | * controllare che il dato sia compreso tra 1 e 1000 ed in caso contrario visualizzare | + | * check that the figure is between |
- | * se viene premuto il tasto F si esca dall' | + | * if the F key is pressed you step out of the data input without storing the data introduced and may be printed for a second the "Exit F" |
- | * se viene premuto il tasto CLEAR si esca dall' | + | * If the CLEAR key is pressed you step out of the data input without storing the data introduced and may be printed for a second the "Exit C" |
- | * stampare per un secondo il messaggio | + | * print for a second the " |
- | === Controllo limiti dato === | + | === Control data limits |
- | Per abilitare il controllo dei limiti del dato introdotto è necessario abilitare tale funzionalità ponendo a 1 l' | + | |
+ | To enable bounds checking of the introduced data you must enable this feature putting to 1 the relevant bits of the // | ||
<code QCL> | <code QCL> | ||
Line 298: | Line 299: | ||
</ | </ | ||
- | e sostituire l' | + | and replace the setting instruction of the deflags |
<code QCL> | <code QCL> | ||
Line 304: | Line 305: | ||
</ | </ | ||
- | === Configurare uno o più tasti di uscita dal data entry === | + | === Configure one or more keys to exit from data entry === |
- | Per abilitare l' | + | |
+ | To enable the output from data entry with a key You must set the // | ||
<code QCL> | <code QCL> | ||
Line 311: | Line 313: | ||
</ | </ | ||
- | === Verificare se il dato introdotto è nei limiti | + | === Check if the introduced data is within limits |
- | All' | + | |
+ | When you exit from the data entry (then with the // | ||
<code QCL> | <code QCL> | ||
- | ;Controllo limiti dati | + | ;Data limits control |
IF ( dvHMI: | IF ( dvHMI: | ||
- | CALL ERROR ;stampa messaggio d' | + | CALL ERROR ;print error message |
- | JUMP Dentry ;ritorno introduzione | + | JUMP Dentry ;return |
ENDIF | ENDIF | ||
</ | </ | ||
- | === Controllare il tasto di uscita dal data entry === | + | === Check the output key from data entry === |
- | Controllando il parametro | + | |
- | ^// | + | Checking the// |
- | |0|0|Uscita con conferma tramite pressione del tasto ENTER o tramite comando | + | ^// |
- | |0|1|Uscita senza conferma tramite domando | + | |0|0|Exit with confirmation by pressing the ENTER key or by // |
- | |!=0|X|Uscita senza conferma tramite pressione del tasto identificato dal valore del parametro | + | |0|1|Exit without confirmation by // |
+ | |!=0|X|Exit without confirmation by pressing the button identified by the value of the // | ||
+ | |||
+ | === Check if the data has been modified === | ||
- | === Verificare se il dato è stato modificato === | + | To check if the introduced data has changed, simply check the // |
- | Per verificare se il dato introdotto è stato modificato basta semplicemente controllare lo stato // | + | The full program will then: |
- | Il programma completo sarà quindi: | + | |
<code QCL> | <code QCL> | ||
Line 354: | Line 359: | ||
IF dvHMI: | IF dvHMI: | ||
- | ;--Uscita da data entry con tasti d' | + | ;--Output from data entry with output keys |
dvHMI: | dvHMI: | ||
dvHMI: | dvHMI: | ||
Line 362: | Line 367: | ||
dvHMI: | dvHMI: | ||
IF dvHMI: | IF dvHMI: | ||
- | dvHMI: | + | dvHMI: |
ELSE | ELSE | ||
IF dvHMI: | IF dvHMI: | ||
- | dvHMI: | + | dvHMI: |
ENDIF | ENDIF | ||
ENDIF | ENDIF | ||
ELSE | ELSE | ||
- | ;--Uscita da data entry con conferma | + | ;--Output from data entry with confirm |
- | ;--Controllo limiti | + | ;--Limits control |
IF ( dvHMI: | IF ( dvHMI: | ||
- | CALL ERROR ;stampa mesaggio d' | + | CALL ERROR ;print error message |
- | JUMP LABEL0 ;ritorna all' | + | JUMP LABEL0 ;return to data entry |
ENDIF | ENDIF | ||
- | ;--Verifica se i dati sono stati modificati | + | ;--Checks if the data has changed |
IF dvHMI: | IF dvHMI: | ||
- | dvHMI: | + | dvHMI: |
dvHMI: | dvHMI: | ||
dvHMI: | dvHMI: | ||
Line 387: | Line 392: | ||
WAIT tm01 | WAIT tm01 | ||
ENDIF | ENDIF | ||
- | cntPieces = dvHMI: | + | cntPieces = dvHMI: |
ENDIF | ENDIF | ||
Line 396: | Line 401: | ||
SUB ERROR | SUB ERROR | ||
- | dvHMI:dis6 = CHAR_ | + | dvHMI:dis6 = CHAR_ |
dvHMI:dis5 = CHAR_E | dvHMI:dis5 = CHAR_E | ||
dvHMI:dis4 = CHAR_R | dvHMI:dis4 = CHAR_R | ||
Line 410: | Line 415: | ||
</ | </ | ||
- | ==== Creare una visualizzazione mista non ricorsiva | + | ==== Create a mixed non-recursive visualization |
- | Si voglia creare una visualizzazione di un messaggio composto dalla stringa | + | You want to create a view of a message consisting of the " |
- | Il codice risulta essere: | + | The code is: |
<code QCL> | <code QCL> | ||
Line 421: | Line 426: | ||
dvHMI:dis6 = CHAR_C | dvHMI:dis6 = CHAR_C | ||
- | ;configura e abilita | + | ;Configure and enable |
dvHMI: | dvHMI: | ||
dvHMI: | dvHMI: | ||
Line 427: | Line 432: | ||
dvHMI: | dvHMI: | ||
- | tm01 = 5000 ;utilizzo del timer per causare un errore | + | tm01 = 5000 ;how to use the timer to cause an error |
LOOP: | LOOP: | ||
Line 435: | Line 440: | ||
;Errore? | ;Errore? | ||
IF tm01 | IF tm01 | ||
- | ;disabilita | + | ;disable |
dvHMI: | dvHMI: | ||
CALL ERROR | CALL ERROR | ||
Line 446: | Line 451: | ||
| | ||
SUB ERROR | SUB ERROR | ||
- | ;stampa | + | ;print " |
dvHMI:dis6 = CHAR_E | dvHMI:dis6 = CHAR_E | ||
dvHMI:dis5 = CHAR_R | dvHMI:dis5 = CHAR_R | ||
Line 454: | Line 459: | ||
- | ;stampa errore con identificativo | + | ;printing error with the ID |
dvHMI: | dvHMI: | ||
dvHMI: | dvHMI: | ||
Line 462: | Line 467: | ||
DATAENTRY dvHMI | DATAENTRY dvHMI | ||
- | ;attesa | + | ;wait 2 seconds |
tm01 = 2000 | tm01 = 2000 | ||
WAIT tm01 | WAIT tm01 | ||
Line 471: | Line 476: | ||
</ | </ | ||
- | ==== Diagnostica Ingressi | + | ==== Diagnostic Inputs |
- | Si voglia creare una visualizzazione che rappresenti lo stato di 9 ingressi digitali. Lo stesso esempio potrà essere poi utilizzato per la rappresentazione di uscite digitali. Assegneremo perciò, ad ogni ingresso, uno dei segmenti di ciascuno dei tre digit più a destra e lo attiveremo quando il corrispondente ingresso sarà attivo.\\ | + | You want to create a view that represents the State of 9 digital inputs. The same example can be used for the representation of digital outputs. We will assign to each input, one of the segments of each of the three rightmost |
- | La figura mostra l' | + | The figure shows the assignment chose for the inputs and segments of the digits of the display: |
{{: | {{: | ||
- | Innanzitutto dichiareremo, nella unit di configurazione, 9 variabili di dimensione | + | First we will declare, in the configuration |
<code QCL> | <code QCL> | ||
Line 493: | Line 498: | ||
</ | </ | ||
- | Dichiareremo poi anche un array global | + | We will declare a global |
<code QCL> | <code QCL> | ||
ARRGBL | ARRGBL | ||
- | diagnTab B 8 ; | + | diagnTab B 8 ; |
</ | </ | ||
- | Infatti per ogni gruppo di tre ingressi associati ad uno dei tre digit sul display | + | In fact, for each group of three inputs associated with one of the three digits on the display |
^I7^I8^I9^Display^ | ^I7^I8^I9^Display^ | ||
Line 512: | Line 517: | ||
|1|1|1|$| | |1|1|1|$| | ||
- | Servirà infine anche la definizione di alcune costanti da utilizzare come maschera per bit generici di un byte: | + | Will finally also defining some constants to be used as a mask for generic bits of a byte: |
<code QCL> | <code QCL> | ||
Line 528: | Line 533: | ||
</ | </ | ||
- | Il codice completo per ottenere la funzione di diagnostica è: | + | The complete code to obtain the diagnostic function is: |
<code QCL> | <code QCL> | ||
- | ;inizializza tabella | + | ;Initializes table |
diagnTab[1] = CHAR_ | diagnTab[1] = CHAR_ | ||
diagnTab[2] = CHAR_UP | diagnTab[2] = CHAR_UP | ||
Line 541: | Line 546: | ||
diagnTab[8] = CHAR_LOWUPCE | diagnTab[8] = CHAR_LOWUPCE | ||
- | ;stampa messaggio | + | ;print " |
hmi:dis6 = CHAR_I | hmi:dis6 = CHAR_I | ||
hmi:dis5 = CHAR_N | hmi:dis5 = CHAR_N |