Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:software:qview:qview_6:qview60 [2015/04/20 11:47] – [3.3. Identifiers] qem207 | en:software:qview:qview_6:qview60 [2022/08/31 09:02] (current) – qem214 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | PRELIMINARE/ | ||
- | |||
====== QVIEW 6.0 ======= | ====== QVIEW 6.0 ======= | ||
Line 337: | Line 335: | ||
< | < | ||
</ | </ | ||
- | dove: | + | where: |
|SYSTEM|Keyword indicating the definition of //SYSTEM// variables| | |SYSTEM|Keyword indicating the definition of //SYSTEM// variables| | ||
|< | |< | ||
Line 522: | Line 520: | ||
===== - DATAGROUP variables ===== | ===== - DATAGROUP variables ===== | ||
- | Datagroup variables are a special data structures. When declaring a datagroup, a part of memory | + | Datagroup variables are a special data structures, |
- | Each program (column) | + | |
- | * 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 |
+ | < | ||
+ | DATAPROGRAM | ||
+ | <number of recipes> | ||
+ | ;Static variables declaration | ||
+ | < | ||
+ | < | ||
+ | < | ||
</ | </ | ||
- | + | Static | |
- | Indexed | + | |
<code QCL> | <code QCL> | ||
- | ddwLuPe[5,3] | + | DATAGROUP |
+ | Name | ||
+ | DATAPROGRAM | ||
+ | 100 | ||
+ | ;Static variables declaration | ||
+ | Variable1 | ||
+ | Variable2 | ||
+ | Variable3 | ||
+ | </ | ||
+ | To refer to variable // | ||
+ | <code QCL> | ||
+ | Variable3[5] | ||
</ | </ | ||
- | The datagroup is best represented | + | We can imagine the memory structure of a variable DATAGROUP, in our example with static variables, |
- | ^_^Prog.1^Prog. 2^Prog. 3^Prog. 4^Prog. 5^_^ | + | ^ ^ |
- | ^_|dslVeMa[1]|dslVeMa[2]|dslVeMa[3]|dslVeMa[4]|dslVeMa[5]^Static^ | + | ^Recipe |
- | ^Step 1|ddwLuPe[1, | + | ^Recipe |
- | ^Step 2|ddwLuPe[1, | + | ^Recipe |
- | ^Step 3|ddwLuPe[1, | + | ^...| | | | |
- | ^Step 4|_|_|_|_|ddwLuPe[5, | + | ^Recipe 100| | | | |
- | ^Step 5|_|_|_|_|ddwLuPe[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 | ||
< | < | ||
- | [;Number of programs (or recipe) | ||
DATAPROGRAM | DATAPROGRAM | ||
- | <number of programs> | + | <number of recipes> |
- | ;Static variables declaration | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | [;Number of steps | + | |
STEP | STEP | ||
<number of steps> | <number of steps> | ||
Line 566: | Line 569: | ||
< | < | ||
< | < | ||
- | < | + | < |
</ | </ | ||
- | dove: | + | Indexed |
- | |DATAGROUP|Keyword for defining a DataGroup.| | + | |
- | |< | + | |
- | |DATAPROGRAM|Keyword for defining the static | + | |
- | |<number of programs> | + | |
- | |< | + | |
- | |< | + | |
- | |STEP|Keyword for defining indexed variables in the DataGroup.| | + | |
- | |<number of steps> | + | |
- | |< | + | |
- | |< | + | |
- | + | ||
- | The DATAGROUP definition | + | |
- | * 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 form, or with the aid of constants and must be different to zero. The maximum number | + | |
- | + | ||
- | The number | + | |
- | + | ||
- | The DATAPROGRAM subsection is mandatory, while the STEP subsection is optional. | + | |
- | + | ||
- | A STEP section cannot | + | |
- | All static | + | |
- | + | ||
- | To calculate | + | |
- | + | ||
- | (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 | ||
- | | + | |
DATAPROGRAM | DATAPROGRAM | ||
- | | + | |
- | ;--------------Static variables declaration------------------ | + | ;Static variables declaration |
- | | + | |
- | | + | |
+ | Variable3 | ||
STEP | STEP | ||
- | | + | |
- | ;--------------Indexed variables declaration------------- | + | ;Indexed variables declaration |
- | | + | |
- | | + | |
</ | </ | ||
- | + | To refer to variable // | |
- | + | ||
- | Syntax for static variables: | + | |
<code QCL> | <code QCL> | ||
- | < Nome variabile Static > < [ num_prog | + | Variable4[5, 9] |
</ | </ | ||
- | Syntax for indexed variables: | + | We can imagine the memory structure of a variable DATAGROUP, in our example with static and indexed variables, |
- | <code QCL> | + | |
- | < Nome variabile Index > < [ num_prog, num_step ] > | + | |
- | </ | + | |
- | // | + | ^ ^ Variable1 |
+ | ^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: | ||
</ | </ | ||
==== - 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 | + | Instructions for activating or deactivating |
(<output name>= 1), however dedicated instructions are faster. | (<output name>= 1), however dedicated instructions are faster. | ||
Line 1226: | Line 1211: | ||
==== - RESOUT ==== | ==== - RESOUT ==== | ||
- | Disactivate | + | Deactivate |
<code QCL> | <code QCL> | ||
RESOUT <output name> | RESOUT <output name> | ||
Line 1383: | Line 1368: | ||
</ | </ | ||
+ | ==== - Shift logical left ==== | ||
+ | Logic shifts the contents of var value to the left by //n// bits. \\ {{: | ||
+ | <code QCL> | ||
+ | SHLL(< | ||
+ | </ | ||
+ | Example: | ||
+ | <code QCL> | ||
+ | glValue = SHLL(glValue, | ||
+ | </ | ||
+ | |||
+ | ==== - Right logical left ==== | ||
+ | Logic shifts the contents of var value to the right by //n// bits. \\ {{: | ||
+ | <code QCL> | ||
+ | SHLR(< | ||
+ | </ | ||
+ | Example: | ||
+ | <code QCL> | ||
+ | glValue = SHLR(glValue, | ||
+ | </ | ||
+ | ==== - 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 " | ||
+ | <code QCL> | ||
+ | MULDIV(< | ||
+ | </ | ||
+ | Example: glValue = a * b / c | ||
+ | <code QCL> | ||
+ | glValue = MULDIV(a, b, c) | ||
+ | </ | ||
+ | |||
+ | ==== - 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 " | ||
+ | <code QCL> | ||
+ | RMULDIV(< | ||
+ | </ | ||
+ | Example: glValue = a * b % c | ||
+ | <code QCL> | ||
+ | glValue = RMULDIV(a, b, c) | ||
+ | </ | ||
+ | |||
+ | ==== - 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(< | ||
+ | TRUNC(< | ||
+ | FLOOR(< | ||
+ | CEIL(< | ||
+ | </ | ||
+ | Example: | ||
+ | <code QCL> | ||
+ | gsValue = ROUND(2.7) | ||
+ | gsValue = ROUND(-2.7) | ||
+ | gsValue = TRUNC(2.7) | ||
+ | gsValue = TRUNC(-2.7) | ||
+ | gsValue = FLOOR(2.7) | ||
+ | gsValue = FLOOR(-2.7) | ||
+ | gsValue = CEIL(2.7) | ||
+ | gsValue = CEIL(-2.7) | ||
+ | </ | ||
+ | |||
+ | ==== - 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(< | ||
+ | ISINF(< | ||
+ | ISNAN(< | ||
+ | ISNORMAL(< | ||
+ | </ | ||
+ | Example: | ||
+ | <code QCL> | ||
+ | gfValue = ISFINITE(gsValue) | ||
+ | gfValue = ISINF(gsValue) | ||
+ | gfValue = ISNAN(gsValue) | ||
+ | gfValue = ISNORMAL(gsValue) | ||
+ | </ | ||
===== - 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 |
- | ^AND|logic AND| | + | ^ AND | logic AND |
- | ^ANDB|bitwise logic And | | + | ^ ANDB |
- | ^APPLICATION|Implicit root of each symbol used| | + | ^ APPLICATION |
- | ^ARRGBL|configuration file section| | + | ^ ARRGBL |
- | ^ARRSYS|configuration file section| | + | ^ ARRSYS |
- | ^ASIN|arc sine| | + | ^ ASIN |
- | ^ATAN|arc tangent| | + | ^ ATAN |
- | ^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 |
- | ^CASE|SWITCH-CASE instruction| | + | ^ CASE |
- | ^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 |
- | ^ELSE|Else in IF instruction| | + | ^ DATAPROGRAM |
- | ^END|task end| | + | ^ DEVGROUP |
- | ^ENDDEVGROUP|end of device grouping| | + | ^ ELSE |
- | ^ENDIF|end of IF instruction| | + | ^ END | task end | |
- | ^ENDSUB|end of subroutine| | + | ^ ENDDEVGROUP |
- | ^ENDSWITCH|end of SWITCH| | + | ^ ENDIF | end of IF instruction |
- | ^ENDWHILE|end of while| | + | ^ ENDSUB |
- | ^EQ|uguale| | + | ^ ENDSWITCH |
- | ^EXP|exponential| | + | ^ ENDWHILE |
- | ^EXTDEVICE|configuration file section| | + | ^ EQ |
- | ^F|flag| | + | ^ EXP | exponential |
- | ^FOR|FOR instruction| | + | ^ EXTDEVICE |
- | ^FPROG|FPROG instruction| | + | ^ F | flag | |
- | ^FSTEP|FSTEP | + | ^ FLOOR |
- | ^GE|greater or equal to| | + | ^ FOR |
- | ^GLOBAL|configuration file section| | + | ^ GE |
- | ^GT|greater| | + | ^ GLOBAL |
- | ^IF|IF instruction| | + | ^ GT |
- | ^INPUT|configuration file section| | + | ^ IF |
- | ^INTDEVICE|configuration file section| | + | ^ INPUT | configuration file section |
- | ^JUMP|JUMP instruction| | + | ^ INTDEVICE |
- | ^LE|less or equal to| | + | ^ ISFINITE |
- | ^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 |
- | ^NEQ|operatore| | + | ^ JUMP |
- | ^NEXT|NEXT instruction| | + | ^ L | long |
- | ^NOP|NOP instruction| | + | ^ LE |
- | ^NOT|not| | + | ^ LN |
- | ^NOTB|bitwise negation (one's complement)| | + | ^ LT |
- | ^OR|logic OR| | + | ^ MULDIV |
- | ^ORB|bitwise OR| | + | ^ NEG | negative sign (inversion of sign or two's complement) |
- | ^OUTPUT|configuration file section| | + | ^ NEQ | operatore |
- | ^POW| power of | | + | ^ NEXT |
- | ^REFERENCE|symbol reference property| | + | ^ NOP | NOP instruction |
- | ^REFERENCE|start of reference list| | + | ^ NOT | not |
- | ^RESOUT|reset outputs| | + | ^ NOTB |
- | ^S|single precision| | + | ^ OR |
- | ^SETOUT|set output| | + | ^ ORB | bitwise OR | |
- | ^SIN|sine| | + | ^ OUTPUT |
- | ^SQRT|square root| | + | ^ POW | power of | |
- | ^STEP|configuration file section| | + | ^ REFERENCE |
- | ^SUB|subroutine| | + | ^ REFERENCES |
- | ^SWITCH|SWITCH-CASE instruction| | + | ^ RESOUT |
- | ^SYSTEM|configuration file section| | + | ^ RESTART |
- | ^RESTART|restart instruction| | + | ^ RESUME |
- | ^RESUME|resume instruction| | + | ^ RETURN |
- | ^SUSPEND|suspend instruction| | + | ^ RMULDIV |
- | ^TAN|tangent| | + | ^ ROUND | Nearest integer rounding |
- | ^TIMER|configuration file section| | + | ^ S | single precision |
- | ^W|word| | + | ^ SETOUT |
- | ^WAIT|wait instruction| | + | ^ SHLL | shift logical left | |
- | ^WHILE|while instruction| | + | ^ SHLR | shift logical right | |
- | ^XORB|bitwise exclusive OR | | + | ^ SIN | sine | |
+ | ^ SQRT | ||
+ | ^ STEP | ||
+ | ^ SUB | subroutine | ||
+ | ^ SUSPEND | ||
+ | ^ SWITCH | ||
+ | ^ SYSTEM | ||
+ | ^ TAN | tangent | ||
+ | ^ TIMER | configuration file section | ||
+ | ^ TRUNC | Nearest integer rounding not greater in magnitude | ||
+ | ^ W | word | | ||
+ | ^ WAIT | ||
+ | ^ WHILE | while instruction | ||
+ | ^ XORB | ||
+ | |||
In addition these are the precompiler directives | In addition these are the precompiler directives | ||
Line 3299: | Line 3381: | ||
< | < | ||
- | |||
====== - Appendix E: Hotkeys ====== | ====== - Appendix E: Hotkeys ====== | ||