Z32 Syntax
Z32 PreProcessor brief documentation
This document list the specific Z32 syntax supported by the pre-processor.
Version 1.0
Index
1. Special markers
Syntax |
Description |
Example |
|---|---|---|
( comments ) |
Comments. Text enclosed between ( ) will be displayed to CE console. |
(this is a comment) |
:[0-9]+ |
Marks the beginning of a section. Preprocessor simply ignores it. |
:1 |
; |
The ";" marks the end of a block. Everything after it is ignored. |
N12 G0 Z120.5 ;some text |
! |
The "!" marks the start and the end of an Advanced Line. |
!X=0! |
2. Advanced Lines
3. Operators
Syntax |
Description |
Example |
|---|---|---|
< expr > |
Expression. Is used to assign a value that must be evaluated first. The nesting limit is 20. |
HA<X+Y> |
( expr ) |
Priority inside expression. The nesting limit is 10. |
HA<X+Y*(2+X)> |
Subtraction |
HA<X-Y> |
|
Addiction |
HA<X+Y> |
|
* |
Multiplication |
HA<X*Y> |
/ |
Division. If denominator is 0, an error is thrown. |
HA<X/Y> |
= |
Equal operator, if it's inside a IF condition, otherwise is Assignment operator |
!X=Y! ;assignment !IF X=Y ; GOP1! ;equal operator |
<> |
Is Not equal |
!IF X<>Y ; X=X+1! |
<= |
Less Equal Than |
!IF X<=Y ; X=X+1! |
< |
Less Than |
!IF X<Y ; X=X+1! |
>= |
Greater Equal Than |
!IF X>=Y ; X=X+1! |
> |
Greater Than |
!IF X>Y ; X=X+1! |
4. Arithmetic functions
Syntax |
Description |
Example |
|---|---|---|
SN(x) |
Sin |
HA<SN(X)> |
CS(x) |
Cosine |
HA<CS(X)> |
TAN(x) |
Tangent |
HA<TAN(X)> |
AT(x) |
ArcTangent |
HA<AT(X)> |
ABS(x) |
Absolute value |
HA<ABS(X)> |
INT(x) |
Truncation to integer |
HA<INT(X)> |
NEI(x) |
Round value |
HA<NEI(X)> |
CP |
Cartesian to Polar conversion. The input arguments are HX and HY parameters, the output arguments are stored into HR and HT parameters |
!HX=1;HY=1;CP! |
PC |
Polar to Cartesian conversion. The input arguments are HR and HT parameters, the output arguments are stored into HX and HY parameters |
!HR=1;HT=45;PC! |
PI |
Pi constant (3.14159...) |
HA<PI> |
5. Goto
Syntax |
Description |
Example |
|---|---|---|
!GONn! |
Jump to a sequence number n in the MCD. Note that a sequence number can be a floating number. |
!GON150! ... N150 ; continue from here |
!GONn-Nm! |
Jump to a sequence number n in the MCD. When sequence number m is reached, return to the next block |
!GON150-N200! N151 ; 3. ... N150 ; 1.continue until 2. ... ... N200 ; 2.return to 3. ... |
6. Conditional Branching
Syntax |
Description |
Example |
|---|---|---|
!IF condition ; op1 ; EB ! op2 ! |
If condition is true, perform operation op1 and than stop Advanced Line evaluation (EB), else perform operation op2. EB breaks advanced line evaluation, but if op1 is a Goto statement or a Calsub statement, EB is not mandatory. Note that if op1 is another IF statement, you can simulate nesting IF syntax. |
!IF HA>10; HA=1; EB! HA=0! !IF HA>10; GON20! !IF (HA+HB)*PAR[10]>=HC; GON20! !IF HA>10; IF HB<5; GON30! |
7. Variables
Syntax |
Description |
Example |
|---|---|---|
PAL[i] |
Vector of 513 parameters, from 0 to 512. These parameters contain only INTEGER numbers. The values from PAL[256] to PAL[512] are read only. The values from PAL[0] to PAL[255] may be written by the part-program. The index inside [] may be an expression result. When the index is out of bounds, an error is thrown. When a non integer number is assigned to a PAL[…] parameter, the number is rounded to the nearest integer value. |
PAL[10+PAL[6]]<1+2> PAL[<2*PAL[1]>]5 |
PAR[i] |
Same as PAL, but these parameters stores REAL numbers and there's no read-only policy on 256-512 range. |
PAR[300]10 |
[A-Z][A-Z]? |
Literal parameters. They are composed by a combination of one or two alphabetic characters. There are three type of literal parameters: 1. Axis parameters (X,Y,..) 2. System reserved parameters (F,S,..) 3. User parameters (HA,..) |
X<Y> ; axis used as parameter F<F+100> ;system parameter X<HA+1> ;user parameter |
8. Sub programs
Syntax |
Description |
Example |
|---|---|---|
!GOPn! |
Call CMOS program n. n can also be the result of an expression. |
!GOP1! !GOP<HA+1>! |
!GOSn! |
Call CMOS temp program n. n can also be the result of an expression. |
!GOS1! !GOS<HA+1>! |
!:L254-file_path! |
Call sub program from file_path |
!:L254-FOLDER\FILE! |
G26 |
End of subprogram. |
G26 |
9. $FECPP() functions
Syntax |
Description |
Example |
|---|---|---|
$FCEPP('SET_F ILEROOT','MYPATH',0) |
Set file root for subprogram calls (default is '//ICAMFS/'). |
A DD_VAR=$FCEPP('SET_F ILEROOT','C:\TEST') |
$ FCEPP('ADD_VAR_SYST _SPEC','MYVARNAME',0) |
Add variable specification to system specification variable list. 'MYVARNAME' is the system parameter name to add. Last input argument is its default value |
ADD_VAR=$ FCEPP('ADD_VAR_SYST_SPEC' ,'MYVARNAME',0) |
$FC EPP('INIT_VAR_SYST') |
Initialize all system variables at their default values |
INIT_VAR=$FC EPP('INIT_VAR_SYST') |
10. Dynamic axes alias
Syntax |
Description |
Example |
|---|---|---|
G25XYZ |
Each occurrence of AA will be replaced by X. Each occurrence of AB will be replaced by Y. Each occurrence of AC will be replaced by Z. |
G25XYZ AA1 ; equivalent to X1 AB2 ; equivalent to Y2 AC3 ; equivalent to Z3 |
G25YZX |
Each occurrence of AA will be replaced by Y. Each occurrence of AB will be replaced by Z. Each occurrence of AC will be replaced by X. |
G25YZX AA1 ; equivalent to Y1 AB2 ; equivalent to Z2 AC3 ; equivalent to X3 |
G25ZXY |
Each occurrence of AA will be replaced by Z. Each occurrence of AB will be replaced by X. Each occurrence of AC will be replaced by Y. |
G25ZXY AA1 ; equivalent to Z1 AB2 ; equivalent to X2 AC3 ; equivalent to Y3 |
11. Features not yet supported