Despite the care taken in the preparation of this document, NUM cannot guarantee the accuracy of the information it contains and cannot be held
responsible for any errors therein, nor for any damage which might result from the use or application of the document.
The physical, technical and functional characteristics of the hardware and software products and the services described in this document are subject
to modification and cannot under any circumstances be regarded as contractual.
The programming examples described in this manual are intended for guidance only. They must be specially adapted before they can be used in
programs with an industrial application, according to the automated system used and the safety levels required.
All rights reserved. No part of this manual may be copied or reproduced in any form or by any means whatsoever, including photographic or magnetic
processes. The transcription on an electronic machine of all or part of the contents is forbidden.
This software is the property of NUM. Each memorized copy of this software sold confers upon the purchaser a non-exclusive licence strictly limited
to the use of the said copy. No copy or other form of duplication of this product is authorized.
2en-938872/2
Table of Contents
Table of Contents
1 Structured Programming1 - 1
1.1General1 - 3
1.2Structured Programming Commands1 - 6
1.3Example of Structured Programming1 - 13
2 Reading the Programme Status Access Symbols2 - 1
2.1General2 - 3
2.2Symbols for Accessing the Data of the
Current Block2 - 3
2.3Symbols Accessing the Data of the
Previous Block2 - 11
3 Storing Data in Variables L900 to L9513 - 1
3.1General3 - 3
3.2Storing F, S, T, H and N in Variables L900
to L9253 - 3
3.3Storing EA to EZ in Variables L926 to L9513 - 4
3.4Symbolic Addressing of Variables L900
to L9513 - 4
4 Creating and Managing Symbolic Variable Tables4 - 1
4.1Creating Symbolic Variable Tables4 - 3
4.2Symbolic Variable Management Commands4 - 8
5 Creating Subroutines Called by G Functions5 - 1
5.1Calling Subroutines by G Functions5 - 3
5.2Inhibiting Display of Subroutines Being
Executed5 - 5
9.3Procedure After Enabling the N/M AUTO
Function9 - 8
9.4Stopping and Restarting in N/M AUTO Mode 9 - 11
9.5Checks Included in N/M AUTO9 - 12
Appendix A Table of Structured Programming CommandsA - 1
Appendix B Table of Symbolic Variable Management CommandsB - 1
Appendix C Table of Programme Status Access SymbolsC - 1
C.1Addressing G and M FunctionsC - 3
C.2Addressing a List of BitsC - 3
C.3Addressing a ValueC - 3
C.4Addressing a List of ValuesC - 4
Appendix D Table of Symbols Stored in Variables L900 to L951D - 1
D.1Symbols Stored in Variables L900 to L925D - 3
D.2Symbols Stored in Variables L926 to L951D - 3
4en-938872/2
Record of Revisions
DOCUMENT REVISIONS
DateRevisionReason for revisions
02-930Document creation (conforming to software at index D)
01-951Conforming to software at index G
Additions to the manual
- RTCP function
- N/M AUTO function
Table of Contents
Inclusion of changes
Software at index E:
- Addressing of the calling function by [.RG80] in a subroutine called by a G function
- Addressing by [.IRDI(i)] defining the origin of angular offsets
Software at index F:
- Coordinate conversions
06-972Conforming to software at index K
Additions to the manual:
- Smooth polynomial interpolation
- For addressing by [.IBX(i)], [.IRX(i)] and [.IBI(i)], [.IRI(i)], added indexes 10, 11, 4
and 5 related to G21 and G22.
Inclusion of changes
Software at indexes H and J:
- Update of N/M AUTO function
en-938872/25
6en-938872/2
NUM 1020/1040/1060 Documentation Structure
NUM
T
PROGRAMMING
MANUAL
Volume 1
Volume 2
938820
NUM
AUTOMATIC
CONTROL
FUNCTION
PROGRAMMING
MANUAL LADDER
LANGUAGE
938846
NUM
SYNCHRONISATION
OF TWO SPINDLES
938854
User Documents
These documents are designed for use of the CNC.
Forword
Foreword
NUM
M/W
OPERATOR
MANUAL
938821
OPERATOR
Integrator Documents
NUM
1060
INSTALLATION
AND
COMMISSIONING
MANUAL
938816
INSTALLATION
COMMISSIONING
NUM
T
MANUAL
938822
NUM
M
PROGRAMMING
MANUAL
Volume 1
Volume 2
938819
These documents are designed for setting up the CNC on a machine.
NUM
1020/1040
AND
MANUAL
938938
NUM
PARAMETER
MANUAL
938818
NUM
G
CYLINDRICAL
GRINDING
PROGRAMMING
MANUAL
938930
NUM
DYNAMIC
OPERATORS
938871
NUM
PROCAM
DESCRIPTION
LANGUAGE
938904
NUM
G
CYLINDRICAL
GRINDING
COMMISSIONING
MANUAL
938929
NUM
H/HG
GEAR
CUTTING AND
GRINDING
MANUAL
938932
NUM
GS
SURFACE
GRINDING
MANUAL
938945
en-938872/27
Special Programming Documents
NUM
PROFIL
FUNCTION
OPERATING
MANUAL
938937
These documents concern special numerical control programming applications.
NUM
SUPPLEMENTARY
PROGRAMMING
MANUAL
938872
NUM
GS
PROCAM GRIND
INTERACTIVE
PROGRAMMING
938953
NUM
M
PROCAM MILL
INTERACTIVE
PROGRAMMING
MANUAL
938873
NUM
G
PROCAM GRIND
INTERACTIVE
PROGRAMMING
938931
NUM
T
PROCAM TURN
INTERACTIVE
PROGRAMMING
MANUAL
938874
NUM
DUPLICATED
AND
SYNCHRONISED
AXES
938875
8en-938872/2
Supplementary Programming Manual
Manual Contents
Presentation of the commands used for structured programming of branches and
loops.
CHAPTER 1
STRUCTURED
PROGRAMMING
Forword
CHAPTER 2
READING THE
PROGRAMME
STATUS ACCESS
SYMBOLS
CHAPTER 3
STORING
DATA IN
VARIABLES
L900 TO L951
Presentation of the symbols giving visibility into the programmed functions and
programme context during call of a cycle by a G function.
How to store values related to the arguments or functions programmed in variables
L900 to L951 when calling a cycle by a G function.
en-938872/29
CHAPTER 4
CREATING AND
MANAGING
SYMBOLIC
VARIABLE TABLES
CHAPTER 5
CREATING
SUBROUTINES
CALLED BY
G FUNCTIONS
How to create and manage symbolic variable tables for storing functions and cutting
paths.
How to create subroutines called by G functions.
How to specify tool paths by polynomials.
CHAPTER 6
POLYNOMIAL
INTERPOLATION
CHAPTER 7
COORDINATE
CONVERSIONS
10en-938872/2
Coordinate conversions using a square matrix.
CHAPTER 8
RTCP
FUNCTION
Forword
Possibility of controlling the movements of a machine to position the tool with respect
to the part and pivot it around its centre.
Possibility of controlling the N/M AUTO axes while the other machine axes follow a
programmed path.
CHAPTER 9
N/M AUTO
FUNCTION
APPENDIX A
TABLE OF
STRUCTURED
PROGRAMMING
COMMANDS
APPENDIX B
Presents the structured programming commands in table form.
Presents the symbolic variable management commands in table form.
TABLE OF
SYMBOLIC
VARIABLE
MANAGEMENT
COMMANDS
en-938872/211
APPENDIX C
TABLE OF
PROGRAMME
STATUS ACCESS
SYMBOLS
APPENDIX D
TABLE OF
SYMBOLS
STORED IN
VARIABLES
L900 TO L951
Presents the programme status access symbols in table form:
-G function addressing,
-M function addressing,
-addressing a list of bits,
-addressing a value,
-addressing a list of values.
Presents lists of symbols stores in variables L900 to L951 in table form.
-Symbols stored in variables L900 to L925.
-Symbols stored in variables L926 to L951.
12en-938872/2
Using the Supplementary Programming Manual
Syntax Conventions
The command lines (blocks) used in programming include commands, symbols,
variables, functions and/or arguments.
A particular syntax is used for each of the elements described herein. The applicable
syntax rules describe how to write the programme blocks.
Certain syntaxes are given on one or more lines. Writing is simplified by use of the
following conventions:
-the functionality(ies) to which the syntax relates is (are) highlighted by the use of
bold face characters,
-«..» or lower case letters after one or more capital letters, addresses or signs
replace a numerical value (e.g. N..),
-the ellipsis «...» replaces a character or address string similar to that preceding it
in the block (e.g. [Symb1]/[Symb2]...),
-«xx» after one or more address letters replaces alphanumeric characters (e.g.
[.IBxx(i)]),
-«xxx» after an address letter replaces numerical values (e.g. Gxxx).
Forword
Examples
Syntax for creating a symbolic variable table
P.BUILD [TAB(7,NB)] H.. N.. +n N..+n
Syntax of a «repeat until» loop and its graphic representation
REPEAT
(instructions)
UNTIL (condition)
Repeat
Instructions
Until
condition
en-938872/213
Index
Questionnaire
Agencies
The index at the end of the volume gives access to information by keywords.
To help us improve the quality of our documentation, we request you to return the
questionnaire at the end of the volume.
The list of NUM agencies is given at the end of the volume.
14en-938872/2
Structured Programming
1 Structured Programming
1.1General1 - 3
1.1.1Commands Used in Structured Sequences1 - 3
1.1.2General Syntax Rules1 - 3
1.1.3Nesting and Branches1 - 5
1.2 Structured Programming Commands1 - 6
1.2.1Condition Graph1 - 6
1.2.2Instruction Execution Conditions1 - 7
1.2.3REPEAT UNTIL Loops1 - 8
1.2.4WHILE Loops1 - 9
1.2.5Loops with Control Variable1 - 10
1.2.6Exiting the Loop1 - 12
1.3Example of Structured Programming1 - 13
1
en-938872/21 - 1
1 - 2en-938872/2
1.1General
Structured Programming
The system provides the possibility of programming structured branches and loops,
making the programmes easier to read and simplifying the programming of complex
part programmes.
The programming tools described in this chapter are used to create subroutines
called by G functions (see Chapter 5).
A structured sequence always begins and ends with keywords.
It begins with one of the following keywords:
IF
REPEAT
WHILE
FOR
1
It ends with:
ENDI for IF
UNTIL for REPEAT
ENDW for WHILE
ENDF for FOR
The word ELSE can be interposed between the words IF and ENDI.
1.1.1Commands Used in Structured Sequences
-Conditional execution of instructions: IF, THEN, ELSE, ENDI
-Repeat until loops: REPEAT, UNTIL
-While loops: WHILE, DO, ENDW
-Loops with control variables: FOR, TO, DOWNTO, BY, DO, ENDF
-Exit from a loop: EXIT
1.1.2General Syntax Rules
The words IF, REPEAT, WHILE, FOR, ENDI, UNTIL, ENDW and ENDF must be the
first words in a block (no sequence number).
The words IF, REPEAT, THEN, ELSE, UNTIL, WHILE, DO and DOWNTO must
always be followed by a space, e.g.:
WHILEL0 <3 is not recognised by the system. The required syntax is WHILE L0 <3.
The words DO and THEN must immediately follow the condition. Alternately, if these
two words are not located on the same line as the words IF, WHILE and FOR, they
must be the first words on the next line.
en-938872/21 - 3
Blocks with sequence numbers (N..) are allowed in loops.
Blocks beginning with the words ENDI, ENDW, ENDF, EXIT or UNTIL must not
include ISO programming functions.
One of words DO, THEN or ELSE can be followed by ISO programming functions in
a same block.
Example:
WHILE L1 < 3 DO G91 X12
or
WHILE L1 < 3
DO G91 X12
The following sequence is refused:
WHILE L0 < 3 G91 X10
DO
Not allowed in a
conditional instruction
1 - 4en-938872/2
1.1.3Nesting and Branches
Structured Programming
Nesting
Fifteen structured nesting levels are possible independently of subroutine calls by
function G77 ...
Example:
First nesting level Second nesting level Third nesting level
IF
IF
REPEAT
UNTIL
ENDI
ENDI
Branches
Programming of a conditional or unconditional branch by G79 ... is allowed in a
structured sequence, but must branch to the lowest nesting level of the current
programme or subroutine.
Example:
1
%1%2
IFG79 N100
WHILEREPEAT
G79 N100
good
IF
G77 H2G79 N100
G79 N50
G79 N30
bad
bad
G79 N50
ENDI
N30N50
ENDWUNTIL
N50N100
ENDI
N100
M02
good
good
bad
en-938872/21 - 5
1.2Structured Programming Commands
1.2.1Condition Graph
A condition must follow one of words IF, WHILE or UNTIL and must be located in the
same block. If the block contains limits and a possible increment, they must follow
the word FOR.
Condition Graph
<
>
Parameters
Variables
Variables:All the variables used in parametric programming:
L variables, E parameters and symbolic variables.
Expression: Sequence of parameters and immediate values connected by symbols
+, -, *, /, !, & (see Chapter 6 of the Programming Manual). The operations
are calculated in sequence from left to right.
=
(Expression)
and
or
1 - 6en-938872/2
1.2.2Instruction Execution Conditions
Structured Programming
Syntax
IF(condition) THEN
(instructions 1)
ELSE
(instructions 2)
ENDI
If the condition is true, «instructions 1» are executed. Else, «instructions 2» are
executed.
The word ELSE is optional.
Graph
IF
Condition
THEN
instructions 1
ELSE
instructions 2
1
Example
IF E70000> 100 AND E70000 <200 THEN
G77 H100
ELSE
G77 H500
ENDI
The word THEN may be programmed at the beginning of the next block and followed
by the functions to be executed.
Example:
IF L4 < 8
THEN L6 = L2+1 XL6
ENDI
en-938872/21 - 7
1.2.3REPEAT UNTIL Loops
Syntax
The instructions are executed repetitively until the condition becomes true.
Even if the condition is true at the beginning, the instructions are executed once.
Graph
Example
Wait for a correct answer
REPEAT
(instructions)
UNTIL (condition)
Repeat
Untilinstructions
REPEAT
$ EXIT FROM THE PROGRAMME (Y/N) ?
[ANSWER]= $
UNTIL [ANSWER] = 14 OR [ANSWER] = 25
The answer «Y» returns the value 25
and the answer «N» returns the value
14 (ranks of the letters Y and N in the
alphabet)
1 - 8en-938872/2
1.2.4WHILE Loops
Structured Programming
Syntax
WHILE (condition) DO
(instructions)
ENDW
The instructions are executed while the condition remains true. Unlike REPEAT
UNTIL loops, the instructions are not executed if the condition is false at the
beginning.
Graph
While
condition
The word DO may be programmed at the beginning of the next block and followed
by the functions to be executed.
Example:
instructions
1
WHILE (condition)
DO XL6
ENDW
en-938872/21 - 9
1.2.5Loops with Control Variable
Syntax
FOR (variable) = (expression 1) TO/DOWNTO (expression 2) BY (value) DO
(instructions)
ENDF
The instructions are executed for «variable = expression 1». Then «variable» is
incremented (TO) or decremented (DOWNTO) by «value» before the «instructions»
are executed again, and the process is continued until «variable» is equal to
«expression 2».
The word «BY» is optional.
Graph
Variable = expression 1
to expression 2
by ± value
For
instructions
1 - 10en-938872/2
The variable can be:
-an L programme variable,
-a symbolic variable,
-a parameter E80000, E81000 or E82000 (be careful about stopping computations
for L100 to L199, Exxxxx and the symbolic variables).
The expressions are positive or negative integers. The system rounds them off (down
to 0.5 and up above 0.5).
Structured Programming
With TO, the loop continues to be executed as long the current value of the variable
is less than or equal to the final value (incrementing of the variable).
With DOWNTO, the loop continues to be executed as long the current value is higher
than or equal to the final value (decrementing of the variable).
The value of BY is incremented or decremented from the variable each cycle (the
default value of Y is equal to 1).
BY must always have a positive value. If the value of BY is negative, functions TO
and DOWNTO are reversed.
Example
Resetting the tool data
FOR L1=1 TO 20
DO
L2=56000+L1
EL2=0
ENDF
1
en-938872/21 - 11
1.2.6Exiting the Loop
Syntax
The EXIT instruction is used to exit from an iteration loop (FOR, WHILE or REPEAT)
and go to the next higher nesting level, ignoring any subsequent IF functions.
The word EXIT is used only in IF loops.
Example
Current
loop
EXIT
REPEAT
(instructions)
IF (condition) THEN
(instructions)
ELSE
EXIT
ENDI
UNTIL (condition)
(continued)
WHILE (condition) DO
REPEAT
IF (condition) THEN
(instructions)
IF (condition) THEN
Current
loop
EXIT
ENDI
(instructions)
ENDI
UNTIL (condition)
(instructions)
ENDW
1 - 12en-938872/2
1.3Example of Structured Programming
L10
L11
L1
Y
L0
Pattern
start point
X
Hole drilling pattern
L2 = number of holes in X
L3 = number of holes in Y
Structured Programming
1
en-938872/21 - 13
%20
$ X START:
L0=$
$ Y START:
L1=$
$ X STEP:
L10=$
$ Y STEP:
L11=$
L4=0
WHILE L4 <> 25 DO
Test for answer yes: Y
REPEAT $ NUMBER OF POINTS IN X:
L2=$
UNTIL L2>0
Test for number of columns greater
than 0
REPEAT $ NUMBER OF POINTS IN Y:
L3=$
UNTIL L3>0
Test for number of rows greater than 0
REPEAT $ PATTERN OF POINTS IN X:
$=L2
$+ /Y:
$=L3
$+ OK (Y/N) :
L4=$
UNTIL L4=14 OR L4=25
Wait for answer: N (no) or Y (yes)
ENDW
$
N.. G00 G52 XO Z0
N.. T1 D1 M06
N..
FOR L5=1 TO L3 DO