Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:appnote:an007 [2017/04/28 18:02] – [Verificare se il dato introdotto è nei limiti] qem103en:appnote:an007 [2019/08/29 17:01] (current) – external edit 127.0.0.1
Line 321: Line 321:
 IF ( dvHMI:st_uplim OR dvHMI:st_lowlim ) IF ( dvHMI:st_uplim OR dvHMI:st_lowlim )
  CALL ERROR ;print error message  CALL ERROR ;print error message
- JUMP Dentry ;return introduction datai+ JUMP Dentry ;return datai introduction
 ENDIF ENDIF
 </code> </code>
  
-=== Controllare il tasto di uscita dal data entry === +=== Check the output key from data entry ===
-Controllando il parametro //deExitKey// e gli stati //st_modified// ed //st_exitcmd//, è possibile capire in quale modo si è usciti dal data entry. La seguente tabella riassume le possibili condizioni:\\ +
-^//deExitKey//^//st_exitcmd//^Descrizione| +
-|0|0|Uscita con conferma tramite pressione del tasto ENTER o tramite comando //EXITDEC//+
-|0|1|Uscita senza conferma tramite domando //EXITDE//+
-|!=0|X|Uscita senza conferma tramite pressione del tasto identificato dal valore del parametro //deExitKey//|+
  
-=== Verificare se il dato è stato modificato === +Checking the//deExitKey// parameter and the //st_modified// and //st_exitcmd// states, you can understand in what way you are signed out from data entry. The following table summarizes the possible conditions:\\ 
-Per verificare se il dato introdotto è stato modificato basta semplicemente controllare lo stato //st_modified//Esso assume valore se il valore introdotto è diverso dal valore che aveva il parametro devalue prima del comando //DATAENTRY//.\\ +^//deExitKey//^//st_exitcmd//^Description| 
-Il programma completo sarà quindi:+|0|0|Exit with confirmation by pressing the ENTER key or by //EXITDEC// command| 
 +|0|1|Exit without confirmation by //EXITDE// command| 
 +|!=0|X|Exit without confirmation by pressing the button identified by the value of the //deExitKey// parameter| 
 + 
 +=== Check if the data has been modified ==
 + 
 +To check if the introduced data has changed, simply check the //st_modified// statusIt takes the value If the input value is different from the previous value of the devalue parameter befor of the //DATAENTRY// command.\\ 
 +The full program will then:
  
 <code QCL> <code QCL>
Line 357: Line 359:
  
  IF dvHMI:deExitKey  IF dvHMI:deExitKey
- ;--Uscita da data entry con tasti d'uscita+ ;--Output from data entry with output keys
  dvHMI:dis6 = CHAR_E  dvHMI:dis6 = CHAR_E
  dvHMI:dis5 = CHAR_H   dvHMI:dis5 = CHAR_H
Line 365: Line 367:
  dvHMI:dis1 = CHAR_  dvHMI:dis1 = CHAR_
  IF dvHMI:deExitKey EQ KEY_F  IF dvHMI:deExitKey EQ KEY_F
- dvHMI:dis0 = CHAR_F ;Pressione tasto F+ dvHMI:dis0 = CHAR_F ;key press
  ELSE  ELSE
  IF dvHMI:deExitKey EQ KEY_CLEAR  IF dvHMI:deExitKey EQ KEY_CLEAR
- dvHMI:dis0 = CHAR_C ;Pressione tasto CLEAR+ dvHMI:dis0 = CHAR_C ;CLEAR key press
  ENDIF  ENDIF
  ENDIF  ENDIF
  ELSE  ELSE
- ;--Uscita da data entry con conferma + ;--Output from data entry with confirm 
- ;--Controllo limiti+ ;--Limits control
  IF ( dvHMI:st_uplim OR dvHMI:st_lowlim )  IF ( dvHMI:st_uplim OR dvHMI:st_lowlim )
- CALL ERROR ;stampa mesaggio d'errore + CALL ERROR ;print error message 
- JUMP LABEL0 ;ritorna all'introduzione dati+ JUMP LABEL0 ;return to data entry
  ENDIF  ENDIF
- ;--Verifica se i dati sono stati modificati+ ;--Checks if the data has changed
  IF dvHMI:st_modified  IF dvHMI:st_modified
- dvHMI:dis6 = CHAR_ ;stampa messaggio "MODIFY"+ dvHMI:dis6 = CHAR_ ;print "MODIFY" message
  dvHMI:dis5 = CHAR_M   dvHMI:dis5 = CHAR_M
  dvHMI:dis4 = CHAR_O  dvHMI:dis4 = CHAR_O
Line 390: Line 392:
  WAIT tm01  WAIT tm01
  ENDIF  ENDIF
- cntPieces = dvHMI:devalue ;memorizza valore introdotto+ cntPieces = dvHMI:devalue ;stores entered value
  ENDIF  ENDIF
  
Line 399: Line 401:
  
 SUB ERROR SUB ERROR
- dvHMI:dis6 = CHAR_           ;stampa messaggio "ERROR"+ dvHMI:dis6 = CHAR_           ;print "ERROR" message
  dvHMI:dis5 = CHAR_E   dvHMI:dis5 = CHAR_E
  dvHMI:dis4 = CHAR_R  dvHMI:dis4 = CHAR_R
Line 413: Line 415:
 </code> </code>
  
-==== Creare una visualizzazione mista non ricorsiva ====+==== Create a mixed non-recursive visualization ====
  
-Si voglia creare una visualizzazione di un messaggio composto dalla stringa "Error" e da un numero identificativo dell'errore che appaia quando si verifica un errorementre normalmente venga visualizzatoin maniera ricorsiva, il valore di un conteggioPer realizzare questosfruttiamo il funzionamento di sola visualizzazione di un valore numerico presente nella funzionalità del comando //DATAENTRY// ed abilitata impostando a il bit //DE_ENABLE// del parametro //deflags//Per semplicitàrealizzeremo una condizione fittizia di errore tramite la fine di un timer caricato a 5 sec. Come vedremosarà importante ricordarsi di disabilitare la visualizzazione ricorsiva prima di visualizzare il messaggio di errorealtrimenti il risultato non sarà quello che ci si aspetta.\\ +You want to create a view of a message consisting of the "Error" string and an identification number of the error that appears when occurs an errorwhile normally appearsrecursively the counter valueTo achieve thiswe exploit the functioning can only be displayed by a numerical value present in //DATAENTRY// command functionality and enabled by setting to the //DE_ENABLE// bits of the //deflags// parameterFor simplicitywe'll create fictitious error condition by the end of a timer uploaded to 5 sec. As will seeIt will be important to remember to disable recursive view before showing the error messageotherwise the result will not be what you expect.\\ 
-Il codice risulta essere+The code is
  
 <code QCL> <code QCL>
Line 424: Line 426:
  dvHMI:dis6 = CHAR_C  dvHMI:dis6 = CHAR_C
   
- ;configura e abilita screenA+ ;Configure and enable screenA
  dvHMI:ncharA = 6  dvHMI:ncharA = 6
  dvHMI:offsA = 0  dvHMI:offsA = 0
Line 430: Line 432:
  dvHMI:scflags = dvHMI:scflags ORB SCRA_ENABLE  dvHMI:scflags = dvHMI:scflags ORB SCRA_ENABLE
  
- tm01 = 5000 ;utilizzo del timer per causare un errore+ tm01 = 5000 ;how to use the timer to cause an error
  
 LOOP: LOOP:
Line 438: Line 440:
  ;Errore?  ;Errore?
  IF tm01  IF tm01
- ;disabilita screenA+ ;disable screenA
  dvHMI:scflags = dvHMI:scflags ANDB ( NOT SCRA_ENABLE )  dvHMI:scflags = dvHMI:scflags ANDB ( NOT SCRA_ENABLE )
  CALL ERROR  CALL ERROR
Line 449: Line 451:
          
 SUB ERROR SUB ERROR
- ;stampa "ERROR"+ ;print "ERROR"
  dvHMI:dis6 = CHAR_E  dvHMI:dis6 = CHAR_E
  dvHMI:dis5 = CHAR_R  dvHMI:dis5 = CHAR_R
Line 457: Line 459:
  
   
- ;stampa errore con identificativo+ ;printing error with the ID
  dvHMI:deoffs = 0  dvHMI:deoffs = 0
  dvHMI:denchar = 2  dvHMI:denchar = 2
Line 465: Line 467:
  DATAENTRY dvHMI  DATAENTRY dvHMI
  
- ;attesa secondi+ ;wait seconds
  tm01 = 2000  tm01 = 2000
  WAIT tm01  WAIT tm01
Line 474: Line 476:
 </code> </code>
  
-==== Diagnostica Ingressi ====+==== Diagnostic Inputs ====
  
-Si voglia creare una visualizzazione che rappresenti lo stato di ingressi digitaliLo stesso esempio potrà essere poi utilizzato per la rappresentazione di uscite digitaliAssegneremo 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 digital inputsThe same example can be used for the representation of digital outputsWe will assign to each inputone of the segments of each of the three rightmost digit and we will activate when the corresponding input will be active.\\ 
-La figura mostra l'assegnamento scelto per gli ingressi ed i segmenti dei digit del display:+The figure shows the assignment chose for the inputs and segments of the digits of the display:
  
 {{:software:devices:hmi:an007:an_hmi2_01.png?nolink400|}} {{:software:devices:hmi:an007:an_hmi2_01.png?nolink400|}}
  
-Innanzitutto dichiareremonella unit di configurazione, 9 variabili di dimensione FLAG il cui valore simulerà lo stato dei ingressi digitali.+First we will declarein the configuration unit, 9 variables of FLAG dimensions whose value will simulate the condition of digital inputs.
  
 <code QCL> <code QCL>
Line 496: Line 498:
 </code> </code>
  
-Dichiareremo poi anche un array global da elementi che servirà per contenere i codici dei caratteri da stampare per ogni combinazione degli ingressi.+We will declare a global array to items that will serve to hold character codes to print for each combination of inputs.
  
 <code QCL> <code QCL>
 ARRGBL ARRGBL
- diagnTab B 8 ;tabella caratteri per diagnostica+ diagnTab B 8 ;character table for Diagnostics
 </code> </code>
  
-Infatti per ogni gruppo di tre ingressi associati ad uno dei tre digit sul display avremo possibili combinazioniLa tabella riassumead esempioper la combinazione degli ingressi I7,I8 ed I9, i possibili lo stati del digit associato:+In fact, for each group of three inputs associated with one of the three digits on the display we will have possible combinationsFor examplethe table summarizes the possible States of the digit associated withthe combination of inputs I7,I8 ed I9:
  
 ^I7^I8^I9^Display^ ^I7^I8^I9^Display^
Line 515: 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 531: Line 533:
 </code> </code>
  
-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 544: Line 546:
   diagnTab[8] = CHAR_LOWUPCE   diagnTab[8] = CHAR_LOWUPCE
  
- ;stampa messaggio "INP."  + ;print "INP." message
  hmi:dis6 = CHAR_I  hmi:dis6 = CHAR_I
  hmi:dis5 = CHAR_N   hmi:dis5 = CHAR_N
  • Last modified: 2019/08/29 17:18