en:software:qview:qview_6:qview60

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:software:qview:qview_6:qview60 [2015/04/20 11:48] – [3.5. The SYSTEM variables] qem207en:software:qview:qview_6:qview60 [2022/08/31 09:02] (current) qem214
Line 1: Line 1:
-PRELIMINARE/ 
- 
 ====== QVIEW 6.0 ======= ====== QVIEW 6.0 =======
  
Line 522: Line 520:
  
 ===== - DATAGROUP variables ===== ===== - DATAGROUP variables =====
-Datagroup variables are a special data structures. When declaring a datagroupa part of memory is organised in a table of rows and columnsThe columns are called  //programs// or //recipes//, while the rows are //steps//.\\ +Datagroup variables are a special data structures, that are stored in retentive memory. They are declared in the configuration unit and are suitable to represent a recipe database. \\ Datagroup variables contains two kinds of variable:
-Each program (column) contains two kinds of variable+
-  * Static. +
-  * indexed. +
- +
-Static variables can take on different values according to their program (column) reference. In the declaration each of these variables is identified by an individual name so, to be able to refer to different values that it can take on, indexing has to be used. For example, to refer to the //dslVeMa// variable of program (column) 5, use the code:+
  
 +==== - Static Variables ====
 <code QCL> <code QCL>
-  dslVeMa[5]+DATAGROUP 
 +  <DataGroup Name> 
 +  DATAPROGRAM 
 +    <number of recipes> 
 +;Static variables declaration 
 +    <variable name> <F/B/W/L/S> 
 +    <variable name> <F/B/W/L/S> 
 +    <variable name> <F/B/W/L/S>
 </code> </code>
- +Static variables reside in DATAGROUP subsector named DATAPROGRAM. The first value of this sector is a number or an integer constant, and represents the number of recipes in archive. Static variables are to be considered as containers of a certain value for each recipeand are accessed as an arraywhere the index is the number of desired recipe. Example:
-Indexed variables can have different values according to their program (column) and step (row) reference. In the declaration, each of these variables is identified by the same name so, to be able to refer to its different valuesindexing must be used. For exampleto refer to the “ddwLuPe” variable of program (column) 5 and step (row) 3, use the code:+
  
 <code QCL> <code QCL>
-  ddwLuPe[5,3]+DATAGROUP 
 +  Name 
 +  DATAPROGRAM 
 +    100 
 +;Static variables declaration 
 +    Variable1     L 
 +    Variable2     S 
 +    Variable3     F 
 +</code> 
 +To refer to variable //Variable3// in recipe 5, the used code is: 
 +<code QCL> 
 +Variable3[5]
 </code> </code>
  
-The datagroup is best represented as the chart below+We can imagine the memory structure of a variable DATAGROUP, in our example with static variables, as the following table
-^_^Prog.1^Prog. 2^Prog. 3^Prog. 4^Prog. 5^_+^ ^  Variable1   Variable2   Variable3  
-^_|dslVeMa[1]|dslVeMa[2]|dslVeMa[3]|dslVeMa[4]|dslVeMa[5]^Static^ +^Recipe 1| | | | 
-^Step 1|ddwLuPe[1,1]|_|_|_|_^indexed^ +^Recipe 2| | | | 
-^Step 2|ddwLuPe[1,2]|_|_|_|_^:::^ +^Recipe 3| | | | 
-^Step 3|ddwLuPe[1,3]|_|_|_|ddwLuPe[5,3]^:::^ +^...| | | | 
-^Step 4|_|_|_|_|ddwLuPe[5,4]^:::^ +^Recipe 100| | | |
-^Step 5|_|_|_|_|ddwLuPe[5,5]^:::+
-In the two, static and indexed, datagroup sections several variables can be declared.+
  
-The syntax for defining DATAGROUP variables:+==== - Indexed Variables ==== 
 <code QCL> <code QCL>
 DATAGROUP DATAGROUP
   <DataGroup Name>   <DataGroup Name>
-[;Number of programs (or recipe) 
   DATAPROGRAM   DATAPROGRAM
-    <number of programs> +    <number of recipes>
-;Static variables declaration +
-    <variable name> <F/B/W/L/S> +
-    <variable name> <F/B/W/L/S> +
-    <variable name> <F/B/W/L/S>+
-[;Number of steps+
   STEP   STEP
     <number of steps>     <number of steps>
Line 566: Line 569:
     <variable name> <F/B/W/L/S>     <variable name> <F/B/W/L/S>
     <variable name> <F/B/W/L/S>     <variable name> <F/B/W/L/S>
-    <variable name> <F/B/W/L/S>]+    <variable name> <F/B/W/L/S>
 </code> </code>
-dove: +Indexed variables reside in DATAGROUP subsector named STEP. Their function is to introduce for each recipe, the concept of step. The first value of this sector is number or an integer constantand represents the number of steps for each recipe in archiveIndexed variables are to be considered as containers of list of values for each recipe, and are accessed as 2-dimensional array, where the first value is the number of the recipe, the second the number of desired step. Example:
-|DATAGROUP|Keyword for defining a DataGroup.| +
-|<DataGroup Name>|Name associated to the DataGroup.| +
-|DATAPROGRAM|Keyword for defining the static variables in the DataGroup.| +
-|<number of programs>|Number of programs (DataProgram) composing the DataGroup.| +
-|<variable name>|Name of the static variable in the DataGroup.| +
-|<F/B/W/L/S>|Static variable type| +
-|STEP|Keyword for defining indexed variables in the DataGroup.+
-|<number of steps>|Number of steps comprising the DataGroup.| +
-|<variable name>|Name of the indexed variable in the DataGroup.| +
-|<F/B/W/L/S>|Indexed variable type| +
- +
-The DATAGROUP definition is made up of 3 parts: +
-  * the datagroup name definition; +
-  * the number of programs and static variables (starting with DATAPROGRAM); +
-  * the number of program steps and indexed variables (starting with keyword STEP). +
- +
-The datagroup name follows all the general rules for variable name syntax. +
- +
-The number of programs is written in number formor with the aid of constants and must be different to zero. The maximum number of programs is 65534. +
- +
-The number of steps is written in number formor with the aid of constants and must be different to zero. The maximum number of steps is 65534. +
- +
-The DATAPROGRAM subsection is mandatory, while the STEP subsection is optional. +
- +
-A STEP section cannot be declared without declaring at least one indexed variable. A STEP section can be declared without declaring DATAPROGRAM section. A DATAPROGRAM cannot be declared without declaring at least one static variable. A DATAPROGRAM section can be declared without declaring a STEP section.\\ +
-All static and indexed variables in a DATAGROUP are retentive (i.e. they keep their value after shut-off). +
- +
-To calculate the total memory space of the DATAGROUP consider that each variable in the datagroup takes up 4 bytes (regardless of the variable types). So the memory space in byte is equal to: +
- +
-(N.Programs x N.Static variables x 4 ) + ( N.Programs x N.Steps x N.Indexed variables x 4).\\ +
-Example:+
 <code QCL> <code QCL>
 DATAGROUP DATAGROUP
-  dMyDataGrp            ;Datagroup name+  Name
   DATAPROGRAM   DATAPROGRAM
-    DIM_PROG            ;Number of programs +    100 
-    ;--------------Static variables declaration------------------ +;Static variables declaration 
-    dsfStat1 F          ; +    Variable1     L 
-    dswStat2 W          ;+    Variable2     S 
 +    Variable3     F
   STEP   STEP
-    DIM_STEP            ;Number of step for each program +    10 
-    ;--------------Indexed variables declaration------------- +;Indexed variables declaration 
-    ddbDin1 B           ; +    Variable4     W 
-    ddlDin2 L           ;+    Variable5     B
 </code> </code>
- +To refer to variable //Variable4// in recipe 5 to step 9, the used code is:
- +
-Syntax for static variables:+
 <code QCL> <code QCL>
-< Nome variabile Static > < num_prog >+Variable4[5, 9]
 </code> </code>
  
-Syntax for indexed variables+We can imagine the memory structure of a variable DATAGROUP, in our example with static and indexed variables, as the following table:
-<code QCL> +
-< Nome variabile Index > < [ num_prognum_step ] > +
-</code>+
  
-//num_prog// and //num_step// can be a number (not SINGLE), a constant, variable or complex expressionIn the case of number or constant, the compilation controls that the index is not over the maximum size declared in the configuration unit (by number of programs and number of steps respectively); the other indexes - //num_prog and num_step// - start from one.+^ ^  Variable1  ^  Variable2  ^  Variable3  ^  Variable4  ^^^^^  Variable5  ^^^^^ 
 +^Recipe 1| | | | | | | | | | | | | | 
 +^:::|:::|:::|:::| | | | | | | | | | | 
 +^Recipe 2| | | | | | | | | | | | | | 
 +^:::|:::|:::|:::| | | | | | | | | | | 
 +^Recipe 3| | | | | | | | | | | | | | 
 +^:::|:::|:::|:::| | | | | | | | | | | 
 +^...| | | | | | | | | | | | | | 
 +^:::|:::|:::|:::| | | | | | | | | | | 
 +^Recipe 100| | | | | | | | | | | | | | 
 +^:::|:::|:::|:::| | | | | | | | | | |
  
 +Other informations:
 +  * In a DATAGROUP all variables, both static and indexed, are retentive (maintain the value at power off).
 +  * The Datagroup variables may be more than one, in this case it is necessary to insert more DATAGROUP keywords.
 +  * The subsection DATAPROGRAM is mandatory, while the STEP is optional.
 +  * The maximum number of recipes can be set is 65534.
 +  * The maximum number of steps can be set is 65534.
 +  * Compared to a common array, static variables can also support a Flag size data (F).
  
 ===== - BUS Section ===== ===== - BUS Section =====
Line 1183: Line 1168:
 </code> </code>
 ==== - SUBROUTINE ==== ==== - SUBROUTINE ====
-When a part of the code is repeated several times in the same unit, it is useful to define a subroutine. The subroutine code is executed every time a subroutine call instruction is found  (CALL). The subroutine is identified by a name after the SUB keyword and must end with the  ENDSUB keyword. See also the CALL instruction.+When a part of the code is repeated several times in the same unit, it is useful to define a subroutine. The subroutine code is executed every time a subroutine call instruction is found  (CALL). The subroutine is identified by a name after the SUB keyword and must end with the ENDSUB keyword. See also the CALL instruction.\\ To stop a subroutine before the end use the keyword RETURN.
  
 ==== - CALL ==== ==== - CALL ====
Line 1215: Line 1200:
  
 ===== - Instructions for digital outputs ===== ===== - Instructions for digital outputs =====
-Instructions for activating or disactivating a digital output. The activation and disactivation can also be executed by the assignment operator +Instructions for activating or deactivating a digital output. The activation and deactivation can also be executed by the assignment operator 
  
 (<output name>= 1), however dedicated instructions are faster. (<output name>= 1), however dedicated instructions are faster.
Line 1226: Line 1211:
  
 ==== - RESOUT ==== ==== - RESOUT ====
-Disactivate a digital output. The syntax:+Deactivate a digital output. The syntax:
 <code QCL> <code QCL>
 RESOUT <output name> RESOUT <output name>
Line 1383: Line 1368:
 </code> </code>
  
 +==== - Shift logical left ====
 +Logic shifts the contents of var value to the left by //n// bits. \\ {{:software:qview:qview_6:qview60:shll.png?nolink|}}\\ The syntax:\\
 +<code QCL>
 +  SHLL(<variable>,<bits>)
 +</code>
 +Example:
 +<code QCL>
 +  glValue = SHLL(glValue, 1)
 +</code>
 +
 +==== - Right logical left ====
 +Logic shifts the contents of var value to the right by //n// bits. \\ {{:software:qview:qview_6:qview60:shlr.png?nolink|}}\\ The syntax:\\
 +<code QCL>
 +  SHLR(<variable>,<bits>)
 +</code>
 +Example:
 +<code QCL>
 +  glValue = SHLR(glValue, 1)
 +</code>
 +==== - Multiplication and division ====
 +Perform a 32 bit integer values multiplication with 64 bit result and a successive division by 32 bit integer value. Result is a 32 bit value.\\ **N.B.** If a division by zero occur, CPU state will set to "Division by zero error".\\ The syntax:\\
 +<code QCL>
 +  MULDIV(<factor1>,<factor2>,<divisor>)
 +</code>
 +Example: glValue = a * b / c
 +<code QCL>
 +  glValue = MULDIV(a, b, c)
 +</code>
 +
 +==== - Remainder of multiplication and division ====
 +Perform a 32 bit integer values multiplication with 64 bit result and a successive division by 32 bit integer value. Result is the division remainder.\\ **N.B.** If a division by zero occur, CPU state will set to "Division by zero error".\\ The syntax:\\
 +<code QCL>
 +  RMULDIV(<factor1>,<factor2>,<divisor>)
 +</code>
 +Example: glValue = a * b % c
 +<code QCL>
 +  glValue = RMULDIV(a, b, c)
 +</code>
 +
 +==== - Nearest integer rounding ====
 +|ROUND|Rounds to nearest integer, rounding away from zero in halfway cases.|
 +|TRUNC|Rounds to nearest integer not greater in magnitude than the given value.|
 +|FLOOR|Computes largest integer not greater than the given value.|
 +|CEIL|Computes smallest integer not less than the given value.|
 +The syntax:\\
 +<code QCL>
 +  ROUND(<variable>)
 +  TRUNC(<variable>)
 +  FLOOR(<variable>)
 +  CEIL(<variable>)
 +</code>
 +Example:
 +<code QCL>
 +  gsValue = ROUND(2.7)     ;risults 3.0
 +  gsValue = ROUND(-2.7)    ;risults -3.0
 +  gsValue = TRUNC(2.7)     ;risults 2.0
 +  gsValue = TRUNC(-2.7)    ;risults -2.0
 +  gsValue = FLOOR(2.7)     ;risults 2.0
 +  gsValue = FLOOR(-2.7)    ;risults -3.0
 +  gsValue = CEIL(2.7)      ;risults 3.0
 +  gsValue = CEIL(-2.7)     ;risults -2.0
 +</code>
 +
 +==== - Classification operators ====
 +|ISFINITE|Checks if the given number has finite value.|
 +|ISINF|Checks if the given number is infinite.|
 +|ISNAN|Checks if the given number is NaN.|
 +|ISNORMAL|Checks if the given number is normal.|
 +Syntax:\\
 +<code QCL>
 +  ISFINITE(<variable>)
 +  ISINF(<variable>)
 +  ISNAN(<variable>)
 +  ISNORMAL(<variable>)
 +</code>
 +Example:
 +<code QCL>
 +  gfValue = ISFINITE(gsValue)     ;returns 1 if the number is finite otherwise 0
 +  gfValue = ISINF(gsValue)        ;returns 1 if the number is infinite otherwise 0
 +  gfValue = ISNAN(gsValue)        ;returns 1 if the number is NaN (Not a Number) otherwise 0
 +  gfValue = ISNORMAL(gsValue)     ;returns 1 if the number is normal (not zero, not infinite, not NaN) otherwise 0
 +</code>
 ===== - Trigonometry Functions ===== ===== - Trigonometry Functions =====
  
Line 3213: Line 3280:
  
 A summary of the QCL keywords. A summary of the QCL keywords.
-^ABS|absolute value| +^ ABS          | absolute value                                          
-^ACOS|arc cosine| +^ ACOS         | arc cosine                                              
-^AND|logic AND| +^ AND          | logic AND                                               
-^ANDB|bitwise logic And | +^ ANDB         | bitwise logic And                                       
-^APPLICATION|Implicit root of each symbol used| +^ APPLICATION  | Implicit root of each symbol used                       
-^ARRGBL|configuration file section| +^ ARRGBL       | configuration file section                              
-^ARRSYS|configuration file section| +^ ARRSYS       | configuration file section                              
-^ASIN|arc sine| +^ ASIN         | arc sine                                                
-^ATAN|arc tangent| +^ ATAN         | arc tangent                                             
-^B|byte| +^ B            | byte                                                    
-^BEGIN|task unit code section| +^ BEGIN        | task unit code section                                  
-^BREAK|break| +^ BREAK        | break                                                   
-^BUS|configuration file section| +^ BUS          | configuration file section                              
-^CALL| call to subroutine| +^ CALL         | call to subroutine                                      
-^CASE|SWITCH-CASE instruction| +^ CASE         | SWITCH-CASE instruction                                 | 
-^CONST|configuration file section| +^ CEIL         | Nearest integer rounding not less than the given value  
-^COS|cosine| +^ CONST        | configuration file section                              
-^COT|cotangent| +^ COS          | cosine                                                  
-^DATAGROUP|configuration file section| +^ COT          | cotangent                                               | 
-^DATAPROGRAM|configuration file section| +^ D            | double precision                                        
-^DEVGROUP|start of device grouping| +^ DATAGROUP    | configuration file section                              
-^ELSE|Else in IF instruction| +^ DATAPROGRAM  | configuration file section                              
-^END|task end| +^ DEVGROUP     | start of device grouping                                
-^ENDDEVGROUP|end of device grouping| +^ ELSE         | Else in IF instruction                                  
-^ENDIF|end of IF instruction| +^ END          | task end                                                
-^ENDSUB|end of subroutine| +^ ENDDEVGROUP  | end of device grouping                                  
-^ENDSWITCH|end of SWITCH| +^ ENDIF        | end of IF instruction                                   
-^ENDWHILE|end of while| +^ ENDSUB       | end of subroutine                                       
-^EQ|uguale| +^ ENDSWITCH    | end of SWITCH                                           
-^EXP|exponential| +^ ENDWHILE     | end of while                                            
-^EXTDEVICE|configuration file section| +^ EQ           | uguale                                                  
-^F|flag| +^ EXP          | exponential                                             
-^FOR|FOR instruction+^ EXTDEVICE    | configuration file section                              
-^FPROG|FPROG instruction| +^ F            | flag                                                    
-^FSTEP|FSTEP instruction| +FLOOR        Nearest integer rounding not greater than the value     
-^GE|greater or equal to| +FOR          FOR instruction                                         
-^GLOBAL|configuration file section| +^ GE           | greater or equal to                                     
-^GT|greater| +^ GLOBAL       | configuration file section                              
-^IF|IF instruction| +^ GT           | greater                                                 
-^INPUT|configuration file section| +^ IF           | IF instruction                                          
-^INTDEVICE|configuration file section| +^ INPUT        | configuration file section                              
-^JUMP|JUMP instruction| +^ INTDEVICE    | configuration file section                              | 
-^LE|less or equal to| +^ ISFINITE     | checks if the given number has finite value             | 
-^LN|natural logarhythm| +^ ISINF        | checks if the given number is infinite                  | 
-^LT|less than| +^ ISNAN        | checks if the given number is NaN (Not a Number)        | 
-^NEG|negative sign (inversion of sign or two's complement)| +^ ISNORMAL     | checks if the given number is normal                    
-^NEQ|operatore| +^ JUMP         | JUMP instruction                                        | 
-^NEXT|NEXT instruction| +^ L            | long                                                    
-^NOP|NOP instruction| +^ LE           | less or equal to                                        
-^NOT|not| +^ LN           | natural logarhythm                                      
-^NOTB|bitwise negation (one's complement)| +^ LT           | less than                                               | 
-^OR|logic OR| +^ MULDIV       | multiplication e division                               
-^ORB|bitwise OR| +^ NEG          | negative sign (inversion of sign or two's complement)   
-^OUTPUT|configuration file section| +^ NEQ          | operatore                                               
-^POW| power of | +^ NEXT         | NEXT instruction                                        
-^REFERENCE|symbol reference property| +^ NOP          | NOP instruction                                         
-^REFERENCE|start of reference list| +^ NOT          | not                                                     
-^RESOUT|reset outputs| +^ NOTB         | bitwise negation (one's complement)                     
-^S|single precision| +^ OR           | logic OR                                                
-^SETOUT|set output| +^ ORB          | bitwise OR                                              
-^SIN|sine| +^ OUTPUT       | configuration file section                              
-^SQRT|square root| +^ POW          | power of                                                
-^STEP|configuration file section| +^ REFERENCE    | symbol reference property                               
-^SUB|subroutine| +REFERENCES   | start of reference list                                 
-^SWITCH|SWITCH-CASE instruction| +^ RESOUT       | reset outputs                                           | 
-^SYSTEM|configuration file section+^ RESTART      | restart instruction                                     | 
-^RESTART|restart instruction| +^ RESUME       | resume instruction                                      | 
-^RESUME|resume instruction| +^ RETURN       | return instruction (on subroutines)                     | 
-^SUSPEND|suspend instruction+^ RMULDIV      | remainder of multiplication e division                  | 
-^TAN|tangent| +^ ROUND        | Nearest integer rounding                                
-^TIMER|configuration file section| +^ S            | single precision                                        
-^W|word| +^ SETOUT       | set output                                              | 
-^WAIT|wait instruction| +^ SHLL         | shift logical left                                      | 
-^WHILE|while instruction| +^ SHLR         | shift logical right                                     
-^XORB|bitwise exclusive OR |+^ SIN          | sine                                                    
 +^ SQRT         | square root                                             
 +^ STEP         | configuration file section                              
 +^ SUB          | subroutine                                              | 
 +^ SUSPEND      | suspend instruction                                     
 +^ SWITCH       | SWITCH-CASE instruction                                 
 +^ SYSTEM       | configuration file section                              
 +^ TAN          | tangent                                                 
 +^ TIMER        | configuration file section                              | 
 +^ TRUNC        | Nearest integer rounding not greater in magnitude       
 +^ W            | word                                                    
 +^ WAIT         | wait instruction                                        
 +^ WHILE        | while instruction                                       
 +^ XORB         | bitwise exclusive OR                                    | 
 + 
  
 In addition these are the precompiler directives In addition these are the precompiler directives
Line 3299: Line 3381:
  
 <html><pagebreak /></html> <html><pagebreak /></html>
- 
 ====== - Appendix E: Hotkeys ====== ====== - Appendix E: Hotkeys ======
  
  • Last modified: 2019/08/29 17:18