Ladderen PDF
Ladderen PDF
Ladderen PDF
AUTOMATIC CONTROL
FUNCTION
PROGRAMMING MANUAL
LADDER LANGUAGE
0101938846/8
01-98 en-938846/8
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 contractually binding.
The programming examples described in this manual are intended for guidance only. They must be specially adapted to the automated system used
and the safety levels required before they can be used in programs with an industrial application.
2 en-938846/8
Table of Contents
Table of Contents
en-938846/8 3
6.8 Copy One or More Words 6 - 10
6.9 Copy One or More Long Words 6 - 11
6.10 Set Self-Test Period 6 - 11
6.11 Convert a Signed Integer to an ASCII
String 6 - 12
6.12 Convert an Unsigned Integer to an ASCII
String 6 - 12
6.13 Concatenate Bytes into Bits 6 - 13
6.14 Simulate Operator Panel Keyboard 6 - 15
6.15 Shortest Path Calculation 6 - 15
6.16 Search for the Value of a Byte 6 - 16
6.17 Search for the Value of a Word 6 - 16
6.18 Search for the Value of a Long Word 6 - 17
6.19 Return to Calling Module or Network 6 - 18
6.20 Jump to a Module Label without Return 6 - 19
6.21 Jump to a Module Label with Return 6 - 19
6.22 Flag 6 - 20
6.23 Set One or More Bytes 6 - 20
6.24 Set One or More Words 6 - 21
6.25 Set One or More Long Words 6 - 22
6.26 Call %SP Modules 6 - 22
6.27 Format a Character String 6 - 24
6.28 Integer Square Root 6 - 25
6.29 Analyse an ASCII String 6 - 25
6.30 Compare Two Character Strings 6 - 26
6.31 Copy a Character String 6 - 27
6.32 Calculate String Length 6 - 27
6.33 Swap the Even and Odd Bytes of a Word 6 - 28
6.34 Swap the Four Bytes of a Long Word 6 - 29
6.35 Change Tool Wear Offset 6 - 30
6.36 Read n Variables E42000 6 - 31
6.37 Write n Variables E42000 6 - 32
6.38 Initialise the Base Associated with the
%Y Variables 6 - 33
7 Task Management 7-1
7.1 Introduction 7-3
7.2 Start a Critical Section 7-3
7.3 End a Critical Section 7-3
7.4 Suspend a %TF task 7-3
7.5 Start a %TF Task 7-4
7.6 Stop a %TF Task 7-4
8 Transparent Mode 8-1
8.1 Introduction 8-3
8.2 Functions Assigned to transparent Mode 8-7
8.3 Panel Transparent Mode 8 - 18
4 en-938846/7
Table of Contents
en-938846/7 5
17 PLC Axes 17 - 1
17.1 General 17 - 1
17.2 Programming Principle 17 - 1
18 Programme Debugging 18 - 1
18.1 Programme Debugging with the PLCTOOL
Software Workshop 18 - 3
18.2 Debugging on the CNC 18 - 3
19 Errors and Diagnostic 19 - 1
19.1 List of Hardware Errors 19 - 1
19.2 List of Configuration Errors 19 - 1
19.3 List of Programming Errors 19 - 1
A Lists of Functions A-1
A.1 List by Themes A-3
A.2 Alphanumerical List A-6
Index I-1
6 en-938846/6
Record of Revisions
Record of Revisions
01 - 98 8 Title page, 2, 3, 7, 10
Ch. 2: 13
Ch. 3: 1-4, 17, 27, 34, 37-78 79-82
Ch. 5: 13
Ch. 8: 3, 6
Ch. 9: 3
Ch. 12: 5
Ch. 15: 8, 25
Ch. 17: 1
Index: 1-4
Agencies
Questionnaire
DOCUMENT REVISIONS
en-938846/8 7
Date Revision Reason for revisions
8 en-938846/7
Record of Revisions
en-938846/7 9
Date Revision Reason for revisions
01 - 98 8 Miscellaneous corrections
- %Wg03.B, Independent group mode
- PLC <—> CNC exchange area related to AN96 1050 function
10 en-938846/8
Preliminary
Preliminary
Integrator Documents
These documents are designed for setting up the CNC on a machine.
AUTOMATIC CONTROL
INSTALLATION INSTALLATION PARAMETERS FUNCTION
AND AND PROGRAMMING
COMMISSIONING COMMISSIONING MANUAL MANUAL
MANUAL MANUAL LADDER LANGUAGE
NUM NUM
938859 938924
en-938846/6 11
List of NUM 1020/1040/1060 Product Utilities
A series of utilities are available for the NUM products for integration and use of the system.
Depending on the function performed by each utility, its use is described in the integration manual or operator manual,
as appropriate.
The table below lists the utilities and gives the references of the document describing them:
REMARK Utility 22 is no longer used starting from CNC software index K and SET_TOOL software index E.
12 en-938846/7
Preliminary
CHAPTER 1
PRESENTATION OF
THE AUTOMATIC
CONTROL
FUNCTION
en-938846/6 13
Information on the literal elements of the ladder language.
- Literal elements.
- Operators.
CHAPTER 4
- Examples of computations.
LITERAL
ELEMENTS OF
LADDER
LANGUAGE
PROGRAMMING
IN LADDER
LANGUAGE
GENERAL
PURPOSE
FUNCTIONS
CHAPTER 7
TASK
MANAGEMENT
14 en-938846/6
Preliminary
CHAPTER 8
TRANSPARENT
MODE
CHAPTER 9
ANALOGUE
INPUTS/
OUTPUTS
Principle and functions related to read and immediate write of input/output cards.
CHAPTER 10
EXPLICIT
READ/WRITE OF
INPUT/OUTPUT
CARDS
CHAPTER 11
INTERRUPT
INPUTS
en-938846/6 15
Principle and functions related to programming the serial lines.
CHAPTER 12
SERIAL LINES
CHAPTER 13
TIMER
FUNCTION
CHAPTER 14
DATE-TIME
STAMP
FUNCTION
CHAPTER 15
EXCHANGES
BY
PROTOCOL
16 en-938846/6
Preliminary
CHAPTER 16
PROGRAMMING
IN C LANGUAGE
CHAPTER 17
PLC
AXES
CHAPTER 18
PROGRAMME
DEBUGGING
CHAPTER 19
ERRORS
AND
DIAGNOSTIC
en-938846/6 17
List of Ladder functions:
- Sorted by theme
- In alphanumeric order
APPENDIX A
LIST OF
FUNCTIONS
18 en-938846/6
Preliminary
The keys to be pressed are indicated on the right. They can have two forms:
UTIL
Rectangular keys: correspond to softkeys located in the block at the bottom of the screen and
activated by function keys (F2-F11) located under the screen.
Index
The index at the end of the volume is convenient for looking up information related to keywords.
Agencies
The list of NUM agencies is given at the end of the volume.
Questionnaire
To help us improve the quality of our documentation, we kindly ask you to return the questionnaire at the end of this
volume.
en-938846/6 19
20 en-938846/6
Presentation of the Automatic Control Function
en-938846/6 1-1
1-2 en-938846/3
Presentation of the Automatic Control Function
1.1 General
The NUM 1060 CNC is a multimaster multiprocessor system in which the automatic control function provides the
1
interface with the NC machine-tool.
The automatic control function processes functions involving the sensors and actuators on the NC machine-tool and
Boolean and numerical data interfacing with the NC function.
Its capabilities for accessing the CNC screen and simulating the operator panel make it very flexible to use, allowing
the machine-tool OEM to customise the 1060 system for special applications.
The automatic control function is located in the central processing unit. The central processing unit includes one or
more cards and provides the CNC, graphic and automatic control functions as well as the memory.
Data transfers by bit or by byte with the input/output cards are via the serial bus.
en-938846/3 1-3
SYSTEM BUS
AXIS 2
AXIS 3
AXIS 4
4-AXIS GLOBAL MEMORY • PROCESSORS (NC and graphic functions) • MACHINE PROCESSOR
COUNTER CARD CARDS • DEDICATED INTERFACE ADAPTER (Mapway, Ethway, (Automatic control function)
IT/serial lines, analogue I/O)
SERIAL BUS
MACHINE
PANEL 32 INPUT/ 32 - 24 I/O 64 - 48 I/O
(1 to 4) 32 INPUT 32 OUTPUT 24 OUTPUT CARDS CARDS
with 32I/24O CARDS CARDS CARDS
extension
1-4 en-938846/6
Presentation of the Automatic Control Function
SYSTEM BUS
INTERFACE INTERFACE
RAM
32-bit Coprocesseur EXCHANGE
68020 68882 REPROM AREA
CPU
AXIS 1
AXIS 2
AXIS 3
AXIS 4
SERIAL BUS
MACHINE
PANEL 32 INPUT/ 32 - 24 I/O 64 - 48 I/O
(1 or 2) 32 INPUT 32 OUTPUT 24 OUTPUT CARDS CARDS
with 32I/24O CARDS CARDS CARDS
extension
en-938846/3 1-5
1.2 Automatic Control Function
The automatic control function is managed by a monitor that handles a number of basic tasks such as initialisation,
input/output assignment to the different racks, input/output interface, watchdog, etc.
To this systematic processing performed by the monitor is added processing of programmes called «user program-
mes».
The programme is executed under control of the monitor. Programme execution is clocked by the real-time clock (RTC)
with a 20 ms cycle.
The configuration of the inputs/outputs is set at power on. The refresh cycle requires 2 ms.
The use of the automatic control function requires availability of the PLCTOOL programming tool on PC. It is used to:
- write programmes in Ladder language,
- compile programmes,
- transfer programmes to the CPU,
- debug programmes after loading them.
Used in conjunction with the MICROTEC RESEARCH MCC68K compiler, PLCTOOL also allows writing, compilation
and transfer of programmes in C.
Programmes are loaded and unloaded via one of the system serial lines.
1-6 en-938846/6
Presentation of the Automatic Control Function
SYSTEM BUS
BUS INTERFACE
• BUS ACCESS DYNAMIC PRIVATE RAM RAM WITH BACKUP
• SYS MASTER IT 1 to 4 MB 32 KB
• SLAVE IT
µp
68020 INTERNAL BUS
CUSTOMER MFP
• ACIA SERIAL BUS
MASTER
• INPUT TIMER
• OUTPUT TIMER
SERIAL BUS
en-938846/6 1-7
SYSTEM BUS
µp
68020 INTERNAL BUS
GRAPHIC
PANEL SERIAL BUS
68882 INTERFACE
COPROCESSOR MASTER
SERIAL BUS
1-8 en-938846/3
Structure of an Application
2 Structure of an Application
en-938846/3 2-1
2-2 en-938846/3
Structure of an Application
2.1 General
The machine processor card performs two types of tasks:
- «system» tasks initiated by the monitor and not programmable by the user,
- «user» tasks programmable by the user.
2
2.1.1 «System» Tasks
2.1.1.1 «System» Start up Task
Processing Performed
Occurrence
Processing performed
Occurrence
This task is executed once each real time clock (RTC) cycle (real-time clock).
en-938846/3 2-3
RESET
TASK Task executed once on reset
of the machine processor
%INI
RTC CYCLE
20 ms
- Reset
5 ms
SYSTEM - CNC I/O refresh
TASK - I/O refresh
CYCLIC
TASK
%TS0
SELECTION OF SEGMENT
CYCLIC
13 ms
TASKS
%TS1 to %TS4
BACKGROUND
TASKS
%TF0 to %TF15
SPARE
2 ms
PROGRAMME MONITOR
2-4 en-938846/3
Structure of an Application
Processing Performed
Processing Performed
This task processes the UNITE requests sent to the automatic control function server.
The automatic control function server mainly processes the following UNITE requests:
- Read/write of variables (%I, %Q, %R, %W, %M, %V),
- load/unload of automatic control function tasks (%TS0, %SP30, etc.),
- automatic control function STOP (stopping of user tasks),
- automatic control function INIT (CPU intialisation),
- automatic control function RUN (running of user tasks).
The %INI task is called by the system before any other user tasks when the automatic control function is started.
! CAUTION
The system reads the I/O card configuration returned by %INI. Any changes made later to
the configuration are ignored until the next restart.
2.1.2.2 Cyclic Tasks
The cyclic tasks are %TS0 to %TSn where n is incremented from 1 to 5 each RTC cycle.
The execution period of %TS1, %TS2, %TS3 and %TS4 is equal to five RTC cycles, i.e. 100 ms (the fifth RTC cycle
is used by system task %TS5).
en-938846/3 2-5
2.1.2.3 Background Tasks
These tasks (%TF0 to %TF15) are used for low priority tasks so as not to penalise cyclic tasks %TS. They also allow
the use of wait functions.
Background tasks %TF have lower priority than tasks %TS and %TH.
SUSPENDED
RUNNING
NOT READY
READY WAITING
2-6 en-938846/3
Structure of an Application
When the system is reset, tasks %TF are in NOT READY state. The call to function tfstart(n) causes %TFn to go into
READY state. 2
WAITING or READY or RUNNING —> NOT READY
The call to function tfstop(n) causes task %TFn to go into NOT READY state.
In READY state, a task %TF is executed as soon as no task is RUNNING and no %TF task with higher priority is in
READY state.
%TF0 priority > %TF1 priority > ... > %TF15 priority
Task %TF is suspended to allow execution of a task %TS or %TH. Tasks %TF are not mutually preemptible.
When no %TS or %TH task is running, the suspended %TF task is resumed.
REMARK Function whtr(..) programmed in a background task interrupts the task during
execution to allow the execution of other %TF tasks in READY state.
WAITING —> READY
The task was placed on wait by function whtr(..) for a given number of RTC cycles which have now elapsed.
The task is completed, and the occurrence of the RTC returns it to READY state.
en-938846/3 2-7
RTC CYCLE
(20 ms)
SYSTEMATIC
TASK
%TS0
(tfstart(5))
1060 Series II - UCSII (P99: 4 to 18 ms)
END OF
%TF5
%TF5 END OF
whtr() %TF0 %TF1
%TF1
2-8 en-938846/3
Structure of an Application
Tasks %TH0 to %TH15 allow processing of high priority events that cannot wait for the end of the RTC cycle.
Tasks %TH therefore have higher priority than tasks %TS and %TF.
2
An activated %TH task cannot interrupt a running %TH task.
%TH0 priority > %TH1 priority > ... > %TH15 priority.
The programmer associates a task %TH with a hardware interrupt by the following functions:
When the interrupt occurs, the system starts execution of the associated task %TH.
If several %TH tasks are activated during the same RTC cycle, the total time required for processing each interrupt
routine must not exceed 4 ms. If it does, the machine processor goes into the «computation time overrun» error.
Activation
%THn %THn–1
t > 4ms
en-938846/3 2-9
2.1.3 Overrun Processing
Processing of %TS tasks is clocked by the RTC with a 20 ms cycle. It should normally be completed before the end
of the cycle.
Consecutive Overruns
A slight overrun of the RTC cycle is tolerated in processing of tasks %TS. Each overrun, the system increments the
RTC overrun counter %R97C.W.
The fourth overrun increments the RTC overrun counter %R97C.W and causes the machine processor to go into
HALT_ON_ERROR state.
UP TO THREE CONSECUTIVE OVERRUNS Overrun
%R97C.W is incremented
RTC cycle RTC cycle
RTC cycle RTC cycle RTC cycle RTC cycle RTC cycle
%R97C.W is incremented %R97C.W is incremented %R97C.W is incremented HALT_ON_ERROR state
REMARK Although a user programme may not create an overflow when operating off load (e.g.
without machining parts), overflows may occur on load due to CNC hardware tasks
(feedback processing, etc.) or ITs (serial lines, etc.) added in the interval between two
RTCs.
Endless Loop in a Programme
Uninterrupted execution of %TSn for more than 40 ms causes a HALT_ON_ERROR with the ERR_RTC_OVERRUN.
40 ms
2 - 10 en-938846/6
Structure of an Application
Normal Operation
The user programme is clocked by the RTC with a 20 ms cycle. Its duration is however limited by parameter P99 (see
Parameter Manual). Parameter P99 is a multiple of 2 ms between 4 and 18 ms. Processing of %TS tasks should 2
normally be completed before occurrence of IT P99.
20 ms
P99 ms
Consecutive Overruns
A slight overrun of IT P99 is tolerated in processing of tasks %TS. Each overrun, the system increments the RTC
overrun counter %R97C.W.
If the RTC interrupt occurs before the %TS tasks are completed, the monitor is immediately restarted.
The fourth overrun increments the RTC overrun counter %R97C.W and causes the CPU to go into HALT_ON_ERROR
state.
RTC RTC RTC
1 2 3 4
MONI User MONI User MONI User MONI User
TOR programme TOR programme TOR programme TOR programme
1 2 3 4
MONI User MONI User MONI User MONI User
TOR programme TOR programme TOR programme TOR programme
REMARK Although a user programme may not create an overflow when operating off load (e.g.
without machining parts), overflows may occur on load due to CNC hardware tasks
(feedback processing, etc.) or ITs (serial lines, etc.) added in the interval between two
RTCs.
en-938846/6 2 - 11
Endless Loop in a Programme
Uninterrupted execution of %TSn for 2 x P99 ms causes a HALT_ON_ERROR with the ERR_RTC_OVERRUN state.
RTC
MONITOR
%TS0 or %TSn (Endless loop in the programme)
< 5 ms
Failure to process the monitor for 2 x P99 ms causes a HALT_ON_ERROR with the ERR_RTC_OVERRUN error.
RTC RTC
MONITOR MONITOR
User programme User programme
< 5 ms < 5 ms
2 - 12 en-938846/3
Structure of an Application
Detail of Modules 2
Ladder Task Modules
Ladder task modules are associated with:
- task %INI,
- tasks %TS0 to %TS4,
- tasks %TF0 to %TF15,
- tasks %TH0 to %TH15.
These modules are called by the system task manager. They cannot be called explicitly. The user manages these
task modules by means of the task management functions (see Chapter 7).
Ladder task modules are files of the *.XLA type.
Executable Modules
Executable modules are produced by a C compiler (MCC68K). These modules can be called from a ladder task module
or a ladder subroutine module using function exec(..).
All tasks can be written in C. If the same task is written in C and in ladder language, it is the C code that is executed
by the automatic control function.
Executable modules are files of the *.XCX type.
USER PROGRAMME
%INI
RTC cycle
(20 ms)
EXTERNAL
SYSTEM
EVENT
TASK
HARDWARE
TASK TASKS
%TS0
%TH0
to
%TH15
MONITOR
%SP0
to
%SP255
16
BACKGROUND
TASKS
%TF0
to
%TF15
2 - 14 en-938846/5
Structure of an Application
The sequence is the basic entry and compilation unit. There are three types of elementary sequences:
- the sequence used for entry of a table of numerical constants, 2
- the sequence used for entry of one of more character strings,
- the sequence used for entry of a network of contacts and coils.
The number of tables that a module can contain is limited by the maximum module size and the number of sequences
which must be less than 100.
Tables are accessed by the table start address contained in a %Vxx.L or %Yxx.L variable using functions of the type
cpyb(..), cpyl(..), print(..), etc.
The values of a table can be accessed directly by the pointers (e.g. %Yxx -> n.L).
A table is initialised when the monitor loads variable %Vxx.L or %Yxx.L with the table start address.
A table sequence must therefore have been executed once by the system before being able to be used by a ladder
sequence in the programme.
en-938846/3 2 - 15
2.6 Character String Sequence
2.6.1 General
This type of sequence contains character strings that are mainly processed by the NC screen display functions.
It includes:
- an optional label and an optional comment,
- an optional grafcet step,
- the definition of one to 32 character strings.
The number of string sequences that a module can contain is limited by the maximum module size and the number
of sequences which must be less than 100.
The compiler automatically adds a null byte to the end of each string.
Strings are accessed by the string start address contained in a %Vxx.L or %Yxx.L variable using functions of types
printf(..), scano(..), scanu(..), etc.
The characters of a string can be accessed directly by pointers (e.g. %Yxx -> n.B).
A string sequence must therefore have been executed once by the system before being able to be used by a ladder
sequence in the programme.
The same variable %Vxx.L or %Yxx can be associated with different strings in different sequences. In this case, the
% variable %Vxx.L contains the address of the string located in the string sequence executed last.
2 - 16 en-938846/3
Variables
3 Variables
en-938846/8 3-1
3.7.13 Image Part of the Compact Panel 3 - 27
3.7.13.1 Image Part of the Compact Panel in the
Exchange Area 3 - 27
3.7.13.2 Image Part of the Compact Panel 3 - 27
3.7.13.3 Image of the JOG Softkeys 3 - 27
3.7.13.4 Programmable Key Image Leds 3 - 28
3.8 CNC I/O Interface Family %R and %W 3 - 29
3.8.1 Inputs from the CNC %R0 to %R7F 3 - 29
3.8.1.1 Keyboard Characters: %R0.W 3 - 29
3.8.1.2 Machine Status: %R2.W 3 - 29
3.8.1.3 CNC Status: %R4.W 3 - 30
3.8.1.4 Axes in Motion: %R6L 3 - 31
3.8.1.5 Axes Initialised (origin setting completed):
%RA.L 3 - 32
3.8.1.6 External Parameters E10000 to E10031:
%RE.L 3 - 32
3.8.1.7 Spindle Status: %R12.W 3 - 33
3.8.1.8 Type of Jog Increment: %R15.B 3 - 34
3.8.1.9 Current Mode: %R16.B 3 - 34
3.8.1.10 Other Variables 3 - 35
3.8.1.11 Spindle Speed: %R1C.W to %R22.W 3 - 36
3.8.1.12 Axis Clamp: %R24.L 3 - 36
3.8.1.13 1050 Servo-Drive Status Word 3 - 37
3.8.2 Outputs to the CNC %W0 to %W7F 3 - 38
3.8.2.1 Pulse Commands: %W2.W 3 - 38
3.8.2.2 Latching Commands: %W4.W 3 - 39
3.8.2.3 Positive JOG Commands: %W6.L 3 - 40
3.8.2.4 Negative JOG Commands: %WA.L 3 - 41
3.8.2.5 External Parameters E20000 to E20031:
%WE.L 3 - 41
3.8.2.6 Value of the Jog Increment: %W13.B 3 - 42
3.8.2.7 Mode Requested: %W14.B 3 - 42
3.8.2.8 Message Display: %W15.B and W16.B 3 - 42
3.8.2.9 Axis Group Selection: %W17.B 3 - 43
3.8.2.10 Requested Programme Number: %W18.W 3 - 43
3.8.2.11 Handwheel Assignment: %W1A.B to
%W1D.B 3 - 44
3.8.2.12 Spindle Potentiometer: %W1E.B to
%W21.B 3 - 44
3.8.2.13 Spindle Controls: %W22.W 3 - 45
3.8.2.14 Spindle Speed Setting: %W24.W to
%W2A.W 3 - 45
3.8.2.15 Inhibited Jog Increments: %W2C.W 3 - 48
3.8.2.16 Modes Inhibited: %W30.L 3 - 49
3.8.2.17 Torque Enable for QVN Axes: %W34.L 3 - 50
3.8.2.18 Speed Reference Enable for QVN Axes:
%W38.0 3 - 50
3-2 en-938846/8
Variables
en-938846/8 3-3
3.11 Exchange Area 3 - 72
3.11.1 Inputs from the CNC 3 - 72
3.11.2 CNC-PLC Exchange Area - 1050 3 - 74
3.11.3 Output to the CNC 3 - 75
3.11.4 PLC-CNC Exchange Area - 1050 3 - 79
3.11.4.1 Torque Modulation 3 - 79
3.11.4.2 Servo-Drive Control Word 3 - 79
3.11.5 Inputs from Axis Groups 3 - 80
3.11.6 Outputs to Axis Groups 3 - 81
3-4 en-938846/8
Variables
Exchanges with the discrete input/output cards are processed directly by the automatic control function.
REMARK The terms inputs and outputs are defined with respect to the automatic control
function.
An input is a variable read by the automatic control function. 3
An output is a variable written by the automatic control function.
Read %W Write %W
en-938846/6 3-5
3.2 Variable % - Mnemonic
A variable can be represented in two ways:
- One representation that always begins with the character %. This representation allows the compiler to determine
the physical address of the variable,
- An optional user representation also called mnemonic. This representation does not have to begin with %.
The user can associate a mnemonic with a % variable in a symbol table (see the «PLCTOOL Programming Tool»
manual).
3.3 Variable %
This type of variable always begins with % and includes the following fields:
- Symbol,
- Logical number,
- Size,
- Index.
Symbol Logical number Size Index
%
3.3.1 Symbol Field
This field is mandatory.
This field designates an object in a family. The logical number is hexadecimal of four digits maximum.
The logical number is the logical address in BYTES as an offset from the first element of the family.
3-6 en-938846/6
Variables
Examples
Example
If %M2.W = 4
Then %M8.L[%M2.W] designates %MC.L.
! CAUTION
Example
%M34.&[%M4.W] is prohibited.
Indexing of bit variables affects the byte address but does not change the bit location in the byte.
Example
If %M2.W = 4
Then %M8.7[%M2.W] designates %MC.7.
en-938846/6 3-7
3.4 Mnemonic
A mnemonic is a combination of up to twelve characters at most chosen from:
- the 26 capital letters (A, B, C, ..., Z),
- the 26 lower case letters (a, b, c, ..., z),
- the 10 digits (0, 1, 2, ..., 9),
- the underline character ( _ ).
A mnemonic must always begin with a letter (the underline character is prohibited). The compiler does not differentiate
between upper and lower case letters. The user can only associate a mnemonic with a variable %.
These associations are saved in the PLCTOOL symbol files (*.XSY).
Example
If the mnemonic «Status_word» is associated with variable %M3.B,
3-8 en-938846/6
Variables
The I/O cards are addressed logically (see Sec. 3.7.4) on four digits. The default value (no reconfiguration) is:
Logical @ = geographic @
I r (0 to 6) (1 to C)
c
(0 to 3F)
%Q
The card number c and rack number r are related to the type of equipment. Refer to the Installation and Commissioning
Manual for rack addressing.
Example
REMARK Logical (as opposed to geographical) addressing is also possible (see Sec. 3.7.4).
en-938846/6 3-9
3.7.1 Structure of Read Variables %Irc
The block of %Irc read variables (for cards 0 to C) is divided into two parts:
- card diagnostic part,
- card image part.
This part contains the images of the card inputs. The input images are located at the low logical addresses (%Irc00,
%Irc01, etc.). The structure depends on the type of card.
Example:
3 - 10 en-938846/6
Variables
This word informs the user of the internal status of the card. This functionality is available only on the 32I/24O cards
and 32-24 I/O, 64-48 I/O extension cards of the machine operator panel.
Register %Irc3C.W has the following format:
Bit 15 Bit 0
The internal card status is checked periodically. The programmer can set the period by function DIAGIQ().
If a problem is detected, the register is no longer updated. The user must force the register to 0x00FF to restart update.
REMARK If an internal card fault is detected then the general I/O card error bit %R97F.2
(DEFCARTE) is set.
3.7.3.3 Dialogue Error Counter %Irc3A.W
This word is incremented whenever a link error or card error is detected when polling a card. This counter is blocked
at 0x7FFF.
This byte informs the user of the status of the serial I/O bus link:
- 0 operation OK,
- 1 no echo frame,
- 2 check-sum error on echo frame,
- 3 no response frame,
- 4 check-sum error on response frame,
- 5 optical fibre cut,
- 6 other errors.
The card internal fault bits include the input line fault bits and output line fault bits (refer to the detailed description for
each card supporting this functionality).
If the input link bits are set, the state of the corresponding power supply fault bits is not significant.
If the output link bits are set, the state of the corresponding short circuit fault bits is not significant.
REMARK If four consecutive transmission errors occur on the same card, the general serial
I/O bus link fault bit %R97F.0 (DEFBUS) is set and the watchdog is reset.
If the transmission errors occur during machine processor initialisation, the general
serial I/O bus link fault bit %R97F.0 (DEFBUS) is set and the watchdog is not set.
If the transmission errors occur during a CPU reset, the general serial I/O bus link fault
bit M97F.0 (DEFBUS) is set and the watchdog is disabled.
en-938846/7 3 - 11
3.7.4 Card Configuration Variables
This field indicates the type of card the user expects to find in the location of rack r and card slot c. It must be
programmed in an %INI task.
It is used to check whether the card/rack configuration of an application is correct. The check is made by comparing
this identifier with the values read in %Irc3E.W.
REMARK If there is a difference between the specified configuration %Qrc3E.W and the actual
configuration %Irc3E.W, the general I/O card configuration error bit %R97F.1
(DEFCONF) is set, the inputs and outputs are no longer refreshed and the watchdog
is reset.
%Qrc3E.W is initialised with 0x700. This value indicates that the card is not configured. In this case, the monitor
processes the card only if it is present in the rack.
Example
This option is used to choose the physical card associated with variables %Irc and %Qrc. This facilitates management
of physical changes of the system since it is not necessary to change the input/output variables in the programme.
If byte %Qrc3D.B == r’c’, the physical card associated with variables %Irc and %Qrc is card c’ of rack r’.
%Qrc3D.B must be initialised with r’c’ in task %INI since the system only reads %Qrc3D.B on return from %INI.
When r’ does not indicate a configured rack or c’ does not indicate a configured card (ERROR_CONFIG_SBCE error),
the general I/O card configuration error bit %R97F.1 (DEFCONF) is set, the inputs and outputs are no longer refreshed
and the watchdog is reset.
As the geographic identification of the bus is carried out before task %INI, the user can use word %Irc3E.W (card
identifier) in this task. If the logical addressing option (%Qrc3D.B) is used, the identifier read on the bus is moved
accordingly in the input/output table.
Example
In the basic configuration, there is a 32I/24O card in slot 7 of the main rack.
For this card, the user programme is written with variables %I07xx.x and %Q07xx.x.
3 - 12 en-938846/6
Variables
A configuration change requires moving the card from rack 0, slot 7 to extension rack 1, slot 1.
Must be programmed in the %INI task. This byte sets the card priority. It is used to associate a card with a systematic
task %TS0, %TS1 to %TS4 or %TS5.
This makes it possible to decrease the systematic processing performed each RTC.
The inputs of cards with priority i = 1, 2, 3, 4 are read before the call to %TSi.
The outputs of cards with priority i = 1, 2, 3, 4 are written at the end of %TSi.
If the priority byte is not between 0 and 5, the card is not periodically refreshed by the monitor. It can however be
accessed by explicit read and write functions (see Sec. 10.2, read_i(...)function and 10.3, write_q(...)function).
The system initialises the priority byte with the default value of 0.
en-938846/6 3 - 13
3.7.4.4 Watchdog %Qrc3B.0
Must be programmed in the %INI task. When this bit is set, it indicates that output %Qrc00.0 of this card is a watchdog
output.
Two watchdogs are allowed. The monitor scans all of variables %Qrc3B.0 and selects the first two watchdogs
programmed in increasing order (r,c).
If the watchdog is not initialised, the general I/O card configuration error bit %R97F.1 (DEFCONF) is set, the inputs
and outputs are no longer refreshed and the watchdog is reset.
3 - 14 en-938846/6
Variables
Variables %I and %Q are organised as memory blocks of 64 %I bytes followed by 64 %Q bytes corresponding to one
card then to the next card until reaching the last card of the rack.
The racks are consecutive and contiguous (from rack 0 to rack 6).
Offset
0
%Ir00
to 64 bytes %I card 0
%Ir03F
3F
%Qr00
to 64 bytes %Q card 0
%Qr03F
7F
%Ir100
to 64 bytes %I card 1
%Ir13F
BF
%Qr100
to 64 bytes %Q card 1
%Qr13F
FF
700
%IrE00
to 64 bytes %I card E
%IrE3F
73F
%QrE00
to 64 bytes %Q card E
%QrE3F
77F
%IrF00
to 64 bytes %I card F
%IrF3F
7BF
%QrF00
to 64 bytes %Q card F
%QrF3F
7FF
en-938846/6 3 - 15
3.7.5.2 Physical Organisation of Variables %I and %Q of the Different Racks
Offset
0
7FF
FFF
17FF
1FFF
Rack 4 16 cards (64 %I + 64 %Q) = 2 kbytes
27FF
2FFF
37FF
3 - 16 en-938846/6
Variables
1060 Rack
1020/1040/1050 Cards
1060 Rack
REMARK The rack hardware components (power supply + metal work + bus) correspond to
card 0.
Rack type No. of cards Power supply Optical fibre Value of identifier
%Ir03E.W
Main 8 130w Yes 0x0
Main 8 130w No 0x80
Main 8 60w Yes 0x10
Main 8 60w No 0x90
Main 4 130w Yes 0x3000
Main 4 130w No 0x3080
Main 4 60w Yes 0x3010
Main 4 60w No 0x3090
Extension 12 12 130w 0x1000
Extension 12 12 60w 0x1010
Extension 2 2 0x2020
en-938846/8 3 - 17
1020/1040 Rack
COM 0
00 0
00 1
00 2
00 3 %Irc00.0 to %Irc00.7
00 4
00 5
00 6
00 7
01 0
01 1
01 2
01 3
01 4 %Irc01.0 to %Irc01.7
01 5
01 6
01 7
COM 1
COM 2
02 0
02 1
02 2
02 3
02 4
%Irc02.0 to %Irc02.7
02 5
02 6
02 7
03 0
03 1
03 2
03 3
03 4
03 5 %Irc03.0 to %Irc03.7
03 6
03 7
COM 3
32 E
3 - 18 en-938846/6
Variables
00 0 WD
COM 0
00 1
COM 1
00 2 %Qrc00.0 to %Qrc00.7
00 3
00 4
00 5
00 6
00 7
01 0
01 1
01 2
01 3
01 4
%Qrc01.0 to %Qrc01.7
01 5
01 6
01 7
COM 2
02 0
02 1
02 2
02 3 %Qrc02.0 to %Qrc02.7
02 4
02 5
02 6
02 7
03 0
03 1
03 2
03 4
03 5
03 6 %Qrc03.0 to %Qrc03.7
03 7
COM 3
32 S
en-938846/6 3 - 19
3.7.9 Image Part of the 32-24 I/O Discrete I/O and 32-24 I/O Cards
3 - 20 en-938846/6
Variables
24.O
24 S
%Qrc00.0 to %Qrc02.7
3
%Qrc00.0 to %Qrc02.7
32.I
24 VEE
0VE
32 E
%Irc00.0 to %Irc03.7
%Irc00.0 to %Irc03.7
32.I / 24.O 32 E / 24 S
en-938846/6 3 - 21
3.7.10 Image Part of the 64-48 I/O Card
3 - 22 en-938846/6
Variables
48.O
%Qrc03.0 to %Qrc05.7
2nd relay module
%Qrc00.0 to %Qrc02.7 3
1st relay module
64.I
%Irc04.0 to %Irc07.7
2nd interface module
%Irc00.0 to %Irc03.7
1st interface module
64.I / 48.O
en-938846/6 3 - 23
3.7.11 Image Part of the Basic Operator Panel Card
%Qrc01.7 %Qrc01.6 %Qrc00.7 %Qrc00.6 %Qrc00.5 %Qrc01.0 %Qrc01.1 %Qrc01.2 %Qrc01.3 %Qrc01.4 %Qrc01.5 %Qrc00.4 %Qrc00.3 %Qrc00.2
(led_man5) (led_man4) (led_manz) (led_many) (led_manx) (led_1) (led_10) (led_100) (led_1000) (led_10000) (led_ill) (led_sdb) (led_m01) (led_rax)
%Irc01.7 %Irc01.6 %Irc03.7 %Irc03.6 %Irc03.5 %Irc02.0 %Irc02.1 %Irc02.2 %Irc02.3 %Irc02.4 %Irc02.5 %Irc03.4 %Irc03.3 %Irc03.2
(maniv_5) (maniv_4) (maniv_z) (maniv_y) (maniv_x) (jog_1) (jog_10) (jog_100) (jog_1000) (jog_10000) (jog_ill) (sdb) (m01) (rapax)
%Irc01.1
(manip4b)
%Irc00.3 %Irc00.5
(manip1b) (manip2b) CYCLE
START
CYCLE
STOP
%Irc22.W %Irc20.W %Irc01.3 %Irc01.5 %Irc01.4 %Irc04.0 %Irc04.1 %Irc04.2 %Irc04.3 %Irc04.4 %Irc04.5 %Irc04.6 %Irc04.7 %Irc01.2 %Irc03.0 %Irc03.1
(potavpup) (potbrpup) (mode0) (mode2) (mode1) (fct_1) (fct_2) (fct_3) (fct_4) (fct_5) (fct_6) (fct_7) (fct_8) (rapmanpu) (arus) (dcy)
%Qrc02.0 %Qrc02.1 %Qrc02.2 %Qrc02.3 %Qrc02.4 %Qrc02.5 %Qrc02.6 %Qrc02.7 %Qrc00.0 %Qrc00.1
(led_fct1) (led_fct2) (led_fct3) (led_fct4) (led_fct5) (led_fct6) (led_fct7) (led_fct8) (led_arus) (led_dcy)
3 - 24 en-938846/6
Variables
REMARK The panel output LED test must not be conducted in a single operation. In the PLC
programme, first test half the LEDs then test the other half.
en-938846/6 3 - 25
24-output extension (pinout) 32-input extension (pinout)
24 VS.0 %Irc10.0
19 1
%Qrc10.0 %Irc10.1
37 20
%Qrc10.1 %Irc10.2
18 2
%Qrc10.2 %Irc10.3
36 21
%Qrc10.3 %Irc10.4
17 3
%Qrc10.4 %Irc10.5
35 22
%Qrc10.5 %Irc10.6
16 4
COMMON %Irc10.7
34 23
%Qrc10.6 COMMON
33 5
COMMON %Irc11.1
14 24
%Qrc10.7 %Irc11.1
32 6
%Qrc11.0 %Irc11.2
13 25
%Qrc11.1 %Irc11.3
31 7
%Qrc11.2 %Irc11.4
12 26
%Qrc11.3 %Irc11.5
30 8
%Qrc11.4 %Irc11.6
28 27
COMMON %Irc11.7
9 9
%Qrc11.5 COMMON
8 28
%Qrc11.6 %Irc12.0
5 29
%Qrc11.7 %Irc12.1
7 11
%Qrc12.0 %Irc12.2
4 30
%Qrc12.1 %Irc12.3
25 12
%Qrc12.2 %Irc12.4
24 31
%Qrc12.3 %Irc12.5
20 13
%Qrc12.4 %Irc12.6
21 32
%Qrc12.5 %Irc12.7
22 14
%Qrc12.6 COMMON
23 33
%Qrc12.7 %Irc13.0
1 15
24 VS.1 %Irc13.1
2 34
COMMON %Irc13.2
3 16
%Irc13.3
35
%Irc13.4
17
%Irc13.5
36
%Irc13.6
18
%Irc13.7
37
COMMON
19
24 VE
10
3 - 26 en-938846/6
Variables
N S T
-
= %I104.3 %I105.3
7 8 9
X Y Z ! %I104.4 %I105.4
4 5 6 +
A B C %I104.5 %I105.5
1 2 3
P Q R
D 0 .
INSER %I122.W
DEL END
%I101.0
%I101.2
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 %I101.1
The compact panel has special softkeys including the new JOG keys used to select the axis controlled by the jogs:
%I100.0 %I100.3
%I100.1 %I100.4
%I100.2 %I100.5
X Y Z A B C MANIV ../..
en-938846/8 3 - 27
The axes whose names appear in the keys are those that were defined in machine parameter P9 (see Parameter
Manual). They appear in the order in which they were defined.
The functions activated by the programmable keys are shown by LEDs in the Status window:
%Q103.0
%Q103.1
%Q103.2
%Q103.3
%Q103.4
%Q103.5
SFCT 1 2 3 4 5 6
FCT 1 2 3 4 5 6
%Q102.5
%Q102.4
%Q102.3
%Q102.2
%Q102.1
%Q102.0
The bottom row of LEDs represents the programmable keys alone and the top row represents the shifted
programmable keys.
3 - 28 en-938846/6
Variables
en-938846/6 3 - 29
Variable Mnemonic Description
%R3.3 E_RAX General axis recall
In CYHLD mode and at the end of SEARCH, indicates axis recall is enabled.
Set by read of C_RAX = 1 by the NC.
Reset by read of C_RAX = 0 by the NC.
%R3.2 E_CYCLE Cycle in progress
Set by the CYCLE key on the machine panel (C_CYCLE = 1).
Reset by the RAZ key on the panel, C_RAZ = 1 or at the end of execution of the
programme (M02).
%R3.1 E_ARUS Cycle stop
Indicates the CYHLD state of the system (programme stopped during execution
and enabling of axis jogs).
Set by the CYHLD key on the machine operator panel (C_ARUS = 1).
Reset by the CYCLE key on the machine operator panel (C_CYCLE = 0).
%R3.0 E_RAZ CNC reset in progress
Pulse bit with a duration of 100 ms indicating a system reset.
While this pulse is high, data from the automatic control function are ignored.
Set by the RAZ key on the panel, a reset request from the automatic control
function (C_RAZ = 1), at the end of execution of a part programme (M02) or when
the NC is turned on.
This variable is reset after 100 ms.
3 - 30 en-938846/6
Variables
en-938846/6 3 - 31
3.8.1.5 Axes Initialised (origin setting completed): %RA.L
External parameters E100xx are written by the part programme. They are visible to the m/c processor programme.
The parameters are used to make part programme status available to the m/c processor.
en-938846/6 3 - 33
3.8.1.8 Type of Jog Increment: %R15.B
3 - 34 en-938846/8
Variables
REMARK Refer to the Operator Manual for the list of machine errors.
%R19.B ID_KB_CN Operator panel or CNC active identifier
In a multipanel configuration, gives the number of the active panel (0 to 7)
In a multi CNC configuration, gives the number of the active CNC (0 to 4)
%R1A.W PROGCOUR Active Programme Number
This variable contains the number of the active programme.
The value 0XFFFF (-1) indicates there is no active programme.
The value 0xFFFE (-2) indicates selection of the drip feed mode.
en-938846/7 3 - 35
3.8.1.11 Spindle Speed: %R1C.W to %R22.W
3 - 36 en-938846/6
Variables
For the digital servo-drive at address xx (xx between 00 and 31), the status word format is as follows:
Gamma Position
CCGM El OK %REyy.B
%REyy.2 %REyy.1 %REyy.0
Servo-drive @xx status word
Autocal Run Torque Drive Speed Power Drive Learn
In OK OK Status OK Rs Enable Status %REzz.B
%REzz.7 %REzz.6 %REzz.5 %REzz.4 %REzz.3 %REzz.2 %REzz.1 %REzz.0 3
Bit Meaning Value
%REzz.0 Learn Status Reserved
%REzz.1 Drive Enable 0: servo-drive not enabled
1: servo-drive enabled
%REzz.2 Power Rs 0: bus voltage not present
1: bus voltage present
%REzz.3 Speed OK 0: speed not reached
1: speed reached
%REzz.4 Drive Status 0: servo-drive stopped
1: servo-drive start
%REzz.5 Torque OK 0: torque threshold not reached
1: torque threshold reached
%REzz.6 Run OK 0: motor stopped
1: motor running
%REzz.7 Autocalibration In 0: self-calibration completed
1: self-calibration in progress
%REyy.0 Position OK 0: position not reached
1: position reached
%REyy.1 Gamma EI 0: low speed range
1: high speed range
%REyy.2 CCGM 0: mechanical speed range not requested
1: mechanical speed range requested
en-938846/8 3 - 37
3.8.2 Outputs to the CNC %W0 to %W7F
3 - 38 en-938846/8
Variables
REMARKS For processing of C_ARUS, C_CYCLE and C_RAX, refer to the Operator Manual.
For processing of C_DGURG, refer to the Programming Manual.
3.8.2.2 Latching Commands: %W4.W 3
Variable Mnemonic Description
%W4.7 VREDUIT Causes a switch to low speed
Set to force the low speeds of movement set in words N3 and N4 of parameter
P31 (see Parameter Manual).
%W4.6 INIBUTIL Utility inhibit
Set to inhibit access to the utilities.
Reset to enable access to the utilities.
%W4.5 C_UNIT Display units (metric or inch system)
Set to enable dimension entry and display in inches.
Reset to enable dimension entry and display in the metric system.
%W4.4 PRESPUIS Motor power on.
This variable is reset to indicate a synchronised axis motor power failure to the
NC (after a synchronisation error).
It is set to indicate power return and axis synchronisation enable to the NC.
%W4.3 NARFIB No stop at end of block
Enables execution of a CYCLE in the AUTO, SINGLE, MDI, DRYRUN modes and
enables block sequencing in the AUTO and DRYRUN modes.
Reset of this variable causes the cycle to stop at the end of execution of the
current block.
%W4.2 VITMAN2 Selection of rapid feed rates in manual modes 1 and 2
%W4.1 VITMAN1 Enable selection of rapid feed rates in the JOG and HOME modes or setting the
handwheel increment multiplier.
The feed rates are modulated by the feed rate potentiometer.
VITMAN1 VITMAN2 FEED RATE HANDWHEEL
(Parameter P31) INCREMENT
0 0 Normal JOG IU x 1
0 1 Slow JOG IU x 100
1 0 Fast JOG IU x 10
1 1 Fast JOG Ui x 10
Where IU = internal system unit set by a machine parameter.
%W4.0 AUTAV Feed authorised on all the axis groups
Enables movements in all the modes with movement.
STOP in the CNC status window indicates that this operand is reset.
%W5.7 SC_SAVE CNC screen on standby
Set to enable the CNC screen to be placed on standby after five minutes of
keyboard inactivity.
Reset to inhibit the switch to standby of the screen and immediately reactivate the
screen.
en-938846/8 3 - 39
Variable Mnemonic Description
%W5.6 SK_DISPL Softkey bar window display
Set to inhibit display of the softkey bar window.
Reset to enable display of the softkey bar window.
REMARK Inhibiting of the display does not inhibit use of the softkeys.
%W5.5 INIBCLAV Keyboard inhibit
Set to inhibit the alphanumeric QWERTY keyboard and function keys for the
basic softkeys which are then no longer processed by the CNC.
The key codes are however transmitted to the automatic control function by
CARCLAV.
%W5.4 IMPULS Operator panel pulse inputs
Disable the RAZ, ARUS, CYCLE, M01, / keys and the TCOMP softkey.
Set to disable the keys on the CNC operator panel and enable selection by the
automatic control function.
%W5.3 CORDYN Wear offset load enable
Set to enable load of the wear offsets by the automatic control function and
disable load from the operator panel.
%W5.2 JOGPUP JOG selection from the operator panel
Set to disable selection of the jog type by the CNC operator panel and enable
selection by the automatic control function.
%W5.1 MODEPUP Operator panel mode selection
Set to disable mode selection by the CNC operator panel and enable mode
selection by the automatic control function.
The mode is selected by the PLC. The mode number is encoded in %Wg03.b.
The mode codes are the same as those of %W14.b for common modes.
%W5.1=0. Except for MMI, the modes can be selected from the operator panel.
The mode is assigned to the group selected by %W17.b.
%W5.0 PUPABS CNC panel absent
Set to declare the CNC panel absent.
All the CNC operator panel functions are disabled and can be simulated by the
automatic control function.
3 - 40 en-938846/8
Variables
External parameters E200xx are written by the user programme. They are visible in the part programme.
They are used to make machine status data available to the part programme.
en-938846/8 3 - 41
3.8.2.6 Value of the Jog Increment: %W13.B
3 - 42 en-938846/8
Variables
Nx $ MESSAGE NUMBER X 3
Where:
- the bloc numbers (N..) correspond to the numbers of the messages to be displayed,
- the messages are preceded by the character $,
- a message line can contain a maximum of 35 characters,
- unnumbered blocks are used for continuation of the messages.
en-938846/8 3 - 43
REMARK The programme requested must be present in the CNC memory to be installed as the
active programme. If it is not present, the system cancels the old active programme
and the message «NO ACTIVE PROGRAMME» is displayed on the current pro-
gramme page.
3.8.2.11 Handwheel Assignment: %W1A.B to %W1D.B
! CAUTION
Variables AFMAN1, AFMAN2, AFMAN3 and AFMAN4 must contain the physical address of
a measured axis.
The assignment of the handwheel to an axis must precede manual movement via the
handwheel.
The JOG, JOGPOSn and JOGNEGn commands (with n from 0 to 31) must be enabled for
the axis concerned.
3 - 44 en-938846/8
Variables
en-938846/8 3 - 45
CNC FUNCTION AUTOMATIC CONTROL FUNCTION
A
POTBRb
anai() Function D
Compute Spindle b potentiometer setting Signed value 8 bits
C
servo-drive on 16 bits or 12 bits + sign
reference M03_g et M04_g
Group g spindle
rotation direction anao() Function
VITBRb Signed value D 8 bits + sign
OR A or 12 bits + sign
Spindle b speed on 16 bits
C
Add sign
bit ± 10 volts
Add sign
bit
C_VITBRb
Spindle b speed setting
COMBRb
Spindle b selection
AXIS CARD
DAC MEASUREMENT CNC SPINDLE
Sign ± 10V
OR
SPINDLE + -
SERVO-DRIVE b = spindle number (1-4)
g = group number (1-8)
Mes M DT
3 - 46 en-938846/8
Variables
Programming of
a spindle assigned to
axis group g
In the programme
- read the spindle number (b) assigned
to group g:
. M61_g = 1: no spindle assigned
. M64_g = 1: spindle 1
. M65_g = 1: spindle 2
3
. M62_g = 1: spindle 3
. M63_g = 1: spindle 4
Spindle NO
controlled by an axis
card
?
YES
YES
Sign
END
en-938846/8 3 - 47
3.8.2.15 Inhibited Jog Increments: %W2C.W
3 - 48 en-938846/8
Variables
en-938846/8 3 - 49
Variable Mnemonic Description
%W31.1 I_TEST Inhibits selection of the test mode.
Inhibits the TEST softkey in the mode key bar.
Set to inhibit the key.
Reset to enable the key.
%W31.0 I_JOG Inhibits selection of the manual mode.
Inhibits the MANUAL softkey in the mode key bar.
Set to inhibit the key.
Reset to enable the key.
3 - 50 en-938846/8
Variables
%W39.0 B_RECUL
Reset to inhibit the request.
Backword movement requested on path.
3
Set to enable the request.
Reset to inhibit the request.
3.8.2.20 Feed Stop per Axis (the bit number corresponds to the physical address of the axis):
%W3A.L
The current reduction function reduces the current on the digital axes and spindles according to the value of the
corresponding byte.
Let Imaximum be the maximum current taking into account static current limiting and α be the value of the byte:
- If α is negative or zero ($00, $80-$FF), there is no current reduction
- If α is positive ($01-$7F), the maximum permissible current is: Imaximum = Imax_stat x [(127 - α)/127]
The dynamic current reduction applied to a master digital servo-drive is transmitted to the associated slave digital
servo-drives.
When operating in antibacklash configuration, the dynamic reduction applied to a master digital servo-drive has no
effect on the master and slave preload currents.
en-938846/8 3 - 51
3.8.2.22 1050 Servo-Drive Control Word
For the digital servo-drive at address xx (xx between 00 and 31), the control word format is as follows:
3 - 52 en-938846/8
Variables
REMARK All these variables apply to independent CNC axis groups. Only variables E_RAZ1
to E_RAZ8, E_CYCL1 to E_CYCL8, E_DEGURG1 to E_DEGURG8, NO_POS1 to 3
NO_POS8 and E_DEF1 to E_DEF8 apply to PLC axis groups (see Chapter 17).
Variable Mnemonic Description
(group 1 to 8)
%Rg00.7 E_M011 Optional programme stop enabled on group g of independent CNC axes
to E_M018 Indicates that optional programme stops in a part programme are enabled.
%Rg00.6 E_SLASH1 Block skip enabled on group g of independent CNC axes
to E_SLASH8 Indicates that block skips in a part programme are enabled.
%Rg00.5 E_INTER1 Intervention status on group g of independent CNC axes.
to E_INTER8
%Rg00.0 E_PROG1 Active programme on group g of independent CNC axes.
to E_PROG8 Indicates that a part programme is active in one of AUTO, SINGLE, DRYRUN,
SEARCH, TEST or MDI modes
%Rg01.7 E_OPER1 Indicates that a programme stop caused by M00 or M01 is enabled.
to E_OPER8
%Rg01.6 E_DEF1 Fault on group g
to E-DEF8 Indicates a programming error or the absence of a part programme on the group.
Set to indicate that the group is faulty.
%Rg01.5 NO_POS1 Axis on wait for positioning
to NO_POS8 When accurate positioning is required by programming (functions G09, M00, M02
or M10) in MDI or JOG mode whenever movement is stopped, signal NO_POSg
is transmitted while the axis is on wait for positioning.
Set to indicate that the axis is on wait for positioning.
%Rg01.4 E_DGURG1 Emergency retraction in progress on group g
to E_DGURG8 Indicates execution of an emergency retraction programme.
Set after read of C_DGURGg = 1 by the CNC if the emergency retraction
programme is enabled.
Reset by detection of M00 or M02.
%Rg01.3 E_RAX1 Axis recall on group g of independent CNC axes
to E_RAX8 Indicates that axis recall is enabled.
%Rg01.2 E_CYCL1 Cycle in progress on group g
to E_CYCL8 Indicates that the group is executing a part programme block.
Reset: the CNC is waiting for flag C_CYCLEg = 1 to execute the part programme
or the next block.
Set: indicates that a block is being executed.
en-938846/8 3 - 53
Variable Mnemonic Description
(group 1 to 8)
%Rg01.1 E_ARUS1 Exit from cycle stop on group g of independent CNC axes
to E_ARUS8 Indicates system intervention status (programme stopped during execution and
axis jogs enabled).
%Rg01.0 E_RAZ1 Reset in progress on group g
to E_RAZ8 Pulse bit with a duration of 100 ms that indicates a reset on the group.
While this pulse is set, the data from the automatic control function are ignored.
Set by the RAZ key on the operator panel, by a reset request from the automatic
control function C_RAZg = 1, at the end of execution of a part programme (M02)
or at CNC power on.
This variable is reset after 100 ms.
%Rg06.B MODCOUR1 Current mode on CNC independent axis group g.
to The value of this variable is the image of the current CNC mode on independent
MODCOUR8 CNC axis group g.
3 - 54 en-938846/8
Variables
en-938846/8 3 - 55
Encoded M function
for group g
MCODCRg
Response from group g
CRMg
REMARK If CRM1 to CRM8 remains high, the part programme is continued after one PLC cycle.
3.8.3.6 Decoded M Functions: %Rg20.L
These functions used in part programmes are accessible for read by the automatic control function.
These functions are defined by and known to the system (e.g. axis clamping, spindle speed range, etc.).
The automatic control function reads the function on a bit (%Rg2n.i) assigned to a decoded M function.
A distinction is made between:
M function AXIS
BEFORE movement
AXIS M
movement function AFTER
Modal functions
A modal function remains stored and enabled during the execution of several part programme blocks, until it is
cancelled.
3 - 56 en-938846/8
Variables
Nonmodal functions
A nonmodal function is enabled only during execution of the part programme block containing it.
! CAUTION 3
All the decoded M functions are acknowledged by a response (CRM1 to CRM8)
The status of CRM1 to CRM8 determines whether the part programme is continued or waits
for the end of execution of the block
The automatic control function must manage CRM1 to CRM8 for the programmed
functions and the functions cancelled or reset (by a reset or INIT).
Modal M function
Nonmodal M function
CRMg
Block n Block n + 1
REMARK If CRM1 to CRM8 remains high, the part programme is continued after the PLC cycle.
en-938846/8 3 - 57
Variable M function Definition Cancelled by Type of function
(Group 1 to 8) Pre Post Modal Non
modal
%Rg20.7 M999_1 M999_8 Programmed inhibit of MDI and M997, M998, M2 X X
EDIT modes and subroutine calls by
the machine processor
%Rg20.6 M998_1* M998_8* Programmed enable of MDI and M999, M997 X X
EDIT modes and subroutine calls
by the machine processor
%Rg20.5 M997_1 M997_8 Forced block continuation M998, M999, M2 X X
%Rg20.3 M49_1 M49_8 Feed rate and spindle potentiometers M48, M2 X X
forced to 100 percent
%Rg20.2 M48_1* M48_8* Feed rate and spindle potentiometers M49 X X
enabled
%Rg20.1 M11_1 M11_8 Axis unclamp M10 X X
%Rg20.0 M10_1 M10_8 Axis clamp M11 X X
%Rg21.7 M12_1 M12_8 Forcing of CYHLD mode C_CYCLE = 1 X X
%Rg21.5 M45_1 M45_8 Spindle ranges Cancelled by one X X
%Rg21.4 M44_1 M44_8 another or by M02 X X
%Rg21.3 M43_1 M43_8 X X
%Rg21.2 M42_1 M42_8 X X
%Rg21.1 M41_1 M41_8 X X
%Rg21.0 M40_1 M40_8 X X
%Rg22.7 M19_1 M19_8 Indexed spindle stop M0, M2, M3, M4, ARUS X X
%Rg22.6 M09_1* M09_8* Coolant stop M7, M8 X X
%Rg22.5 M08_1 M08_8 Coolant 1 M9, M2 X X
%Rg22.4 M07_1 M07_8 Coolant 2 M9, M2 X X
%Rg22.3 M06_1 M06_8 Tool change CRM1 to CRM8 X X
%Rg22.2 M05_1* M05_8* Spindle stop M3, M4 X X
%Rg22.1 M04_1 M04_8 Anticlockwise spindle rotation M3, M5, M19, M0, M2 X X
%Rg22.0 M03_1 M03_8 Clockwise spindle rotation M4, M5, M19, M0, M2 X X
%Rg23.7 M61_1 M61_8 Current spindle disabled in a group M64, M65, M62, M63 X X
%Rg23.2 M02_1 M02_8 End of part programme RAZ X X
%Rg23.1 M01_1 M01_8 Optional stop C_CYCLE key X
%Rg23.0 M00_1 M00_8 Programme stop C_CYCLE key X
3 - 58 en-938846/8
Variables
Movement on axis t
Group g response
Axis t unclamped
Axis t clamped
Axis t in movement
AXMVTt
en-938846/8 3 - 59
T function
OUTILg
1 PLC
cycle Programme continued
E parameter
YES YES
Linear or circular MCODCRg = Function
MSSCRg = Function
interpolation code
code
YES YES
YES
NO Decoded pre-M Programmed Wait for 1 PLC
function ? dwell cycle
YES
Output new functions NO Decoded post-M YES C_FMEXTg = 1 ?
and cancel any functions ?
functions contradictory
with them YES NO
Output new functions
and cancel any Wait C_FMEXTg = 1
Wait for 1 PLC functions contradictory
cycle with them
3 - 60 en-938846/8
Variables
REMARK Variables C_MODE1 to C_MODE8 apply only to PLC axis groups (see Chapter 17).
Variables C_ARUS1 to C_ARUS8, C_RAX1 to C_RAX8, C_SLASH1 to C_SLASH8
and C_M011 to C_M018 apply only to CNC axis groups.
3
Variable Mnemonic Description
(group 1 to 8)
%Wg00.7 C_MODE1 Activates AUTO or SINGLE mode on PLC axis groups g.
to C_MODE8 Reset: AUTO mode enabled on the next block.
Set: SINGLE mode enabled for the current block.
This flag is meaningful only if the group is valid.
%Wg00.6 C_FAST1 Latched high speed command during a cycle
to C_FAST8 This command is used during a cycle (C_CYCLEg = 1).
Set to enable movement at the highest possible speed.
Reset to enable movement at the work rate.
%Wg00.5 CRM1 M function response for group g.
to CRM8 Reset: places the system on wait without processing the next functions in the
block being executed.
Set: enables processing to continue.
%Wg00.4 APPSS1 Subroutine call for group g.
to APPSS8 During execution of a part programme, APPSS is set for a branch to subroutine
%9999.g (where g is the group number). Latching of the bit or a new subroutine
call is ignored during execution of the subroutine.
No response is sent by the system during execution of the subroutine. The
subroutine should send the machine processor a response to cancel the bit
(M function, external parameter, etc.).
If only one CNC axis group is declared, programme %9999 is called
(i.e. %9999.0).
%Wg00.3 ARBUT1 Block interrupt on group g.
to ARBUT8 Set to stop movement on the axis group, then go to the next block or jump to
another block.
Function G10 associated with its arguments must be present in the part
programme.
%Wg00.2 VALID1 Group g enable
to VALID8 Set to enable use of the axis group.
Enabling or inhibiting are effective only after a reset or M02.
%Wg00.1 C_FMEXT1 End of external movement control on group g.
to C_FMEXT8 Reset to inhibit cancellation of CYCLE in SINGLE and MDI modes or
sequencing to the next block in AUTO and DRYRUN modes.
Set to allow normal execution of the mode.
This variable is tested at the end of execution of each block.
en-938846/8 3 - 61
Variable Mnemonic Description
(group 1 to 8)
%Wg00.0 C_AUTAV1 Feed authorisation on group g
to C_AUTAV8 This variable is active if general feed authorisation bit AUTAV = 1.
Reset to stop movement on the axis group in all modes with movements.
Movement is resumed when C_AUTAVg = 1.
%Wg01.7 C_M011 Enable optional programme stop (M01) on group g of independent CNC axes.
to C_M018 A pulse enables or inhibits the optional programme stop by toggling from the
previous state.
%Wg01.6 C_SLASH1 Enable block skip on group g of independent CNC axes.
to C_SLASH8 A pulse enables or inhibits block skip by toggling from the previous state.
%Wg01.4 C_DGURG1 Emergency retraction request for group g.
to C_DGURG8 This request is accepted in AUTO and SINGLE modes. The current block is
interrupted and the system branches to the last emergency retraction programme
declared in the part programme by function G75. If no emergency retraction
programme is specified, this signal is processed in the same way as C_ARUS.
%Wg01.3 C_RAX1 Select axis recall on group g of independent CNC axes.
to C_RAX8 This request is accepted in AUTO, SINGLE and DRYRUN modes.
%Wg01.2 C_CYCLE1 Cycle start request on PLC axis group g or independent group
to C_CYCLE8 Allows execu,ion of the AUTO and SINGLE modes for the PLC axis groups.
A pulse command must be used for C_CYCLEg to prevent resumption of
machining after detection of M02 or a reset in the AUTO mode.
This flag is ignored unless the group is valid.
%Wg01.1 C_ARUS1 Request cycle stop on group g of independent CNC axes.
to C_ARUS8 This request is accepted in AUTO, SINGLE, DRYRUN, SEARCH, TEST and MDI
modes.
%Wg01.0 C_RAZ1 Reset request on PLC axis group g or independent group
to C_RAZ8 Taken into account if there is no movement on the axes. It is during a reset on
a group that flag VALIDg is taken into account and the presence of the part
programme assigned to the PLC group is detected.
3 - 62 en-938846/8
Variables
The following variables inform the user in case of system or configuration errors.
(*) This counter is incremented by the system whenever an overrun is detected. It is reset
by the user programme.
(**) These bits ate set by the system whenever an error is detected.
3.8.5.2 System Diagnostic
The following variables give the time occupied (as a percentage of CPU time) by the monitor and each automatic
control task.
en-938846/8 3 - 63
Variable Mnemonic Description
%R96B.B Ts0_max4 Maximum time occupied by task %TS0 on cycle %TS4
%R96C.B Ts4_avr Mean time occupied by task %TS4
%R96D.B Ts4_max Maximum time occupied by task %TS4
%R96E.W Overrun4 Computation time overrun on cycle %TS4
%R970.B Sys_avr5 Mean time occupied by the monitor on cycle %TS5
%R971.B Sys_max5 Maximum time occupied by the monitor on cycle %TS5
%R972.B Ts0_avr5 Mean time occupied by task %TS0 on cycle %TS5
%R973.B Ts0_max5 Maximum time occupied by task %TS0 on cycle %TS5
%R974.B Ts5_avr Mean time occupied by task %TS5
%R975.B Ts5_max Maximum time occupied by task %TS5
%R976.W Overrun5 Computation time overrun on cycle %TS5
High byte MSB High byte LSB Low byte MSB Low byte LSB
Bit 31 Bit 0
If these two variables are mutually consistent, the component of the module specified is opened and animated.
Otherwise, the list of all the modules loaded on the PLC is proposed.
Example
%W97A.L = 0x00300F0
%W97E.B = 2
Component 2 of module SP240 is opened and animated.
3 - 64 en-938846/8
Variables
The following variables control actions of the monitor when system or configuration faults are detected.
! CAUTION
Parameters E30xxx and E40xxx are not saved. They are reset at power on.
Parameters E42xxx are saved.
Parameters E300xx are written by the part programme. They contain significant signed numerical values. They can
be read from and written to by the user programme.
en-938846/8 3 - 65
3.8.9.2 External Parameters E40xxx
Parameters E400xx are written by the user programme. They are used to include signed numerical values which can
be dimensions, offset, etc. for use in the in the part programme.
128 words addressed from E42000 to E42127. These parameters can be read from and written to by the user
programme (functions R_E42000 (..) and W_E42000 (..)) and by the part programme. They are accessible for read
and write using dynamic operators.
REMARK There is no guarantee of coherence of the exchanges at system level (for instance,
read by the machine processor can be interrupted by write by the CNC processor).
It is therefore up to the user to provide a secure exchange mechanism.
3 - 66 en-938846/8
Variables
The %R and %W variables are organised in blocks of 128 %R bytes followed by 128 %W bytes then again 128 %R
bytes and so forth until the end of the family.
Input variables %RE00 to %RE7F and %RF00 to %RF7F are reserved but not assigned.
Output variables %WE20 to %WE7F and %WF00 to %WF7F are reserved but not assigned. 3
Table
en-938846/8 3 - 67
3.9 %S Common Word Variables
When the CNC is connected to MAPWAY or ETHWAY networks, it allows access to the common words of the
Telemecanique TSX PLCs. The set of common words forms a data base shared by the stations of a network in which
each station can be a TSX PLC or a numerical control.
The stations included in the common word service share a common memory of 256 words x 16 bits.
Depending on the configuration, each station is allocated from 4 to 64 common words (accessible for write) of the
common memory. It has read-only access to the words assigned to the other stations.
3 - 68 en-938846/8
Variables
The %S variables are organised in 64 128-byte blocks independently of the common word setup.
The number of an %S variable is encoded on four hexadecimal digits. The two low digits indicate the byte number
in the station (from 0x0 to 0x7F) and the two high digits indicate the station number (from 0x0 to 0x3F). For instance,
%S21F.B represents byte 31 of station 2.
These flags are set by the system after update of the %S variables for the corresponding station. They can be reset
by the programmer to check for correct transfer operation.
Byte %S3F79B contains the number of its own station when the common word service is active.
REMARK If the common word service is not active, the %S variables can be used as common
unsaved variables.
en-938846/8 3 - 69
3.10 %Y Local Variables- Pointers
3.10.1 General
A data base of the microprocessor is available to the programmer. This base is used for %Y variables.
REMARKS The %Y variables are not essential for programming and their use is reserved for
experienced programmers.
The %Y variables cannot be displayed on the CNC screen and the PLCTOOL
programming tool.
The %Y variables are not accessible by a UNITE request.
Use of function y_init(..) inhibits visibility of any local variables of the modules.
3.10.2 Indirect Addressing - Pointers
Indirect addressing by pointer is allowed whenever a simple variable can be used, except for indexes.
! CAUTION
A variable pointed to can be associated with a mnemonic (see PLCTOOL - Programming Tool in Ladder Language
Manual).
To optimise speed, it is recommended to use numbers that are multiples of 4 for the pointers (e.g. %Y0 ->, %Y4 ->,
%Y8 ->, %YC ->, etc.).
Syntax
3 - 70 en-938846/8
Variables
Example
%Y4 -> 0.5 The address of the variable pointed to is equal to the address contained in the
pointer + post-offset «0».
3
%Y7c -> ff.B The address of the variable pointed to is equal to the address contained in the
pointer + post-offset «0xff».
In %SP0
en-938846/8 3 - 71
3.11 Exchange Area
3.11.1 Inputs from the CNC
CAR CLAV
%R0.B
%R4.B
%R4.7 %R4.6 %R4.5 %R4.4 %R4.3 %R4.2 %R4.1 %R4.0
E_TR E_DEF E_ E_CN %R4.W CNC status
ANSP MAP E_PPP PROG PRET
%R5.B
%R5.7 %R5.6 %R5.5 %R5.4 %R5.3 %R5.2 %R5.1 %R5.0
31 30 29 28 27 26 25 24
%RE.B
%RE.7 %RE.6 %RE.5 %RE.4 %RE.3 %RE.2 %RE.1 %RE.0
23 22 21 20 19 18 17 16
%RF.B
%RF.7 %RF.6 %RF.5 %RF.4 %RF.3 %RF.2 %RF.1 %RF.0
%RE.L External parameters E100xx
15 14 13 12 11 10 9 8
%R10.B
%R10.7 %R10.6 %R10.5 %R10.4 %R10.3 %R10.2 %R10.1 %R10.0
7 6 5 4 3 2 1 0
%R11.B
%R11.7 %R11.6 %R11.5 %R11.4 %R11.3 %R11.2 %R11.1 %R11.0
3 - 72 en-938846/8
Variables
SC_
E_BAT USED %R14.B PCNC
%R14.7 %R14.6 %R14.5 %R14.4 %R14.3 %R14.2 %R14.1 %R14.0
E _INCJOG
%R15.B Type of JOG increment
3
MODCOUR
%R16.B Current mode
PGVISU
%R17.B Displayed page number
ERRMACH
%R18.B Machine error number
ID_KB_CN
%R19.B Identificateur pupitre actif ou CN active
PROGCOUR
%R1A.B
%R1A.W Active programme number
PROGCOUR
%R1B.B
VITBR1
%R1C.B
%R1C.W Spindle 1 speed
VITBR1
%R1D.B
VITBR2
%R1E.B
%R1E.W Spindle 2 speed
VITBR2
%R1F.B
VITBR3
%R20.B
%R20.W Spindle 3 speed
VITBR3
%R21.B
VITBR4
%R22.B
%R22.W Spindle 4 speed
VITBR4
%R23.B
en-938846/8 3 - 73
AXBLK
31 30 29 28 27 26 25 24
%R24.B
%R24.7 %R24.6 %R24.5 %R24.4 %R24.3 %R24.2 %R24.1 %R24.0
AXBLK
23 22 21 20 19 18 17 16
%R25.B
%R25.7 %R25.6 %R25.5 %R25.4 %R25.3 %R25.2 %R25.1 %R25.0
AXBLK %R24.L Axis clamp
15 14 13 12 11 10 9 8
%R26.B
%R26.7 %R26.6 %R26.5 %R26.4 %R26.3 %R26.2 %R26.1 %R26.0
AXBLK
7 6 5 4 3 2 1 0
%R27.B
%R27.7 %R27.6 %R27.5 %R27.4 %R27.3 %R27.2 %R27.1 %R27.0
Gamma Position
CCGM El OK %REyy.B
%REyy.2 %REyy.1 %REyy.0
Servo-drive @xx status word
Autocal Run Torque Drive Speed Power Drive Learn
In OK OK Status OK Rs Enable Status %REzz.B
%REzz.7 %REzz.6 %REzz.5 %REzz.4 %REzz.3 %REzz.2 %REzz.1 %REzz.0
xx 11 12 13 14 15 16 17 18 19 20 21
yy 36 38 3A 3C 3E 40 42 44 46 48 4A
zz 37 39 3B 3D 3F 41 43 45 47 49 4B
xx 22 23 24 25 26 27 28 29 30 31
yy 4C 4E 50 52 54 56 58 5A 5C 5E
zz 4D 4F 51 53 55 57 59 5B 5D 5F
3 - 74 en-938846/8
Variables
en-938846/8 3 - 75
31 30 29 28 27 26 25 24 %WE.B
%WE.7 %WE.6 %WE.5 %WE.4 %WE.3 %WE.2 %WE.1 %WE.0
23 22 21 20 19 18 17 16 %WF.B
%WF.7 %WF.6 %WF.5 %WF.4 %WF.3 %WF.2 %WF.1 %WF.0 %WE.L External parameters E200xx
15 14 13 12 11 10 9 8 %W10.B
%W10.7 %W10.6 %W10.5 %W10.4 %W10.3 %W10.2 %W10.1 %W10.0
7 6 5 4 3 2 1 0 %W11.B
%W11.7 %W11.6 %W11.5 %W11.4 %W11.3 %W11.2 %W11.1 %W11.0
C INC JOG
%W13.B JOG increment
MODE DEM
%W14.B Mode requested
MSG1
%W15.B Line 1 message number
MSG2
%W16.B Line 2 message number
SELECGR
%W17.B Axis group selection
PROGDEM
%W18.B
%W18.W Requested programme number
PROGDEM
%W19.B
AFMAN1
%W1A.B Crank No. 1 assignment
AFMAN2
%W1B.B Crank No. 2 assignment
AFMAN3
%W1C.B Crank No. 3 assignment
AFMAN4
%W1D.B Crank No. 4 assignment
POTBR1
%W1E.B Spindle No. 1 potentiometer
POTBR2
%W1F.B Spindle No. 2 potentiometer
POTBR3
%W20.B Spindle No. 3 potentiometer
POTBR4
%W21.B Spindle No. 4 potentiometer
3 - 76 en-938846/8
Variables
C_ VITBR3
%W28.B
%W28.W Spindle No. 3 speed setting
C_ VITBR3
%W29.B
C_ VITBR4
%W2A.B
%W2A.W Spindle No. 4 speed setting
C_ VITBR4
%W2B.B
NJG NJG
MANIV 0001 %W2C.B
%W2C.7 %W2C.6 %W2C.5 %W2C.4 %W2C.3 %W2C.2 %W2C.1 %W2C.0
%W2C.W JOG increment inhibited
NJG NJG NJG NJG NJG NJG NJG NJG
001 01 1 10 100 1000 10000 ILLIM %W2D.B
%W2D.7 %W2D.6 %W2D.5 %W2D.4 %W2D.3 %W2D.2 %W2D.1 %W2D.0
I_ I_ I_REG I_ I_
POM PREF OUT CHARG DCHG
%W30.B
%W30.7 %W30.6 %W30.5 %W30.4 %W30.3 %W30.2 %W30.1 %W30.0
I_ I_ I_ I_ I_ I_ I_ I_
CONT SEQ IMD RAPID RNS MODIF TEST JOG %W31.B
%W31.7 %W31.6 %W31.5 %W31.4 %W31.3 %W31.2 %W31.1 %W31.0
%W30.L Modes inhibited
%W32.B
%W32.7 %W32.6 %W32.5 %W32.4 %W32.3 %W32.2 %W32.1 %W32.0
%W33.B
%W33.7 %W33.6 %W33.5 %W33.4 %W33.3 %W33.2 %W33.1 %W33.0
en-938846/8 3 - 77
DISC_ DISC_ DISC_ DISC_ DISC_ DISC_ DISC_ DISC_
TQR31 TQR30 TQR29 TQR28 TQR27 TQR26 TQR25 TQR24 %W34.B
%W34.7 %W34.6 %W34.5 %W34.4 %W34.3 %W34.2 %W34.1 %W34.0
RAP_ B_ B_
AUTO RETOUR RECUL %W39.B
%W39.7 %W39.6 %W39.5 %W39.4 %W39.3 %W39.2 %W39.1 %W39.0
STOPAX
31 30 29 28 27 26 25 24
%W3A.B
%W3A.7 %W3A.6 %W3A.5 %W3A.4 %W3A.3 %W3A.2 %W3A.1 %W3A.0
STOPAX
23 22 21 20 19 18 17 16
%W3B.B
%W3B.7 %W3B.6 %W3B.5 %R25.4 %W3B.3 %W3B.2 %W3B.1 %W3B.0
STOPAX %W3A.L Feed stop per axis
15 14 13 12 11 10 9 8
%W3C.B
%W3C.7 %W3C.6 %W3C.5 %W3C.4 %W3C.3 %W3C.2 %W3C.1 %W3C.0
STOPAX
7 6 5 4 3 2 1 0
%W3D.B
%W3D.7 %W3D.6 %W3D.5 %W3D.4 %W3D.3 %W3D.2 %W3D.1 %W3D.0
3 - 78 en-938846/8
Variables
The PLC can dynamically reduce the maximum current selectively for each digital servo-drive.
RDUC _ TRQ00
%WE00.B
3
RDUC _ TRQ31
%WE1F.B
For the digital servo-drive at address xx (xx between 00 and 31), the control word format is as follows:
xx 11 12 13 14 15 16 17 18 19 20 21
yy 36 38 3A 3C 3E 40 42 44 46 48 4A
zz 37 39 3B 3D 3F 41 43 45 47 49 4B
xx 22 23 24 25 26 27 28 29 30 31
yy 4C 4E 50 52 54 56 58 5A 5C 5E
zz 4D 4F 51 53 55 57 59 5B 5D 5F
en-938846/8 3 - 79
3.11.5 Inputs from Axis Groups
In this chart, g takes on the value of the axis group number (1 to 8)
E_ E_ E_ E_
M01g SLASHg INTERg PROGg %Rg00.B
%Rg00.7 %Rg00.6 %Rg00.5 %Rg00.4 %Rg00.3 %Rg00.2 %Rg00.1 %Rg00.0
%Rg00.W
E_ E_ N_ E_DG E_ E_ E_ E_ Group 1 to 8 status
OPERg DEFg POSg URGg RAXg CYCLg ARUSg RAZg %Rg01.B
%Rg01.7 %Rg01.6 %Rg01.5 %Rg01.4 %Rg01.3 %Rg01.2 %Rg01.1 %Rg01.0
NUMCYC1 to NUMCYC8
%Rg02.B
Current machining cycle number on groups 1 to 8
MODCOUR1 to MODCOUR8
%Rg06.B Current mode on groups 1 to 8
%Rg07.B
MCODCR1 to MCODCR8
%Rg1E.B
%Rg1E.W
MCODCR1 to MCODCR8 Encoded M functions with report on groups 1 to 8
%Rg1F.B
3 - 80 en-938846/8
Variables
OUTIL1 to OUTIL8
%Rg7D.B
3
%Rg7C.L
OUTIL1 to OUTIL8 Tool number requested by groups 1 to 8
%Rg7E.B
OUTIL1 to OUTIL8
%Rg7F.B
*C_ C_ C_ C_
MODEg FASTg CRMg APPSSg ARBUTg VALIDg FMEXTg AUTAVg
%Wg00.B
%Wg00.7 %Wg00.6 %Wg00.5 %Wg00.4 %Wg00.3 %Wg00.2 %Wg00.1 %Wg00.0
%Wg00.W Control of groups 1 to 8
**C_ **C_ C_DG **C_ C_ **C_ C_
M01g SLASHg URGg RAXg CYCLg ARUSg RAZg
%Wg01.B
%Wg01.7 %Wg01.6 %Wg01.5 %Wg01.4 %Wg01.3 %Wg01.2 %Wg01.1 %Wg01.0
POTAV1 to POTAV8
%Wg02.B Feed rate override potentiometer on groups 1 to 8
* Valid only for PLC axis groups
** Valid only for CNC axis groups
MOD-GR1 to MOD-GR8
%Wg03.B Mode on independent group 1 to 8
en-938846/8 3 - 81
3 - 82 en-938846/8
Literal Elements of Ladder Language
en-938846/5 4-1
4-2 en-938846/5
Literal Elements of Ladder Language
Character Function
[] At most one element between square brackets can be chosen
<> Surround nonterminal elements of the language
{}n At most n elements between parentheses can be chosen.
REMARK An element not surrounded by < and > is a terminal symbol, a keyword or a
separator. 4
4.2 Label - Comment
4.3 Step
REMARK The evaluation of <bit_variable> and <comparison> supplies a Boolean result [1|0].
en-938846/5 4-3
4.4.2 Literal Entities Authorised in the Action Area of a Ladder
4-4 en-938846/5
Literal Elements of Ladder Language
The binary and comparison operators have higher priority than the assignment operators.
en-938846/5 4-5
4.5.2 Comparison Operators
Comparisons are signed, i.e. the variable MSB is considered as sign bit (variables whose sign bit is set are lower than
variables whose sign bit is a zero).
0
Padding with zeros
REMARKS Allows divisions by powers of 2 more rapidly than with the «/» operator:
/ (Var_ 1 / 2n == Var_ 1 >> n).
Allows multiplications by powers of 2 more rapidly than with the «*» operator: /
(Var_ 1 * 2n == Var_ 1 << n).
4.5.4 Assignment Operators
Assignment operators have the lowest priority. Assignment is therefore carried out last.
4.5.4.1 Operator =
Simple assignment loads the variable on the left with the result of the numerical expression or function on the right of
assignment operator =.
These operators combine an operation between the variable on the left and the results of the expression on the right
followed by assignment of the final result in the variable on the left.
Examples:
4-6 en-938846/5
Literal Elements of Ladder Language
In an expression, the highest priority operations are executed before the lower priority operations.
Operations with the same priority are executed from left to right.
Brackets are used to modify the order of evaluation of the expressions by forcing evaluation of the expression in
brackets first.
Type Value
Negative hexadecimal integer from -2147483648 to -1
Negative hexadecimal integer from 0x80000000 to 0xFFFFFFFF
Positive decimal integer from 0 to 2147483647
Positive hexadecimal integer from 0x0 to 0x7FFFFFFF
Byte Variables
Bit 7 is the sign bit. -128 <= byte value <= +127.
Word Variables
Bit 15 is the sign bit. -32768 <= word value <= +32767.
Bit 31 is the sign bit. -2147483648 (-231) <= long word value <= +2147483647 (231 -1).
Operation
When a variable is used in a calculation, it is first loaded into a microprocessor register.
If the variable loaded is a byte, the system propagates bit 7 of the register onto bits 8 to 31.
If the variable loaded is a word, the system propagates bit 15 of the register onto bits 16 to 31.
The calculations are then made with the 32-bit registers and generate a result on 32 bits.
The result is then loaded in the destination variable:
- if the destination variable is a long word, the 32 bits of the result register are loaded into it,
- if the destination variable is a word, the 16 LSBs of the result register are loaded into it,
- if the destination variable is a byte, the 8 LSBs of the result register are loaded into it.
en-938846/5 4-7
Pitfall to be Avoided
Comparisons between variables (bytes and signed words) and immediate values are a frequent source of errors.
Example
Var.B == 128.
Var.B 1 0 0 0 0 0 0 0
==
128 Immediate value
D0 ! = D1
The equality can be achieved using a mask and writing Var.B & OxFF == 128.
Var.B 1 0 0 0 0 0 0 0
&
0xFF 1 1 1 1 1 1 1 1
==
128 Immediate value
4-8 en-938846/5
Literal Elements of Ladder Language
The system does not perform overflow control. It is therefore up to the programmer to take the necessary precautions.
%M100.B and %M101.B are two byte variables both equal to 0x7F (i.e. +127).
The assignment: %Var.xx = %M100.B + %M101.B gives:
%M100.B (0x7F) 0 1 1 1 1 1 1 1
+
0 1 1 1 1 1 1 1
%M101.B (0x7F)
== 4
Var.xx
Propagation of register bit 7
Var.B is loaded with 0x00FE. Since bit 7 (sign bit) is a 1, Var.B == -2 (wrong answer) 1 1 1 1 1 1 1 0
Comparisons:
- %M5.B + %V33.L == %M10.W,
- (Var_1 << 4 ^ 0x3) << %M10.B >= -( (Var_6 & 0xF5) + ( Var_3 & %M5.W))
- %I900.W & 1 << %V100.B != 0 // Test of bit %V100.B of %I900.W (see Sec. 5.2.7.4).
Numerical Assignments:
- %M5.B = %M33.L - %M10.W,
- Var_1 = -%M10.B + ~( 0xF5 - (Var_3 << %M5.W)),
- Remainder = Dividend - Dividend/Divisor*Divisor//calculation of the remainder of an integer division.
en-938846/5 4-9
Valid Function Calls:
- Var_1.L = printf(STRING_1, %M45.W << 4, %M100.L, (Var_4 & 0x33) + %M200.W),
- printf( %M250.L, %M45.W << 4, %M100.L, (Var_4 & 0x33) + %M200.W).
An overrun is indicated during compilation by the message «Error Maximum no. of data registers».
Example:
The numerical expression: Var_1 | Var_2 ^ Var_3 >> 8 + Var_4 * Var_5 which generates the following stack is rejected
by the compiler because it requires more than five registers for its evaluation.
Var_1 register 1
Var_2 register 2
Var_3 register 3
8 register 4
Var_4 register 5
Var_5 register 6 *error, more than 5 registers
* register 5
+ register 4
>> register 3
^ register 2
| register 1
The above expression can be evaluated by reorganising it. The equivalent expression Var_3 >> Var_5 * Var_4 + 8
^ Var_2 | Var_1 which generates the following stack is accepted by the compiler.
Var_3 register 1
Var_5 register 2
Var_4 register 3
* register 2
8 register 3
+ register 2
>> register 1
Var_2 register 2
^ register 1
Var_1 register 2
| register 1
4 - 10 en-938846/5
Programming in Ladder Language
en-938846/3 5-1
5-2 en-938846/3
Programming in Ladder Language
Sequences such as tables of constants, character strings and networks have a common header including:
- an optional sequence identifier called a label (see Sec. 4.2),
- an optional comment (see Sec. 4.2),
- an optional grafcet step (see Sec. 4.3).
Grafcet steps increase the speed of execution of a programme because inactive sequences are not executed. Grafcet
steps are used to specify the software using a grafcet methodology.
If it not possible to programme all the actions of a grafcet step in the same sequence, the programmer can write as
many sequences as he desires with the same step number.
5
5.1.2.1 General
When a sequence with a grafcet step is active, the system executes it like a sequence without a step.
%M2.W == 5 ? NO
(System test)
YES
en-938846/3 5-3
5.1.2.3 Activation/Deactivation of Grafcet Steps
Sequences with grafcet steps are activated (deactivated) from the user programme by loading the <step_variable>
with the integer corresponding to the sequence(s) to be activated.
Step 0
Wait on A
%M1.W == 0
Step 1
%M1.W == 1 Movement from A to B
Switch B reached
Step 2
%M1.W == 2 Movement from B to C
Switch C reached
Step 3
Movement from C to A
%M1.W == 3
Switch A reached
5-4 en-938846/3
Programming in Ladder Language
en-938846/3 5-5
5-6 en-938846/3
Programming in Ladder Language
5.2.2.1 General
5.2.2.2 Contacts
<bit variable>{,<bit variable>}7 Test for a ONE state of a list of bit variables.
—] [— IF all the bits are ONE, input rung = output rung.
ELSE, the output rung is reset.
<bit variable>{<bit variable>}7 Test for ZERO state of a list of bit variables.
—] / [— IF all the bits are ZERO, output rung = input rung.
ELSE, the output rung is reset.
<bit variable> Detects the rising edge of the input rung (RISING TRIG).
— R_T — Used to store the state of the input rung.
IF the input rung is a ONE and <bit variable> is a ZERO, the output
rung is set to ONE.
ELSE, the output rung is set to ZERO.
<bit variable> = input rung (storage of the input rung).
en-938846/3 5-7
Contact type Description
<bit variable> Detects the falling edge of the input rung (FALLING TRIG).
— F_T — Used to store the state of the input rung.
IF the input rung is a ZERO and <bit variable> is a ONE, the output
rung is set to ONE.
ELSE, the output rung is set to ZERO.
<bit variable> = input rung (storage of the input rung).
Else Output = 0
Else Output = 0
5-8 en-938846/3
Programming in Ladder Language
Example
en-938846/3 5-9
Example
5.2.2.4 Timeouts
5 - 10 en-938846/7
Programming in Ladder Language
E 0
Threshold Threshold
Q
%TQxx.7
Threshold
%Txx.L
5
On Timeout «TON_n»
E 0
Threshold Threshold
Q
%TQxx.7
Threshold
%Txx.L
E 0
Threshold
Q
%TQxx.7
Threshold
%Txx.L
en-938846/3 5 - 11
Example
5.2.2.5 Up/Downcounters
REMARK The up/down counters are reset only by a reset of the saved variables.
Timeout type Description
CTU_n(<threshold>) Upcounter (n = 00 to 7F)
E Q Setting of E sets output Q as soon as the threshold is reached.
Reset of E resets output Q. C defines the elements to be upcounted.
The threshold argument is a numerical expression.
C
CTU_n(<threshold>) Downcounter (n = 00 to 7F)
E Q Setting of E sets output Q as soon as the threshold is reached.
Reset of E resets output Q. C defines the elements to be
downcounted. The threshold argument is a numerical expression.
C
5 - 12 en-938846/7
Programming in Ladder Language
Upcounters
E 0
Q
%CQxx.7
Threshold 5
%Cxx.L
Downcounters
E 0
Q
%CQxx.7
Threshold
%Cxx.L
en-938846/8 5 - 13
Example
5.2.2.6 Branches
The test zone is scanned from top to bottom and from left to right.
On a rung, the potential propagates from left to right and never from right to left (contrary to a circuit diagram where
propagation can be in both directions).
5 - 14 en-938846/3
Programming in Ladder Language
5.2.3.1 General
ACTIONS
The six rungs can initiate six actions of the following types:
<bit_variable> Set the bit to the inverse logic state of the rung.
—( / )—
<bit_variable> If the rung is TRUE, set the bit. Else go to the next action.
—( S )—
<bit_variable> If the rung is TRUE, reset the bit. Else go to the next action.
—( R )—
<numerical_assignment>{;<numerical_assignment>}7
<function_call>goto(<label>) If the rung is TRUE, execute:
call(<label>)return(...). - a numerical assignment e.g. %M10.B = %V34+3
—( T )— - a function call e.g. setb (%M100.&, 0, 100)
- a jump to an internal label in the module e.g. goto (END)
- call to an internal label in the module e.g. call (COPY)
- a return to the calling module or call e.g. return (%M10.B)
Else go to the next action.
<numerical_assignment>{;<numerical_assignment>}7
<function_call>goto(<label>) If the rung is FALSE, then execute:
call(<label>)return(...). - a numerical assignment e.g. %M10.B = %V34+3
--( F )-- - a function call e.g. setb (%M100.&, 0, 100)
- a jump to an internal label in the module e.g. goto (END)
- call to an internal label in the module e.g. call (COPY)
- a return to the calling module or call e.g. return (%M10.B)
Else go to the next action.
REMARK Subroutines external to the module (e.g. %SP30) are called by function sp(....).
en-938846/3 5 - 15
5.2.4 Execution of an Action Zone
The action zone is executed after the test zone from top to bottom (rung 0 to rung 5).
! CAUTION
An action is always executed after complete analysis of the test zone. The change of state
of a variable in an action zone is not seen until the next sequence.
Previous
component
%Mxx.W
No
Yes
Next
component
5 - 16 en-938846/3
Programming in Ladder Language
In the example below, the system reads numerical comparison «Var_3 == 100» before writing «Var_3 = 100» in the
action zone if the conditions of the first rung are satisfied. Write of «Var_3 = 100» and execution of the second rung
are offset by one PLC cycle.
It is therefore important to make sure the scanning order does not affect execution of a programme whose instructions
must be executed during the same PLC cycle.
en-938846/3 5 - 17
5.2.5 Rules for Constructing a Ladder Network
Valid Network
5 - 18 en-938846/3
Programming in Ladder Language
en-938846/3 5 - 19
Search for Tools in a Store
The above sequence determines the direction of rotation and number of steps required to get the tool in the «Finish»
(finish) compartment from the «Start»compartment in a tool carousel with a number of compartments equal to
«Comp_num».
The absolute value of «Rotation» indicates the number of steps of the rotation and the sign of «Rotation» indicates
the direction.
The following sequence uses the qcktool() function to solve this problem.
5 - 20 en-938846/3
Programming in Ladder Language
To optimise the ladder network for code size and speed, it is necessary to minimise:
- the number of contacts,
- the number of branches (vertical bars).
Unoptimised Network
en-938846/3 5 - 21
5.2.7.2 Bit List in the Test Zone
Bit lists are used to optimise the size and speed of networks.
The flowchart below shows the principle of bit list processing by the system. Whenever a bit is false, the system skips
the next bit tests.
No Bit 1
true
Yes
No Bit 2
true
Yes
Bit n Yes
true
Non
Output rung = 0
5 - 22 en-938846/5
Programming in Ladder Language
Unoptimised Network
en-938846/3 5 - 23
5.2.7.3 Multiple Numerical Assignments
Multiple numerical assignments are used to optimise the network size and speed.
Unoptimised Network
5 - 24 en-938846/3
Programming in Ladder Language
These sequences are used to test all the bits of variable %I900.W.
en-938846/3 5 - 25
Sequence 3 - Increment idex %V100.B and repeat loop if %V100.B < 16
The numerical assignment to the left of the function name is optional. It is used to recover the code returned by the
function when the programmer wishes.
The values of the parameters passed can not be checked during compilation. The monitor checks them when calling
the function, before executing it, only in the debugging mode.
5 - 26 en-938846/3
General Purpose Functions
en-938846/7 6-1
6.35 Change Tool Wear Offset tooldyn 6 - 30
6.36 Read n Variables E42000 R_E42000 6 - 31
6.37 Write n Variables E42000 W_E42000 6 - 32
6.38 Initialise the Base Associated with the %Y Variables y_init 6 - 33
6-2 en-938846/7
General Purpose Functions
atoi(&source)
Operation
Function atoi() reads the decimal digits from left to right.
Leading spaces and tab characters are ignored.
A sign (+ or -) can be specified to obtain a signed result.
Conversion is stopped when a ZERO byte or a character other than a decimal digit is detected.
In case of overflow, atoi returns the maximum positive value of a signed integer on 32 bits, i.e. 0x7FFFFFFF.
Return code
6
If OK
Signed integer on 32 bits resulting from the conversion.
Error
0x7FFFFFFF: Overflow of conversion of a signed integer on 32 bits.
en-938846/7 6-3
6.2 Convert an ASCII String to a Signed Integer of 32 Bits atoj
Syntax
atoj(&&end, &source)
&&end: Address of the long word (%M or %V) to be loaded with the address
of the character on which conversion was stopped.
&source: Address of the ASCII string to be converted.
Returns a signed integer on 32 bits resulting from conversion of the ASCII string.
Operation
Conversion is stopped when a ZERO byte or a character other than a decimal digit is detected.
This function operates in the same way as atoi(). Function atoj() loads address &&end with the address of the character
on which conversion was stopped or zero if the end of the string was reached.
In case of overflow, atoj() returns the maximum positive value of a signed integer on 32 bits, i.e. 0x7FFFFFFF.
The long word at address &&end is loaded with:
- 0 if conversion was stopped on a ZERO byte at the end of the string,
- the address of the (nonzero) character on which conversion was stopped,
- -1 in case of overflow.
Return code
If OK
Signed integer on 32 bits resulting from the conversion
Error
0x7FFFFFFF: Overflow of conversion of a signed integer on 32 bits.
6-4 en-938846/7
General Purpose Functions
bdc_bin (BCD_code)
Operation
The operand, considered as signed, is extended on 32 bits before being placed in the stack. Conversion can only be
performed on an operand in which each half-byte does not exceed the value 9 (in BCD code). If an error is detected,
the function returns -1.
Example:
%V0L.= bcd_bin(%V4.L)
%V4.L contains the value 12345678 in BCD code.
Memory representation of %V4.L: 0001-0010-0011-0100-0101-0110-0111-1000
6
1 2 3 4 5 6 7 8
12345678 = = 0xBC614E
Memory representation of %V0.L: 0000-0000-1011-1100-0110-0001-0100-1110
0 0 B C 6 1 4 E
! CAUTION
When the BCD operand is on 8 or 16 bits and the last half-byte is > 8, it is necessary to
mask the parameter with the value 0xFF or 0xFFFF so as not to propagate the sign bit.
Example: bcd_bin(%V0.B & 0xFF) ; bcd_bin(%V0.W & 0xFFFF)
Return Code
If OK
Conversion result
Error
-1: operand not in BCD code, one of the half-bytes > 9.
en-938846/7 6-5
6.4 Binary —> BCD Code Conversion bin_bcd
Syntax
bin_bcd(binary_code)
Operation
The operand considered as signed can have a width of 8, 16 or 32 bits. It is extended on 32 bits before being placed
in the stack. Conversion can only be performed on an operand between 0 and 99999999. If the operand is outside
these limits, conversion is incorrect and the function returns -1.
Examples:
%V0.W=bin_bcd(1234)
1234==0x4D2 Memory representation 0000-0100-1101-0010
0 4 D 2
%V0.W Memory representation 0001-0010-0011-0100
1 2 3 4
%V0.L=bin_bcd(12345678)
12345678==0xBC614E Memory representation 0000-0000-1011-1100-0110-0001-0100-1110
0 0 B C 6 1 4 E
%V0.L Memory representation 0001-0010-0011-0100-0101-0110-0111-1000
1 2 3 4 5 6 7 8
Return Code
If OK
Conversion result
Error
-1: Operand not between 0 and 99999999.
6-6 en-938846/7
General Purpose Functions
bit(&dest, &source, n)
Operation
Bit 0 of the byte at address &source is copied into bit 7 of the byte at address &dest; the 7 other bits are reset.
Bit 1 of the byte at address &source is copied into bit 7 of the byte at address &dest + 1; the 7 other bits are reset.
Bit 0 of the byte at address &source + 1 is copied into bit 7 of the byte at address &dest + 8; the 7 other bits are reset.
The process continues until n bytes have been separated. 6
REMARK The function oct() performs the reverse operation (see Sec. 6.13).
Example
bit(%M30, %M20.&, 3)
%M20.B 1 0 1 0 1 1 0 1
Bit 7 Bit 0
1 0 0 0 0 0 0 0 %M30.B
Bit 7 Bit 0
0 0 0 0 0 0 0 0 %M31.B
Bit 7 Bit 0
1 0 0 0 0 0 0 0 %M32.B
Bit 7 Bit 0
1 0 0 0 0 0 0 0 %M37.B
Bit 7 Bit 0
en-938846/7 6-7
Return code
If OK
Not significant
Error
-1: n negative
cpyarg(&dest, n)
&dest: Address of the memory block where the system copies the
arguments.
n: Number of arguments to be copied (maximum 6).
Copies n arguments from the stack into local memory starting at address &dest, when the module is called by sp().
Operation
Each argument occupies 32 bits.
Function cpyarg() must be called at the beginning of the %SP module before the stack is modified, such as would occur
by a call to an internal label of the module (call(<label>)).
If the number of arguments n specified is greater than the number of arguments m passed during the call, the system
does not generate an error but obviously only the first m arguments are significant.
Return code
If OK
Not significant.
Error
-1: n negative, zero or greater than maximum number authorised
6-8 en-938846/7
General Purpose Functions
cpyb(&dest, &source, n)
Direction of Transfer
To allow transfers to memory areas which overlap, the order of copying depends on the &dest and &source addresses.
- If &dest < &source, the copy is made from the beginning to the end (increasing addresses)
- If &dest > &source, the copy is made from the end to the beginning (decreasing addresses).
Example
6
cpyb(%M120.&, %M20.&, 3)
%M120.B
Bit 7 Bit 0
%M121.B
Bit 7 Bit 0
%M122.B
Bit 7 Bit 0
%M20.B
Bit 7 Bit 0
%M21.B
Bit 7 Bit 0
%M22.B
Bit 7 Bit 0
Return code
If OK
0
Error
-1: n negative or zero
en-938846/7 6-9
Programming error causing a CPU fault
Access to a prohibited address:
- &source parameter error,
- &dest parameter error,
- &source+n outside authorised area,
- &dest+n outside authorised area.
cpyw(&dest, &source, n)
Direction of Transfer
Refer to Section 6.5.
Return code
If OK
0
Error
-1: n negative or zero
6 - 10 en-938846/7
General Purpose Functions
cpyl(&dest, &source, n)
Direction of Transfer
Refer to Section 6.5.
Return code
If OK
6
0
Error
-1: n negative or zero
diagiq(period)
en-938846/7 6 - 11
Return code
If OK
0
Error
-1: Period invalid (not between 0 and 10) (the default period remains
valid).
itoa(i, &dest)
Return code
If OK
Number of characters in the string not counting the end ZERO byte.
6 - 12 en-938846/7
General Purpose Functions
Return code
If OK
Number of characters in the string not counting the end ZERO byte.
oct(&dest, &source, n)
Operation
Bit 7 of the byte at address &source is copied into bit 0 of the byte at address &dest.
Bit 7 of the byte at address &source + 1 is copied into bit 1 of the byte at address &dest.
.....
Bit 7 of the byte at address &source + 8 is copied into bit 0 of the byte at address &dest + 1.
.....
Bit 7 of the byte at address &source + (n - 1) x 8 is copied into bit 0 of the byte at address &dest + (n - 1).
.....
Bit 7 of the byte at address &source + (n - 1) x 8 + 7 is copied into bit 7 of the byte at address &dest + (n - 1).
en-938846/7 6 - 13
Example: oct(%M30.&, %M20.&,2)
%M20.B 1
Bit 7
%M21.B 0
Bit 7
%M27.B 1
Bit 7
1 x x x x x 0 1 %M30.B
Bit 7 Bit 0
%M2E.B 1
Bit 7
%M2F.B 1
Bit 7
1 1 x x x x x x %M31.B
Bit 7 Bit 0
Return code
If OK
0
Error
-1: n negative or zero
6 - 14 en-938846/7
General Purpose Functions
putkey(key_code)
Operation
Function putkey() is enabled if the panel is absent (%W5.0 = 1).
To make sure a simulated key code is accepted by the CNC, wait for the return code to become 0 after sending the
key code. This means that the key code was accepted by the CNC, but there is no way of knowing whether the code
will be processed. It is therefore recommended to apply a timeout of at least 100 ms before a new call to putkey().
REMARK The value OxAF can be set in the argument «Key_code» to call the transparent mode
directly.
6
Return code
If OK
0
Error
-1: Operator panel keyboard not disabled.
1: Buffer full, repeat the call to putkey(..)
qcktool(origin, destination, n)
en-938846/7 6 - 15
Return code
If OK
If > 0: The positive direction (increasing numbers) is the shortest. Indicates
the number of steps.
If < 0: The negative direction (decreasing numbers) is the shortest. The
absolute value indicates the number of steps.
If = 0: No movement is required because the carousel is already in the
destination position.
If = n: Outside carousel.
rchb(&source, b, step, n)
Return code
Value found
Positive number equal to the number of steps made to the first occurrence.
Positive step: Return code = (occurrence address - &source)/step
Negative step: Return code = (&source - occurrence address)/(-step)
6 - 16 en-938846/7
General Purpose Functions
rchw(&source, w, step, n)
Return code 6
Value found
Positive number equal to the number of steps made to the first occurrence.
Positive step: Return code = (occurrence address - &source)/step
Negative step: Return code = (&source - occurrence address)/(-step)
rchl(&source, l, step, n)
en-938846/7 6 - 17
The step can be positive or negative.
Positive step: The search is made by increasing addresses.
Negative step: The search is made by decreasing addresses.
Return code
Value found
Positive number equal to the number of steps made to the first occurrence.
Positive step: Return code = (occurrence address - &source)/step
Negative step: Return code = (&source - occurrence address)/(-step)
return([numerical_expression])
Operation
Returns:
- To the calling module in the case of an intermodule call with the form <variable> = sp(....). In this case, the value
of the numerical expression is recovered in <variable>.
- To the calling ladder network in the case of an intra-module call with the form call(<label>). In this case, the returned
value, if any, cannot be recovered.
! CAUTION
Return code
No code is reported by the function itself.
6 - 18 en-938846/7
General Purpose Functions
goto(<label>)
Operation
Jump to a sequence without return.
! CAUTION
Return code
No code is returned. 6
6.21 Jump to a Module Label with Return call
Syntax
call(<label>)
Operation
Jump to a sequence with return to the coil following the call() on the first return() encountered.
! CAUTION
Return code
No code is returned.
en-938846/7 6 - 19
6.22 Flag sema
Syntax
sema(&flag)
Return code
Flag State
0: The flag was free.
1: The flag was already set.
setb(&dest, b, n)
Example of Use
setb(%M120.&, %V100.B & Ox7f, 3)
%M121.B
Bit 7 Bit 0
%M122.B
Bit 7 Bit 0
6 - 20 en-938846/7
General Purpose Functions
Return code
If OK
Not significant.
Error
-1: n negative or zero
setw(&dest, w, n) 6
&dest: Destination address.
w: Value of the word to be set.
n: Number of words to be set.
Sets n words to the value w starting at address &dest.
Return code
If OK
Not significant.
Error
-1: n negative or zero
en-938846/7 6 - 21
6.25 Set One or More Long Words setl
Syntax
setl(&dest, l, n)
Return code
If OK
Not significant.
Error
-1: n negative or zero
Operation
The module number must be between 0 (call to %SP0) and 255 (call to %SP255).
The arguments are extended to 32 bits and placed on the stack. The call is then made.
The total number of arguments (including moduleno) must not exceed NBM_PARAM (set to 7).
A call to function cpyarg() at the start of the called module allows the arguments passed via the stack to be recovered.
6 - 22 en-938846/7
General Purpose Functions
Return code
If OK
Value returned by the %SP module called using function return (<numerical_expression>).
Not significant if the called module does not return a value.
Operation
The module number must be between 0 (call to %SP0) and 255 (call to %SP255).
128 %Y local variables are created in the stack. These variables are deleted on return to the calling programme.
The arguments are extended on 32 bits and stored on the stack except moduleno which is not stacked.
The total number of arguments (including moduleno) must not exceed NBM_PARAM (i.e. 7).
spy(..) and %Y variables are used to write relocatable, reentrant %SP modules.
REMARK The sample programme L_E_VAR.MCH available under PLCTOOL illustrates ins-
truction spy().
en-938846/7 6 - 23
Organisation of the %Y Variables Available in the %SP Modules Called:
%Y0.L Contains the first argument if any; else don’t care.
%Y4.L Contains the second argument if any; else don’t care.
%Y14.L Contains the last argument if any; else don’t care.
%Y18.B Rest of the local variables.
%Y7F.B Last local variable.
Code Returned
If OK
Value returned by the %SP module called using function return(<numerical_expression>).
Not significant if the called module does not return a value.
Operation
Function sprintf() is equivalent to printf() except that the formatted string is copied starting at address &dest instead
of being displayed.
For specification of the conversion formats, see function printf().
6 - 24 en-938846/7
General Purpose Functions
Return code
If OK
Number of characters written in &dest not counting the terminal ZERO byte.
Error
-1: Format string containing invalid formats.
n: Positive integer.
Returns the integer square root of n.
The calculation time is less than 60 microseconds.
Return code
If OK
Positive integer closest to the square root of n.
en-938846/7 6 - 25
Operation
Each argument &argn must be the address of a variable %M, %V, %Q or %W.
For specification of the conversion format, refer to function printf() (see Sec. 8.2.5).
Return code
If OK
Number of parameters effectively loaded.
Error
0: Unsuccessful analysis of the source string, format string containing
invalid formats.
strcmp(&string1, &string2)
Return code
If OK
n == 0 String 1 == string 2.
n>0 String 1 > string 2 (byte i of string 1 > byte i of string 2).
n<0 String 1 < string 2 (byte i of string 1 < byte i of string 2).
6 - 26 en-938846/7
General Purpose Functions
strcpy(&dest, &source)
Return code
If OK
Pointer returned to the destination.
strlen(&string)
Return code
If OK
String length.
en-938846/7 6 - 27
6.33 Swap the Even and Odd Bytes of a Word swapw
Syntax
swapw(&dest, &source, n)
Example
swapw(%M20.&, %M120.&, 3)
MSBs LSBs MSBs LSBs
%M120.W %M20.W
%M122.W %M22.W
%M124.W %M24.W
Return code
If OK
Not significant.
Error
-1: n negative or zero
6 - 28 en-938846/7
General Purpose Functions
swapl(&dest, &source, n)
Example
swapl(%M20.&, %M120.&, 3)
High byte High byte Low byte Low byte High byte High byte Low byte Low byte
MSBs LSBs MSBs LSBs MSBs LSBs MSBs LSBs
%M120.L %M20.L 6
High byte High byte Low byte Low byte High byte High byte Low byte Low byte
MSBs LSBs MSBs LSBs MSBs LSBs MSBs LSBs
%M124.L %M24.L
High byte High byte Low byte Low byte High byte High byte Low byte Low byte
MSBs LSBs MSBs LSBs MSBs LSBs MSBs LSBs
%M128.L %M28.L
Return code
If OK
Not significant.
Error
-1: n negative or zero
en-938846/7 6 - 29
6.35 Change Tool Wear Offset tooldyn
Syntax
correction: Value of the wear offset change (signed integer on 16 bits in the
internal system unit (see Parameter Manual)).
axis: Type of correction.
toolno: Tool number.
Modify a tool wear offset (the wear offsets changes are accumulated by the CNC).
Operation
It is recommended to leave at least one RTC between processing of two tooldyn(..) functions.
Axis:
Return code
If OK
0
1: Function refused - Queue saturated by a tooldyn(..) function sent
earlier and still being processed.
6 - 30 en-938846/7
General Purpose Functions
R_E42000(&dest, number, n)
Example
R_E42000(%V100.&, 120, 7)
E42120
E42121 6
E42122
%V100.B
Bit 7 Bit 0
%V101.B
Bit 7 Bit 0
%V102.B
Bit 7 Bit 0
Return code
If OK
0
Error
-1: number > 127
number+n > 128
en-938846/7 6 - 31
6.37 Write n Variables E42000 W_E42000
Syntax
W_E42000(&source, number, n)
Example
W_E42000(%M100.&, 0, 3)
%M100.B
Bit 7 Bit 0
%M101.B
Bit 7 Bit 0
%M102.B E42000
Bit 7 Bit 0
E42001
E42002
Return code
If OK
0
Error
-1: number > 127
number+n > 128
6 - 32 en-938846/7
General Purpose Functions
y_init(&y_start_address)
Operation
The %Y variables can replace any %M, %V, %I, %Q, %R and %W global variables. The programmer must initialise
the base by function y_init(..) before using the %Y variables.
The use of function y_init(..) inhibits visibility of any local variables of the %SP module. To recover visibility, proceed
as follows:
Var_1 = %Y0.& Saves the base in Var_1 (e.g.: %V100.L).
y_init(Var_2 + 100) The base points to a new variable area.
...... Use of new %Y variables.
6
y_init(Var_1) Restore the base.
...... Use of local %Y variables.
REMARK Loading of a base associated with the %Y variables by function y_init is only possible
during execution of the task (%TS, %TF, %TH or %INI) using the variables.
Example:
- If the %Y variables are used in task %TS0, function y_init must be called each time
task %TS0 is executed
- If the %Y variables are used in a looped TF background task (iterative background
task), function y_init only needs to be called once at the beginning of the task.
Example of Use of y_init(..) and %Y
en-938846/7 6 - 33
Processing of a String
%V100.L = "ABCDEF" %V100.L contains the string start address.
y_init(%V100.L) The base points to the start of the string.
%Y0.B == A %Y0.B corresponds to the first character in the string.
%Y1.B == B %Y1.B corresponds to the second character in the string.
%Y5.B == F
Return Code
Not significant.
6 - 34 en-938846/7
Task Management
7 Task Management
en-938846/7 7-1
7-2 en-938846/7
Task Management
7.1 Introduction
For further information concerning processing of the background tasks, see Section 2.1.2.3.
csbegin()
Operation
Inhibits pre-emption of the calling task by another %TS, %TH or %TF task.
Return code
Always OK
0
Operation
Authorises pre-emption of the calling task by a higher priority task. This function cancels the effects of function
csbegin().
Return code
Always OK
0
whtr(n)
n: Number of real time clock cycles during which the %TF task is on
WAIT.
Operation
Changes the calling %TF task from EXECUTING state to WAITING state for n RTCs. At the end of this time, the %TF
task goes into READY state. n must be between 0 and 255, (equivalent to 0 to 5.1 secs).
en-938846/7 7-3
Return code
If OK
0
tfstart(tf_number)
Operation
Sets the %TF task to READY state.
Return code
If OK
0
tfstop(tf_number)
Operation
Sets the %TF task to NOT READY state.
Return code
If OK
0
7-4 en-938846/7
Transparent Mode
8 Transparent Mode
en-938846/6 8-1
8.3.5 Graphic Instructions 8 - 29
8.3.5.1 Definition of the User Reference System 8 - 29
8.3.5.2 Draw in User Reference System 8 - 31
8.3.5.3 User Drawing 8 - 32
8.3.5.4 Tool Definition 8 - 33
8.3.5.5 Animation 8 - 34
8.3.5.6 No Animation 8 - 34
8.3.5.7 Screen Drawing 8 - 34
8.3.5.8 Shift Screen Origin 8 - 35
8.3.5.9 Transfer Current Point 8 - 35
8.3.5.10 Icons 8 - 36
8.3.5.11 Screen Reference System Character
String 8 - 38
8.3.5.12 User Reference System Character String 8 - 38
8.3.5.13 Filling in User Area 8 - 38
8.3.5.14 Filling in Screen Area 8 - 40
8.3.5.15 Draw Key Bar 8 - 40
8-2 en-938846/6
Transparent Mode
8.1 Introduction
The programmes in transparent mode must be executed when variable %R5.7 equals 1. This variable must be used
as a pre-condition for starting such programmes.
In transparent mode, the CNC processor does not control the operator panel screen. The machine processor can then
use the screen to display alphanumeric characters or draw graphics.
The cursor control commands, alphanumeric characters and graphic instructions are associated with hexadecimal
codes.
Keyboard simulation
Keyboard/ User (putkey function) CNC
display Send to display programme programme
control (EMIV) (see Sec. 8.2)
programme
TO KEYBOARD AND
DISPLAY
TOOL JOG
MODE
M01
{ } ALL
ESC Q W E R T Y U I O P home Pg Up
[ ] CAPS
: "
CTRL A S D F G H J K L VALID
x off ; ` `
< > ?
SHIFT Z X C V B N M SPACE end Pg Dn
/ , . /
OPERATOR PANEL
! CAUTION
Setting to transparent mode is possible only with the graphic pages including the basic
softkeys. To display these keys, it is necessary to add sending of code $8D by putkey,
which corresponds to the << key (in Tool or Jog mode).
en-938846/8 8-3
8.1.2 Exchange Variable
Variable %R0.W «CARCLAV» is used to read the key codes sent by the operator panel keyboard at the rate of one
character every 5 RTCs and process them via the user programme.
AUTOMATIC CONTROL
FUNCTION
User
programme
MODE
TOOL JOG
M01 %R0.W
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 HELP
{ } ALL
ESC Q W E R T Y U I O P home Pg Up
[ ] CAPS
: "
CTRL A S D F G H J K L VALID
x off ; ` `
< > ?
SHIFT Z X C V B N M SPACE end Pg Dn
/ , . /
KEYBOARD
If the operator panel keyboard is disabled (variable %W5.0 = 1) function putkey() can be used to simulate the operator
panel keyboard via the user programme.
CNC FUNCTION
CNC
MODE
TOOL JOG
Programme
M01
{ } ALL
ESC Q W E R T Y U I O P home Pg Up
[ ] CAPS
: "
CTRL A S D F G H J K L VALID
x off ; ` `
< > ?
SHIFT Z X C V B N M SPACE end Pg Dn
/ , . /
KEYBOARD
putkey
%W5.0 = 1
Functions putchar(), puts(), print(), printf() (see Sec. 8.2), are used to send the cursor control commands and
alphanumeric characters to the operator panel screen.
8-4 en-938846/6
Transparent Mode
All the characters are read in variable %R0.W. Function putkey() simulates only the dialogue part.
HEX 0 1 2 3 4 5 6 7 8 9 A B C D E F
CODE
0 Ctrl P SP 0 @ P ’ p 0,1 AUTO
(DLE)
1 Ctrl A Ctrl Q ! 1 A Q a q F2 MODE Shift Shift 1 SINGLE
(Xon) F2
2 Ctrl B Ctrl R ” 2 B R b r F3 Shift Shift TL COMP 10 MDI
F3
3 Ctrl C Ctrl S # 3 C S c s F4 TOOL Shift Shift 100 DRYRUN
(Xoff) F4
4 Ctrl D Ctrl T $ 4 D T d t F5 / Shift Shift 1000 SEARCH
(Block skip) F5
5 Ctrl E Ctrl U % 5 E U e u F6 HOME JOG Shift Shift 10 000 EDIT
F6 HOME
6 Ctrl F Ctrl V & 6 F V f v F7 END M01 Shift Shift WEAR+ CONT. TEST
(Optional stop) F7 END
7 Ctrl G Ctrl W ‘ 7 G W g w F8 Pg Up // Shift Shift L or X MANU
(Reset) F8 Pg Up
8 Ctrl H Ctrl X ( 8 H X h x F9 Pg Dn NU_CN Shift Shift R or Z HANDWH HOME
F9 Pg Dn
9 Ctrl I Ctrl Y ) 9 I Y i y F10 Ins/Over Shift Shift WEAR0 SHIFT
(] [) F10 Ins/Over 0.01 8
A Ctrl J Ctrl Z * : J Z j z F11 Del car Shift Del line TLSET
LF F11 0.001
B Ctrl K ESC + ; K [ k { F1 s NU_EDT MACHI Shift
Ctrl [ NING NU_EDT
▼
Do not correspond to keyboard keys. The codes are sent by the menu manager.
en-938846/6 8-5
Compact panel
HEX 0 1 2 3 4 5 6 7 8 9 A B C D E F
CODE
0 Ctrl P
1 Ctrl A Ctrl Q
2 Ctrl B Ctrl R
3 Ctrl C Ctrl S
4 Ctrl D Ctrl T
5 Ctrl E Ctrl U
6 Ctrl F Ctrl V
7 Ctrl G Ctrl W
8 Ctrl H Ctrl X
9 Ctrl I Ctrl Y
A Ctrl J Ctrl Z
LF
B Ctrl K Ctrl [
C Ctrl L Ctrl \ F13 i
D Ctrl M Ctrl ]
CR F14 i
E Ctrl N F15 i i
F Ctrl O F16 i i
REMARK These key codes are accessible by the PLC spy but simulation of these codes is
not taken into account.
8-6 en-938846/8
Transparent Mode
! CAUTION
pcur(line, column)
Operation
Positions the cursor on the line and column specified.
Return code
If OK
8
0
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Attempt to position the cursor outside the screen.
putchar(character)
Operation
Sends a character to the system screen.
REMARK If the screen saver is active, the putchar command is placed on wait. To resume
display in transparent mode, it is necessary to deactivate the screen saver by variable
%W5.7.
en-938846/7 8-7
Return code
If OK
Error
-1: Not in transparent mode, the calling task is not a %TF task.
puts(&string)
&string: Address of the ASCII string (ending with a ZERO byte) to be displayed.
Operation
Sends a string to the system screen. The system adds 0x0D9C (\n) at the end of the string.
Return code
If OK
Returns the number of characters transmitted.
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Max. buffer size (512 bytes) exceeded.
print(&source, n)
8-8 en-938846/7
Transparent Mode
Operation
Sends a buffer of bytes to the system screen (the buffer can contain graphic commands).
The display stops according to the value of n.
If n == 0: The display stops on the first ZERO byte (ZERO byte not displayed).
If n > 0: The display stops after n bytes.
Return code
If OK
Returns the number of characters transmitted.
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Max. buffer size (512 bytes) exceeded.
Operation
The format string contains displayable characters and possibly specifications for argument conversions.
Function printf() analyses the characters of the format string.
If the character is displayable, printf() copies it into a work buffer.
When printf() detects the character %, it analyses the following characters which indicate the conversion required on
the corresponding argument. The displayable characters resulting from conversion of the argument are stored in the
work buffer.
When printf() detects the end of the format string (ZERO byte), it sends the buffer to the task handling display on the
CNC screen.
en-938846/7 8-9
Format of the Conversion Specifications
%[flags][numbers][.[numbers]][|]conversion_letter
8 - 10 en-938846/6
Transparent Mode
Example 1
%V100.L = «Tool number:%5d Type:%2c%2c Time of use: %2d hours %2d minutes»
%M50.W = 255
%M52.B = 0x55 (0x55 ASCII code for t, 0x57 ASCII code for v)
%M54.B = 2
%M55.B = 57
The instruction printf(%V100.L, %M50.W, %M52.B,0x57, %M54.B, %M55.B) displays:
Tool number: 255 Type: tv Time of use: 2 hours 57 minutes
Example 2
Example 3
%V200.L = «1 - Read \n 2 - Write»
printf(%V200.L) displays
1 - Read
2 - Write
Return code
If OK
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Max. formatting buffer size (255 bytes) exceeded.
-3: Format error in the format string.
en-938846/6 8 - 11
Programming error causing a CPU fault
Access to a prohibited address:
- &format parameter error,
- end of string outside authorised area.
scano(&question, width)
Operation
The system displays the string pointed to by &question at the bottom of the screen and opens the dialogue after the
string.
If parameter &question == 0, no string is displayed.
Character entry is controlled by the system line editor.
The line editor checks that the number of characters entered is less than «width».
The line editor commands are the conventional commands of the part programme editor:
- cursor movement left and right, start and end of line,
- character insertion and deletion,
- entry is ended by the line feed key.
! CAUTION
The putchar() and printf() display functions are prohibited during a keyboard acquisition.
Return code
If OK
0
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Resource already in use (a keyboard acquisition is already in progress).
8 - 12 en-938846/7
Transparent Mode
scanu(&question, width)
Operation
Scanu() operates in the same way as scano() except that the line editor inhibits entry of characters others than decimal
digits (0, 1 ... 9).
! CAUTION
This function can only be used with the 12 line x 40 column font. Entry is on the 11th line,
with deletion of the line just above.
Return code
If OK
0
8
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Resource already in use (a keyboard acquisition is already in progress).
scans(&dest)
&dest: Address of the memory area (%M or %V) where the characters entered
from the keyboard will be stored.
Reads a keyboard entry. This function must be called after a scano()( or scanu() dialogue opening function.
en-938846/7 8 - 13
Operation
This function is used to receive the string entered at the end of an operator dialogue.
The system ends the string with a ZERO byte.
If the dialogue is still in progress (line feed key not pressed), the code 0 is returned. It is therefore necessary to call
scans() cyclically until the end of the dialogue.
Return code
If OK
0: Dialogue in progress.
n > 0: Number of characters transferred into &dest (the dialogue is finished).
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: No dialogue in progress.
scand(&lvariable)
&lvariable: Address of an .L variable (e.g. %V100.L) where the ASCII -> signed integer
conversion of the string entered from the keyboard will be loaded.
Reads and converts a decimal value entered from the keyboard. This function must be called after a scano() or scanu()
dialogue opening function.
The conversion stops on the first non-decimal character. If no decimal characters are detected, %lvariable is loaded
with 0.
Operation
This function is used to receive the value of a decimal number at the end of an operator dialogue.
If the dialogue is still in progress (line feed key not pressed), the code 0 is returned. It is therefore necessary to call
scand() cyclically until the end of the dialogue.
8 - 14 en-938846/7
Transparent Mode
Return code
If OK
0: Dialogue in progress.
1: Number successfully read and converted. The result is transferred into
variable .L pointed to by &lvariable (the dialogue is finished).
The conversion stops on the first non-decimal character.
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: No dialogue in progress.
scanx(&lvariable)
&lvariable: Address of an .L variable (e.g. %V100.L) where the ASCII -> signed integer
conversion of the string entered from the keyboard will be loaded. 8
Reads and converts a hexadecimal value entered from the keyboard. This function must be called after a scano() or
scanu() dialogue opening function.
The conversion stops on the first non-hexadecimal character. If no hexadecimal characters are detected, %lvariable
is loaded with 0.
Operation
This function is used to receive the value of a hexadecimal number at the end of an operator dialogue.
If the dialogue is still in progress (line feed key not pressed), the code 0 is returned. It is therefore necessary to call
scanx() cyclically until the end of the dialogue.
Return code
If OK
0: Dialogue in progress.
1: Number successfully read and converted. The result is transferred into
variable .L pointed to by &lvariable (the dialogue is finished).
The conversion stops on the first non-hexadecimal character.
en-938846/7 8 - 15
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: No dialogue in progress.
scanc()
Operation
This function cancels a dialogue in progress (started by function scano() or scanu()).
Return code
If OK
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: No dialogue in progress.
putimage(x, y, &image, n)
x: Start x value.
y: Start y value.
&image: Address of a graphic command buffer (0x9b...).
n: Number of bytes to be sent.
Sends a buffer containing graphic commands with prior positioning of the cursor at x,y. The display stops according
to the value of n.
8 - 16 en-938846/7
Transparent Mode
Operation
putimage() operates like print() but with prior positioning in (x, y).
putimage() is used to duplicate the same image with different (x, y) values.
If n == 0: The display stops on the first ZERO byte (ZERO byte not displayed).
If n > 0: The display stops after n bytes.
Return code
If OK
Returns the number of characters transmitted.
Error
-1: Not in transparent mode, the calling task is not a %TF task.
-2: Max. buffer size (512 bytes) exceeded, attempt to position the cursor off
the screen.
inig(..)
Description
Initialises the graphic display and defines the reference system. Programming is in pixels.
The reference system is defined as follows:
- the X axis from 0 to 502 pixels
- the Y axis from 0 to 382 pixels.
Y
502
11 lines
382
0 40 columns X
en-938846/7 8 - 17
8.3 Panel Transparent Mode
8.3.1 Use of the Panel Screen
The screen, with a definition of 640 x 480 pixels, is divided into four windows. A communication channel and a context
are associated with each window. The display manager uses all the channels and saves the contexts.
REMARK An element is displayed in the graphic space overlays the element previously
displayed, whatever its space.
8 - 18 en-938846/6
,,,,,,, ,,,,,,, , ,,,,
,,,,, ,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,, ,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,
,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
396
,,,,, ,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,, ,,,,,,, ,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
432
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
DISPLAYABLE ARES
,,,,,,,
LIMITS OF WINDOWS
,,,,,,, ,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
512
,,,,,,, ,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,,,,
,,,,,,, ,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
638
638
,,,,,,,
,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,
,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
42
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,,,,
,,,,,,, ,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,,,,
,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
en-938846/7
,,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,,,,,,
125
,,,,,,,
396 432
,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,
,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,
,,,,
,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
8 - 19
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,
Transparent Mode
,,,,,,,,,,,,,,,,,,,,,
,,,,,,, ,,
8
COL.39
16 496
COL. 0
471
470 A Line 0
A Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
89 Line 10
76
40 H Line 11
0 512
4 12 506
Character matrix: 12 X 36 B 36
MAIN WINDOW
43
42
Line 0 B
Line 1 B
13
0
4 634
08
Character matrix: 08 X 12 B 12
MESSAGE WINDOW
Figure 8.5 - Positioning of the main «window and message window spaces»
8 - 20 en-938846/6
Transparent Mode
COL. 9
16
COL. 0
471
Line 0
470 A
Line 1
A
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
89 Line 10
76
40
H Line 11
0 126
4 120
8
12
Character matrix: 12 X 36 B 36
en-938846/6 8 - 21
8.3.2 Definition of the Instructions
! CAUTION
All the instructions can be processed in the main window, the message window and the
side window.
Notation Definition
XX YY ZZ Mandatory order of the expressions
{XX YY ZZ} Expressions in any order
|XX YY ZZ| Only one of the expressions is necessary
(XX) ... Expression that can be repeated several times
[YY] Optional expression
Default value Default value for optional expressions
LF Instruction end character (hex code 0x8A)
«0» ASCII character 0 (hex code 0xB0)
8 - 22 en-938846/6
Transparent Mode
Syntax 8
0x9BDD
This instruction initialises the alphanumeric and graphic spaces and deletes the user reference system.
In the graphic space, it:
- clears the screen,
- clears saved areas,
- sets the default hexadecimal coordinate,
- sets the default decimal coordinate,
- set white as default colour.
In the alphanumeric space, it:
- selects format A,
- sets the default colour,
- inhibits display of the cursor,
- places the cursor on the first line and first column,
- sets normal video,
- selects no underlining.
en-938846/5 8 - 23
8.3.3.2 Selection of a Colour
Instruction 0x9BBD selects one colour out of the 16 available.
Syntax
0x9BBD COLOUR
Syntax
0x9B2D NUMBER
8 - 24 en-938846/6
Transparent Mode
HEX code 0 1 2 3 4 5 6 7
0 SP 0 @ P ` p
1 ! 1 A Q a q
2 CHARACTER " 2 B R b r
NOT FLASHING
3 # 3 C S c s
4 CURSOR $ 4 D T d t
FLASHING
5 CURSOR % 5 E U e u
STEADY
6 CURSOR & 6 F V f v
NOT VISIBLE
7 CHARACTER ' 7 G W g w
FLASHING
8 MOVE CURSOR ( 8 H X h x
8
RIGHT
9 MOVE CURSOR → ) 9 I Y i y
LEFT
A MOVE CURSOR ← * : J Z j z
DOWN (LF)
B MOVE + ; K [ k {
CURSOR UP
F DELETE TO FORMAT C / ? O _ o
END OF PAGE
REMARK Character codes 0x10 to 0x18 can only be used in format A in the main and side
windows. Character codes 0x19 and 0x1A can only be used in format D in the main
and side windows.
en-938846/6 8 - 25
8.3.4.2 Choice of Font Format
Selection of a new format causes:
- clearing of the previous cursor,
- display of the new cursor with the previous attributes (lit steady, flashing, not visible).
Format A
0x9D
Format B
0x9E
Format C
0x9F
8 - 26 en-938846/6
Transparent Mode
0x9BDB
Normal character
0x9BC8
Highlighted character
0x9BC9 8
Character not underlined
0x9BCA
Character underlined
0x9BCB
0x9BBD COLOUR
en-938846/6 8 - 27
8.3.4.4 Cursor Display
Cursor steady
0x85
0x86
0x88
0x89
0x8A
0x8B
Move home
0x8C
0x8D
Description
«LINE» and «COLUMN» are defined by two hex codes.
LINE Code for real position + 0x20 = Value to be programmed
COLUMN Code for real position + 0x20 = Value to be programmed
8 - 28 en-938846/6
Transparent Mode
Example
To position the cursor on LINE 2 COLUMN 34
LINE 2 (third line): 0x2 + 0x20 = 0x22
COLUMN 34 (35th column): 0x22 + 0x20 = 0x42
Command to be programmed: 0x9BBF 0x22 0x42
8.3.4.6 Deletion
The deletion instruction can be used in any space and format.
0x8E
0x8F
Clear page
0x9C
8
8.3.5 Graphic Instructions
8.3.5.1 Definition of the User Reference System
Instruction 0x9BB0 allows the user to define his own reference system and the applicable display characteristics
(colour, legend, etc.).
REMARK The limits are recomputed to obtain the same conversion factor on both axes.
Syntax
AXIS1 : NAME [SIGN] VALUE Name of the horizontal axis and value of the left limit.
NAME Name of the axis
Defined by characters «A» to «Z», upper or lower case (generally X
and Y).
SIGN Sign of the limit value.
Algebraic «+» or «-» sign.
Default value: «+».
VALUE Value of the axis limit. (Decimal value in pixels).
en-938846/6 8 - 29
AXIS2 Name of the horizontal axis and value of the right limit.
COLOUR: «C» VALUE Colour of the axes. Does not modify the current colour.
VALUE Colour code (see Sec. 8.3.3). Expressed in decimal or hexadecimal.
Default value: current colour at the time of drawing.
Examples
Y 381
502
0 X
8 - 30 en-938846/6
Transparent Mode
+191
Y
- 251 +251
0 X
-191
+96
Y
- 125 +126
0 X 8
-95
Syntax
0x9BD8
en-938846/6 8 - 31
8.3.5.3 User Drawing
Instruction 0x9BB2 is used to draw a line or an arc in the user reference system. Drawing is with or without display of
the tool (see instructions 0x9BB1, 0x9BDE, 0x9BDF).
Syntax
LINCIR : «G» | «1» «2» «3» | Defines the type of drawing (nonmodal instruction).
Default value: line drawing.
REMARK This command applies to drawing of the screen reference system (9BB6).
LINE: «M» | «1», «2», «3», «4», «5» | Characteristic of the line used for drawing (see Sec. 8.3.5.1).
STYLUS: «M» | «6» «7» «10» | Current stylus type (modal instruction).
8 - 32 en-938846/6
Transparent Mode
Syntax
en-938846/6 8 - 33
TOOL: (MOVEMENT (XY) ...) ... Definition of a tool of unspecified type.
[COLOUR]
MOVEMENT: [RAISE XY] LOWER Movement without drawing.
RAISE: «M5» Raise stylus.
XY : { X Y } Coordinates of the start point of the tool in the user reference system.
Decimal values.
X X coordinate of the point.
Y Y coordinate of the point.
LOWER: «M1» Lower the stylus.
XY Decimal coordinates of remaining points of the tool in the user
reference system.
COLOUR: «C» VALUE Colour of the tool (see Sec. 8.3.3.2).
Default value: 0xB8.
8.3.5.5 Animation
Instructions 0x9BDF and 0x9BE7 select user drawing with display of the tool. The display characteristics are defined
by instruction 0x9BB1 (see Sec. 8.3.5.4).
Syntax
0x9BDF or 0x9BE7
8.3.5.6 No Animation
Instruction 0x9BDE selects user drawing without display of the tool.
Syntax
0x9BDE
Syntax
REMARK The syntax is exactly the same as for instruction 0x9BB2 (see Sec. 8.3.5.3).
8 - 34 en-938846/6
Transparent Mode
REMARK The other limit is recomputed so as not to modify the size of the reference system.
Syntax
Example
To shift the origin of the reference system by 100 pixels on the X axis and 200 pixels on the Y axis
0x9BB7 X100 Y200 (LF)
Syntax
0x9BE4
en-938846/6 8 - 35
8.3.5.10 Icons
Instruction 0x9BB4 is used to draw an icon (symbol) of constant or parameterisable dimension in a reference frame
oriented like the user reference frame whose origin is the user current point.
Syntax
Example
! CAUTION
Before drawing icons, it is necessary to define the user reference system (Command
0x9BB0 or function inig(..)).
8 - 36 en-938846/6
Transparent Mode
P0
P1 P2
P2
P0 P1 P1
P2
P0 P1
P2 P0 P0
P1
N1 N2 N3 N4 N5
P0 P2
P3
P3
P3 P1 P0 P2 P1
P3
P2 P0
P1 P1
P1 P0 P0
P2
N6 N7 N8 N9 N10
P1
P0 P0
P0
P0
P1 P2
P2 P1
P1 P0
P1
P2
P2
N11 N12 N13 N14 N16
P1
P0
P0
P0 P1
PD
P1
8
P1
PA
P0
P1 PD = PA P1 P1 P1
P0
P1 P0
P2
P0
PD: Starting point
PA: End point
N38 P2 N39
P1
en-938846/7 8 - 37
8.3.5.11 Screen Reference System Character String
Instruction 0x9BA8 is used to display an alphanumeric character string from the current point of the screen.
Syntax
Syntax
Syntax
8 - 38 en-938846/6
Transparent Mode
! CAUTION
CLIP : | «G» «D» «H» «B» | [VALUE] Selection of the «clipping» limits.
Default value: No clipping.
REMARK The colours are encoded on four bits. A component of the colour selected is a colour
for which the same bits are set as for the colour selected (e.g. If the colour selected
is Yellow «c5» (i.e. 0101 binary), the components of the colour are black (i.e. 0111
binary), orange (i.e. 1101 binary) and light grey/white (i.e. 1111 binary)).
Example
en-938846/6 8 - 39
8.3.5.14 Filling in Screen Area
Instructions 0x9BAB and 0x9BAC are used to fill in an area of the screen reference system.
Syntax
REMARK The syntax is exactly the same as for command 9BA9 (see Sec. 8.3.5.13). The
coordinates are in the screen reference system.
8.3.5.15 Draw Key Bar
Instruction 0x9BBC is used to separate the window vertically into ten fields.
Syntax
0x9BBC LF
REMARK Although this instruction can be used in all the windows, it is only meaningful in the
softkey message window.
8 - 40 en-938846/7
Analogue Inputs/Outputs
9 Analogue Inputs/Outputs
en-938846/3 9-1
9-2 en-938846/3
Analogue Inputs/Outputs
9.1 General
A maximum of 18 DACs and 20 ADCs are available on NUM 1060 systems. The analogue inputs and outputs are
accessible to the user programme, part programme and dynamic operators. They are distributed as follows:
Rate of variation
The analogue inputs and outputs are signed values on 16 bits. The rate of variation for these values is:
- for positive values:
from 0 --> 0x7FFF
for 0 --> n volts (where n is the full scale value)
- for negative values:
from 0xFFFF --> 0x8000
for 0 --> n volts (where n is the full scale value).
This is true regardless of the resolution of the ADC or DAC (8 or 12 bits).
The full scale value depends on the characteristics of the card used (see Installation and Commissioning Manual).
The accuracy depends on the DAC or ADC format (8 bits, 8 bits + sign or 12 bits + sign).
anas(cch, wconfig)
Operation
This function is used to configure the number of analogue inputs used (1 or 8) and the gain of each input (1 or 10).
The internal refresh period of each analogue input is 1.36 ms when all the 8 inputs are configured and 0.170 ms when
only one input is configured (input 0).
This function is optional. At system initialisation, the cards are configured with 8 inputs and a gain of 1.
REMARK This function concerns only the analogue inputs and outputs on the additional cards.
en-938846/8 9-3
Detail of argument «cch»
Bit 7 Bit 0
Refer to the Installation and Commissioning Manual for the card location on the system bus.
The values 0 to 7 correspond to the channel numbers of the eight input registers or eight output registers.
Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Configuration (1 or 8 inputs)
0 = 1 input
1 = 8 inputs
Gain of analogue input 7
0 = gain of 1
1 = gain of 10
Gain of analogue input 6
0 = gain of 1
1 = gain of 10
Gain of analogue input 5
0 = gain of 1
1 = gain of 10
Gain of analogue input 4
0 = gain of 1
1 = gain of 10
Gain of analogue input 3
0 = gain of 1
1 = gain of 10
Gain of analogue input 2
0 = gain of 1
1 = gain of 10
Gain of analogue input 1
0 = gain of 1
1 = gain of 10
Gain of analogue input 0
0 = gain of 1
1 = gain of 10
Return code
If OK
0
Error
1: Card absent.
2: Card parameter error.
9-4 en-938846/7
Analogue Inputs/Outputs
anao(cch, woutput)
Operation
Writes DAC channel ch of card c.
Bit 7 Bit 0
Refer to the Installation and Commissioning Manual for the card location on the system bus.
The values 0 to 7 correspond to the channel numbers of the eight input registers or eight output registers.
Return code
If OK
0
Error
1: Card absent.
2: Card parameter error.
3: Channel parameter error.
en-938846/7 9-5
9.4 Read an Analogue Input anai
Syntax
anai(cch, &winput)
Operation
Reads an analogue input.
Card location Channel number
Bit 7 Bit 0
Refer to the Installation and Commissioning Manual for the card location on the system bus.
The values 0 to 7 correspond to the channel numbers of the eight input registers or eight output registers.
Example
anai(0x37, %V100.&) Reads input 7 from card 3 and loads the result into %V100.W.
Return code
If OK
0
Error
1: Card absent.
2: Card parameter error.
3: Channel parameter error.
9-6 en-938846/7
Analogue Inputs/Outputs
anaa(initial_cch, future_cch)
initial_cch: Byte containing the card No. (the channel number is not significant).
future_cch: Byte containing the card No. (the channel number is not significant).
Operation
Reassigns an analogue card.
This function is optional. It is used to reassign functions anas(initial_cch, ...), anao(initial_cch, ...), anai(initial_cch, ...)
to card future_cch.
! CAUTION
Bit 7 Bit 0
Refer to the Installation and Commissioning Manual for the card location on the system bus.
The values 0 to 7 correspond to the channel numbers of the eight input registers or eight output registers.
Return code 9
If OK
0
Error
1: Final card absent.
2: Card parameter error.
4: Function called in a task other than an %INI task.
en-938846/7 9-7
9-8 en-938846/3
Explicit Read/Write of Input/Output Cards
10.1 General 10 - 3
10.2 Explicit Read of an Input Card read_i 10 - 3
10.3 Explicit Write to an Output Card write_q 10 - 4
10
en-938846/3 10 - 1
10 - 2 en-938846/3
Explicit Read/Write of Input/Output Cards
10.1 General
The programmer can directly access the inputs/outputs on the serial bus (SB) without waiting for them to be refreshed
by the PLC monitor.
REMARK This function must be reserved for high priority cases, since it is costly in CPU time.
read_i(rcmch, n)
Operation
The system checks the coherence of parameters rcmch and n.
The system immediately reads card rc and updates image area %Ircmch to %Ircmch+n.
Bit 15 Bit 0
en-938846/3 10 - 3
Return code
If OK
0: Read OK.
Error
1: The variables requested exceed the card limits. The exchange does
take place after truncating to the limits authorised by the card.
2: Request to access an absent card.
3: Parameter rcmch outside the limits.
-1: Bus exchange error. The exchange does take place.
write_q(rcmch, n)
Operation
The system checks the coherence of parameters rcmch and n.
The system immediately writes image area %Qrcmch to %Qrcmch+n in card rc.
Bit 15 Bit 0
! CAUTION
This instruction causes rapid write of the outputs selected provided they were previously
written.
10 - 4 en-938846/7
Explicit Read/Write of Input/Output Cards
Examples:
%QB04.B=0xAA
write_q(0xb04, 1) Causes immediate write of 0xAA in %Qb04.B
%QB04.W=0xAAFC
write_q(0xb04, 2) Causes immediate write of 0xAAFC in %Qb04.W
%QB04.L=0xAAFC0000
write_q(0xb04, 8) Causes immediate write of 0xAAFC0000 in %Qb04.L and %Qb08.L.
Return code
If OK
0: Read OK.
Error
1: The variables requested exceed the card limit. The exchange does
take place after truncating to the limits authorised by the card.
2: Request to access an absent card.
3: Parameter rcmch outside the limits.
-1: Bus exchange error. The exchange does take place.
10
en-938846/7 10 - 5
10 - 6 en-938846/3
Interrupt Inputs
11 Interrupt Inputs
11.1 General 11 - 3
11.1.1 On-the-Fly Dimension Measurement 11 - 3
11.1.2 Interrupts Assigned to a %TH Hardware
Task 11 - 3
11.2 Principle of Line Assignment 11 - 5
11.3 Associate an Interrupt Input with Axis Groups iti_gr 11 - 5
11.4 Configure an Interrupt Input itictl 11 - 6
11.5 Read an Interrupt Input itiget 11 - 8
11.6 Associate a %TH Task with an IT Input thiti 11 - 9
11
en-938846/3 11 - 1
11 - 2 en-938846/3
Interrupt Inputs
11.1 General
The automatic control function processes priority interrupts on lines:
REMARKS With multiple axis groups, if two interrupts arrive at the same time, the interrupt
assigned to line iti0 has the highest priority and that assigned to itiB has the lowest.
If an interrupt assigned to axis group 1 arrives at the same time as an interrupt
assigned to axis group 8 on the same line, the interrupt assigned to group 1 is
processed first by the monitor.
11.1.2 Interrupts Assigned to a %TH Hardware Task
The assignment of a line iti0 to itiB to a hardware task causes execution of the interrupt routine programmed in the
%TH task.
! CAUTION
11
If a hardware task and a gauging task are assigned and programmed on the same line, the
hardware task is suspended during dimension measurement by the monitor.
en-938846/3 11 - 3
MACHINE
GAUGE PROCESSOR AUTOMATIC
CONTROL
FUNCTION
CNC PART
iti0 to iti3 MONITOR
Halt
FUNCTION PROGRAMME
Def
I
System %
T
. task
E
X
T
Instructs the CNC processor
G10
to refresh parameters E7 x 001
C
A
N
/
C
N
A
TIMER
S
E
R
I
E USER
TTL
PROGRAMME
TS0
iti_gr(..)
RS 232C
Proc Mach
CYCLIC TASKS
Halt
Def . %TS0 to %TS4
. %TF0 to %TF15
I
T . %SP0 to %SP255
.
E
IT n
X
T
TH.n
iti0 to iti3
C
A
N
/
C
N
A IT n + 1
TIMER
S
E
R
I
E
TH.n+2
TTL
RS 232C
Proc Mach
11 - 4 en-938846/3
Interrupt Inputs
Operation
An interrupt on the input causes the monitor to read all the axis couplers for the axes in the groups declared. The
monitor then indicates an axis read to the CNC processor for each axis group.
en-938846/7 11 - 5
Detail of the «group» argument
Group 8
Group 7
Group 6
Group 5
Group 4
Group 3
Group 2
Group 1
Bit = 0: group disabled
Bit = 1: group enabled
Bit 7 Bit 0
Return code
If OK
0
Error
-1: n_iti not between 0 and 0xB
itictl(itino, iti_config)
Operation
The component configuration code on 8 bits is transmitted in parameter iti_config.
After detection of the change of state, the machine processor waits for the signal to settle before acting on the change
of state.
The possibilities for filtering selection are independent of the active edge.
The filtering time corresponds to the settling time before action.
The filtering time can be parameterised with the following values:
- 0.5 ms
- 1 ms
- 4 ms
- 8 ms
- 1 to 3 ms for a fast cycle (without filtering).
11 - 6 en-938846/7
Interrupt Inputs
Example
Filtering on rising edge T1 and falling edge T2
Stable state
for T1
Stable state
for T2
INPUT
T1 T2
OUTPUT
Bit 7 Bit 0
Active edge
Rising = 0
Falling = 1
Filter time
on falling edge
Filter time
on rising edge
11
Bit 4 bit 3 Bit 1 bit 0
0 0 0.5 ms 0 0 0.5 ms
0 1 1 ms 0 1 1 ms
1 0 4 ms 1 0 4 ms
1 1 8 ms 1 1 8 ms
Return code
If OK
0
en-938846/7 11 - 7
11.5 Read an Interrupt Input itiget
Syntax
itiget(itino)
Operation
itiget() returns the interrupt input status register contents.
This parameter is updated by the monitor each RTC cycle. The maximum delay with respect to the real state of the
line is 20 ms.
Bit 7 Bit 0
The call to itiget() resets bit 0 of the register (record of the occurrence of an IT).
Return code
If OK
Input status register.
Error
-1: n_iti not between 0 and 0xB
11 - 8 en-938846/7
Interrupt Inputs
thiti(thno, itino)
Operation
When the IT input causes a hardware interrupt, the system calls the associated %TH task.
Return code
If OK
0
11
en-938846/7 11 - 9
11 - 10 en-938846/3
Serial Lines
12 Serial Lines
12.1 General 12 - 3
12.2 Select Data Rate and Format comf 12 - 4
12.3 Send a Buffer comout 12 - 6
12.4 Reception of a Buffer comin 12 - 7
12.5 Read the Status of a Serial Line comreg 12 - 10
12.6 Control the Serial Line Driver comctl 12 - 11
12.7 Transmission Standards 12 - 12
12.7.1 Before Software Index F 12 - 12
12.7.1.1 No Flow Control 12 - 12
12.7.1.2 RTS/CTS Flow Control 12 - 12
12.7.1.3 Xon/Xoff Flow Control 12 - 12
12.7.2 RS232 Standard 12 - 12
12.7.2.1 No Flow Control 12 - 12
12.7.2.2 RTS/CTS Flow Control 12 - 12
12.7.2.3 Xon/Xoff Flow Control 12 - 13
12.7.3 RS485 Standard 12 - 13
12.7.4 RS422 Standard 12 - 13
12.7.4.1 No Flow Control 12 - 13
12.7.4.2 Xon/Xoff Flow Control 12 - 13
12
en-938846/3 12 - 1
12 - 2 en-938846/3
Serial Lines
12.1 General
The automatic control function controls 12 serial lines distributed as follows:
Line Numbering
8 4 8 4
9 5 5
9
0 2 0
A 6 6
A
1 3 1
B 7 7
B
en-938846/3 12 - 3
12.2 Select Data Rate and Format comf
Syntax
Operation
Function comf() allocates the line to the automatic control function and configures the port. Once the line has been
initialised, it cannot be allocated to another user (CNC function, etc.).
The function comf(portno, txrate, rxrate, 0) deallocates the line and makes it available for another user.
! CAUTION
The transmit and receive baud rates must always be the same.
When initialising a line on the CNC processor card (line 2 or 3), it is necessary to call
function comf() in a task %TF.
12 - 4 en-938846/3
Serial Lines
0 0 0 0 0 0
Bit 15 Bit 0
Flow control
Xon/Xoff = 0
RTS/CTS = 1
Parity
odd = 0
even = 1
Standard to be managed No parity = 0
Bit 10 Bit 9 Parity = 1
0 0 Before index F
0 1 RS232, index F Bit 4 Bit 3
1 0 RS485, index F 0 1 1 start bit, 1 stop bit
1 1 RS422, index F 1 0 1 start bit, 1.5 stop bits
1 1 1 start bit, 2 stop bits
Bit 6 Bit 5
Flow control 0 0 8 bits
Enabled = 0 0 1 7 bits
Inhibited = 1 1 0 6 bits
1 1 5 bits
If OK
0
Error
-1: «format» argument invalid
Line already allocated to a user other than the automatic control
function.
12
en-938846/8 12 - 5
12.3 Send a Buffer comout
Syntax
Operation
When this function is called, the system copies the «&buffer» buffer, starts transmission and returns to the calling
function. This function is nonblocking and transmission continues by IT until reaching the end of the buffer. Function
comreg() returns the status of the transmission in progress.
The call comout (n_port, &buffer, 0) aborts a transmission in progress if any.
Return code
If OK
0
Error
-1: n_port invalid
Line not initialised
Transmission in progress
Argument «nb» greater than 255
No full duplex with Xon/Xoff flow control.
12 - 6 en-938846/7
Serial Lines
256-CHARACTER BUFFER
LINEAR BUFFER TO BE SENT
@ %M.n
Transmission Function
to peripheral comout()
PERIPHERAL
Operation
The system manages a 236 character circular reception buffer. Function comin() is used to read all or part of the buffer.
The number of characters read is equal to the number of characters requested (nb) or the number of characters present
in the circular buffer, whichever is lower.
If the line was not already set to reception by function comctl(), the first call to comin() causes an immediate switch
to reception.
The call to comin(portno, &buffer, 0) causes a stop and initialises reception.
12
en-938846/3 12 - 7
Return code
If OK
n >= 0 Number of characters copied into &buffer.
Error
-1: n_port invalid
Line not initialised
No full duplex with Xon/Xoff flow control
256-CHARACTER RECEPTION
CIRCULAR BUFFER BUFFER
@ %M.n
Transmission to Function
machine processor comin()
RECEPTION
BUFFER
PERIPHERAL
@ %M.n +1
Function
comin()
12 - 8 en-938846/7
Serial Lines
Characters received
from a peripheral
Line
initialisation No
completed
Yes
Reception
error
No of Yes
characters = 0
No
Stop
reception
No. requested
Yes <=
No. available
No
en-938846/3 12 - 9
12.5 Read the Status of a Serial Line comreg
Syntax
comreg(portno)
Operation
Returns the general state of serial line portno.
! CAUTION
When initialising a line of the CNC processor card (line 2 or 3), it is necessary to call
function comreg() in a task %TF.
Return code
Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Transmission in progress
Transmission error
Initialisation completed
Transmission stopped (CTS = 1)
Reception in progress
Not significant
Not significant
Monitor buffer full
Image of RTS (1 --> inactive)
Image of CTS (1 --> inactive)
Image of DCD (1 --> inactive)
Image of DSR (1 --> inactive)
Format error
Parity error
Overrun error
Characters available in the buffer
monitor
12 - 10 en-938846/3
Serial Lines
comctl(portno, config)
Operation
The action depends on the flow control used and the line status at the time of the request.
Value of «config» No flow control RTS/CTS flow control Xon/Xoff flow control
No reception in progress Line switched to Line switched to Line switched to
and config == 0 reception reception and signal reception and Xon
RTS activated character sent
Reception in progress No effect Signal RTS deactivated Xoff character sent
and config == 1
Return code
If OK
0
Error
-1: Line not initialised.
No full duplex with Xon/Xoff flow control.
Request (config) incompatible with current state.
12
en-938846/7 12 - 11
12.7 Transmission Standards
The transmission standard is defined in the «format» argument of function comf() (see Sec. 12.2).
REMARK Signal RTS can be wired to CTS to ignore these signals and allow full duplex
operation without flow control.
12.7.1.3 Xon/Xoff Flow Control
During reception, the transfer is monitored by sending control characters on the transmission channel.
As soon as character DC1 (Xon) is sent by the receiver, the sender is authorised to send. When the receiver sends
character DC3 (Xoff), the sender has a time equal to transmission of 20 characters to stop transmission.
12 - 12 en-938846/3
Serial Lines
! CAUTION
The use of standard RS485 requires suitable wiring of the RS232/RS485 interface
adapters.
12
en-938846/3 12 - 13
12 - 14 en-938846/3
Timer Function
13 Timer Function
INTERNAL
CLOCK
(2.4576 MHz) Timer A IT
Predivider Downcounter
Operation
The call to thtimer() sets the timer whose number is given in timerno with the value specified in nbmillisec. When this
time has expired, the timer generates an IT used by the system to call the %TH task number thno.
The time nbmillisec is between 0 and 2,147,483,647 milliseconds.
13
Function thtimer() is modal, i.e. after the call to thtimer(), the %TH task is called cyclically every nbmillisec.
To cancel a thtimer() function, it is necessary to call thtimer() with parameter nbmillisec equal to ZERO.
The call to thtimer() while the timer is running causes a reset of the timer and a restart from nbmillisec.
en-938846/7 13 - 1
Return code
If OK
0
Error
-1: nbmillisec < 0 or > 2,147,483,647
13 - 2 en-938846/7
Date-Time Stamp Function
tmget(&date)
&date: Address of the memory block (11 bytes) where the date structure is
to be stored.
Operation
Used to read the current date.
Return code
If OK
0
Error
14
en-938846/7 14 - 1
14.3 Read the Current Date and Day in Week dtget
Syntax
dtget(&date)
&date: Address of the memory block (11 bytes) where the date structure is
to be stored.
Operation
Used to read the current date and the day in the week
Return code
If OK
0
Error
14 - 2 en-938846/7
Exchanges by Protocol
15 Exchanges by Protocol
en-938846/4 15 - 1
15 - 2 en-938846/4
Exchanges by Protocol
7
UNI-TE UNI-TE
APPLICATION
6
PRESENTATION
5
SESSION
4
TRANSPORT
3 TELEMECANIQUE
NETWORK SERIES 7 ADDRESSING
2 UNI-TELWAY, INTERNAL EXCHANGE
DATA LINK MAPWAY, ETHWAY PROTOCOL (RMG)
1 RS232, RS485, coaxial, SYSTEM BUS
PHYSICAL F/O, Twisted pair GLOBAL MEMORY
REMARK Only the DNC1000 local communication and the related requests and functions are
covered in this chapter. Refer to the UNITE Protocol Manual for communication with
remote stations and to the end of this chapter for the communication functions.
en-938846/4 15 - 3
15.1.1 General Description of the DNC1000 Protocol
DNC1000 is a local communication procedure between the automatic control function and the other system functions.
It allows transmission of data that are inaccessible via the transfer area.
Communication is between a requester (or client) and a server. It uses UNITE requests. Generally, the automatic
control function is the requester and the CNC function is the server.
The part programme can also initiate a transfer to the automatic control function (unsolicited data).
UNITE REQUESTER
(CLIENT) UNITE
SERVERS
RECEPTION OF A UNITE ANSWER
(Read/Write)
15 - 4 en-938846/4
Exchanges by Protocol
PROCESSING
REQUEST
TRANSMISSION REQUEST
ANSWER
ACQUISITION
RECEPTION ANSWER
en-938846/4 15 - 5
15.1.2.2 Concept of Port
The requester must associate each request with a port.
The same port is used for transmission of a request and reception of the answer.
Two types of port can be accessed:
- 16 ports with addresses from 0x30 to 0x3F allow the requester to send several requests in parallel,
- 8 ports with addresses from 0x10 to 0x17, associated with axis groups 1 to 8, are used to receive unsolicited data
from the part programme ($1 in the part programme).
PROCESSING
REQUEST
TRANSMISSION
REQUEST
(Port 0x30)
1
TRANSMISSION REQUEST
(Port 0x32) 2
TRANSMISSION REQUEST PORT 0x30
(Port 0x33) 3
PORT 0x32
PORT 0x33
ANSWER ACQUISITION
PORT 0x30
RECEPTION ANSWER
(PORT 0x30) 1
PORT 0x32
RECEPTION ANSWER
(PORT 0x32) 2
PORT 0x33
RECEPTION ANSWER
(PORT 0x33) 3
Message
PORTS 0x10 to 0x17 addressed to
the machine
RECEPTION "Unsolicited" processor
REQUEST ($1 or $11
(PORTS 0x10 to 0x17)
in the part
programme)
15 - 6 en-938846/4
Exchanges by Protocol
en-938846/4 15 - 7
Accessible for Object definition
Family Segment Name Size Maximum number
name No. Read Write of objects in
the family
Measured 145 X Spindles 1 long word 4 (1 per spindle)
spindle position
Tool correction 146 X X Tools 7 long words 255
15 - 8 en-938846/8
Exchanges by Protocol
Axis X
Axis Y
Axis Z
Axis U
Axis V
Axis W
Axis A
Axis B
Axis C
en-938846/4 15 - 9
Sgment Accessible for Description Value or Corresponding
No. unit parameters
(Hex)
135 Read/Write Value of the angles for inclined axes 1/10000° E69001
(0x87) Object size: 1 long word
Address of the first object in the family: 0
15 - 10 en-938846/6
Exchanges by Protocol
en-938846/4 15 - 11
Segment Accessible for Description Value or Corresponding
No. unit Parameters
(Hex)
15 - 12 en-938846/4
Exchanges by Protocol
en-938846/6 15 - 13
Segment Accessible for Description Value or Corresponding
No. unit parameters
(Hex)
Bit 7 Bit 0
Cycle time on
rising edge
Cycle time on Bit 1 Bit 0
falling edge 0 0 0.5 ms
Active edge Bit 4 Bit 3 0 1 1 ms
Rising = 0 0 0 0.5 ms 1 0 4 ms
Falling = 1 0 1 1 ms 1 1 8 ms
1 0 4 ms
1 1 8 ms
Bit 15 Bit 0
15 - 14 en-938846/6
Exchanges by Protocol
G97
G96
G95
G94
G93
G29
G54
G53
G42
G41
G40
G09
G38
G04
G03
G02
G01
G00
G22
G52
G70
G91
G90
G18
G19
G17
Bit 31 Bit 24 Bit 23 Bit 16 Bit 15 Bit 8 Bit 7 Bit 0
Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Function G78
End of external movement (Fmext)
Encoded M functions
M post-functions
Function G04
Function G09
Circle
Line
JOG
Feed stop
M pre-functions
T functions
en-938846/6 15 - 15
15.3 UNITE Requests Processed by the CNC Function
15.3.1 «READ-OBJECT» Request
Description
The READ-OBJECT request is used to read those objects accessible for read by the CNC server (See Sec. 15.2.2).
Request Format
Answer Format
Positive answer
Positive answer
code ANSWER CODE SPECIFIC
(1 byte) (1 byte)
0x66 Not significant
Data table
DATA
Negative answer
ANSWER CODE
(1 byte)
0xFD
REMARK If the quantity specified is such that the answer could contain more than 128 bytes,
the request is refused (negative acknowledgement).
15 - 16 en-938846/4
Exchanges by Protocol
Request sent
15
SEGMENT SPECIFIC
0xB5 0x00
OBJECT-ADDRESS
0x0000
QUANTITY
0x0001
DATA
0x0053 (Programme %83.)
en-938846/4 15 - 17
15.3.2 «WRITE-OBJECT» Request
Description
The WRITE-OBJECT request is used to write values to the CNC (See Sec. 15.2.2).
Request Format
Specifies write
request REQUEST CODE SENDER CATEGORY
(1 byte) (1 byte)
0x37 Not significant
Identifies the family
to which the object(s) SEGMENT No. SPECIFIC
to be written belongs (1 byte) (1 byte)
(See Sec. 15.2) Not significant
Address of the first
object in the family OBJECT-ADDRESS
(1 word)
Number of consecutive objects
to be written in the family QUANTITY
(1 word)
Data table
DATA
Answer Format
Positive answer
ANSWER CODE
(1 byte)
0xFE
Negative answer
ANSWER CODE
(1 byte)
0xFD
REMARK If the quantity specified is such that the request contains more than 128 bytes, the
request is rejected (negative acknowledgement).
15 - 18 en-938846/4
Exchanges by Protocol
byte 2 byte 3
byte 4
Answer format
Positive answer
STATUS
(1 byte)
0x00
en-938846/5 15 - 19
Negative answer
STATUS
(1 byte)
See table below
Request format
ADDITIONAL
REQUEST CODE
(1 byte)
0x47
Answer format
Positive answer
STATUS VALUE
(1 byte) (1 long word)
0x00 byte 1
byte 2 byte 3
byte 4
15 - 20 en-938846/5
Exchanges by Protocol
Negative answer
15
ANSWER CODE ADDITIONAL
(1 byte) ANSWER CODE
0xF5 0x77
STATUS
(1 byte)
See table below
Request format
REQUEST CODE
COMPLEMENT
(1 byte)
0x48
FILE NAME
(1 long word)
See REMARK
REMARK The «FILE NAME» field indicates the number of the first part programme indexed by
the axis group (Part programme No. x 10 + axis group No.) to be included in the
answer.
If this programme is not present in memory, the list is given starting from the next
programme.
If the value of this field is 0, the list is given starting with the first programme present
in memory.
en-938846/5 15 - 21
Answer format
Positive answer
STATUS
(1 byte)
See table below
DATA
(See REMARK)
REMARK In the «DATA» field, each part programme is described by two long words:
- the first indicates the part programme number indexed by the axis group (Part
programme No. x 10 + axis group No.)
- the second indicates the number of bytes in the part programme.
Negative answer
STATUS
(1 byte)
See table below
15 - 22 en-938846/5
Exchanges by Protocol
Request format
ADDITIONAL
REQUEST CODE
(1 byte)
0x49
Answer format
Positive answer
STATUS
(1 byte)
See table below
DATA
(See REMARK)
STATUS
(1 byte)
See table below
en-938846/5 15 - 23
15.3.7 «CLOSE-DIRECTORY» Request
Used to close a directory operation.
Request format
REQUEST CODE
COMPLEMENT
(1 byte)
0x4A
Answer format
Positive answer
STATUS
(1 byte)
0x00
Negative answer
STATUS
(1 byte)
See table below
15 - 24 en-938846/4
Exchanges by Protocol
PROGRAMME NUMBER
(1 long word)
(See REMARK)
BLOCK NUMBER
(1 word)
BLOCK OFFSET
(1 word)
REMARK The «PROGRAMME NUMBER» field indicates the number of the part programme
indexed by the axis group (Part programme No. x 10 + axis group No.).
Answer format
Positive answer
BLOCK LENGTH
(1 word)
DATA
REMARK The «DATA» filed can contain up to 119 bytes and ends with (LF).
Negative answer
For this request, the answer code and additional answer code are not significant. The execution report is given by
the code returned in the uniti() function (see Sec. 15.4.2).
en-938846/8 15 - 25
15.3.9 «WRITE-BLOCK» Request
Used to add, edit or delete a part programme block. By allocating more memory space than is actually required for this
programme prior to using this request (RESERVE MEMORY request, See Sec. 15.3.10) a write-block request can be
made when the CNC is not in reset status.
REMARK The request can contain up to 132 bytes.
Request format
PROGRAMME NUMBER
(1 long word)
See REMARK 1
BLOCK NUMBER
(1 word)
BLOCK OFFSET
(1 word)
BLOCK LENGTH
(1 word)
DATA
See REMARK 2
REMARK 1: The «PROGRAMME NUMBER» field indicates the number of the part programme
indexed by the axis group (Part programme No. x 10 + axis group No.).
REMARK 2: The first character must be:
- «+» for an addition after the block given by number and offset,
- «#» for a modification,
- «-» for a deletion.
The last character must be «LF» and the field must contain no more than 119
characters.
Format of Positive and Negative Answers
For this request, the answer code and additional answer code are not significant. The execution report is given by the
code returned in function uniti() (see Sec. 15.4.2).
15 - 26 en-938846/4
Exchanges by Protocol
Request format
PROGRAMME NUMBER
(1 long word)
See REMARK 1
MEMORY SIZE
(1 long word)
See REMARK 2
REMARK 1: The «PROGRAMME NUMBER» field indicates the number of the part programme
indexed by the axis group (Part programme No. x 10 + axis group No.).
REMARK 2: The «MEMORY SIZE» field indicates the size to be reserved for the programme.
Setting this field to zero allocates the effective memory size required for the
programme.
Format of Positive and Negative Answers
For this request, the answer code and additional answer code are not significant. The execution report is given by the
code returned in function uniti() (see Sec. 15.4.2).
en-938846/4 15 - 27
15.3.11 «MESSAGE READ» Request
The CNC function sends this request at its own initiative to the automatic control function after instruction «$1» or «$11»
in the part programme being executed.
Two types of messages are sent by the CNC server:
- nonblocking messages «$1 «Message» LF»,
- blocking messages «$11 «Message» Lf».
The automatic control function receives the message sent to it by the monitor on ports 0x10 to 0x17 (axis groups 1
to 8) using the uniti() function.
Request format
Transfer mechanism
The message «$1 «Message» LF» is sent once to the automatic control function. The part programme then continues
without waiting for an acknowledgement.
The answer is transmitted by a «WRITE OBJECT» request with segment 224. The value of the object is stored by
the CNC function until it is read by the part programme.
The part programme retrieves this value by function $1 programmed in a parametric expression of the type «Ln = $1».
If no value is sent or if the last value sent was already acknowledged, the part programme goes on wait for a new write
of segment 224.
For read, the CNC sends back the last value sent to it if it is still stored, i.e. if it has not yet been retrieved by the part
programme. Otherwise, it sends the one’s complement of this value.
REMARK An attempt to transfer a message from a part programme to the automatic control
function cancels storage of a previous write of segment 224 on the axis group
considered.
15 - 28 en-938846/4
Exchanges by Protocol
Transfer Mecanism
The message «$11 «Message» LF» is sent to the automatic control function and the part programme is on wait.
The message is then retransmitted every 10 s to the automatic control function until the automatic control function
sends a «WRITE OBJECT» request with segment 226 = 1 (acknowledgement without CNC release).
The answer is sent by a «WRITE OBJECT» request with segment 224.
The automatic control function acknowledges the message by sending a «WRITE OBJECT» request with segment
226 = 2 (acknowledgement and release of the CNC).
Release of the CNC allows continuation to the next block and retrieval of the answer by function $11 programmed in
a parametric expression of the type «Ln = $11.
Description
Sends a request to a server on the 16 source ports with addresses 0x30 to 0x3F.
Return code
If OK
Error
en-938846/4 15 - 29
Structure of the transmission Buffer
Request size
(1 word)
Written Request
by the user (see Sec. 15.3)
programme 128 bytes
max.
1 word
Description
The uniti function works on ports 0x30 to 0x3F and 0x10 to 0x17.
This function:
- Receives the answer to a request previously sent by unito() on the same source port
- Receives an «unsolicited» request sent by the part programme of an axis group. In this case, the source port
indicates the axis group from which the message is to be received (0x10 to 0x17).
REMARKS If the return code is 0x06, the uniti() function must be called periodically until the
message is received.
15 - 30 en-938846/7
Exchanges by Protocol
Return code
If OK
15
Code Report message
0x00 Read correct
Error
en-938846/6 15 - 31
Storage of the reception buffer
Request size
(1 word)
Buffer size
Answer
Written by (see Sec. 15.3)
the monitor
128 bytes
max.
1 word
! CAUTION
Functions unito(), uniti(), neto() and neti() must be programmed in a background task
(%TF0 to %TF15).
The size of a request must not be zero or greater than 128 bytes (except for the READ_BLOCK and WRITE_BLOCK
requests).
REMARK Sixteen exchange buffers are accessible to the user programme, allowing a maxi-
mum of sixteen requests to be sent each RTC cycle.
Consecutive transmission of several requests on the same port without acknowledgement of the answers causes the
loss of one or more answer codes.
It is important to:
- programme transmission to the server followed by reception of the answer on a given port before programming any
other transmission, or
- use different ports for each transmission/reception command.
For the servers, the concept of queuing may cause an offset in the timing of request processing. This is because the
load on the different servers may mean that the requests are not processed in the order in which they were sent.
To ensure correct timing of request processing, make sure the answer is received before sending the next request on
a port.
15 - 32 en-938846/7
Exchanges by Protocol
15
USER REQUEST CNC
PROGRAMME MONITOR QUEUE FUNCTION
(UNITE requester) (UNITE servers)
REQUEST
1
REQUEST
2
REQUEST SERVER
4 A
REQUEST
3
REQUEST SERVER
TRANSMISSION 5
1 B
(PORT 0x30)
TRANSMISSION
2
(PORT 0x31)
TRANSMISSION 3
(PORT 0x32)
TRANSMISSION 4
(PORT 0x33)
TRANSMISSION 5
(PORT 0x34)
PORT 0x30
RECEPTION
(PORT 0x30) 1
PORT 0x31
RECEPTION
(PORT 0x31) 3
PORT 0x32
RECEPTION
(PORT 0x32) 2
PORT 0x33
RECEPTION Order of transmission
(PORT 0x33) 5
PORT 0x34 Order of reception
RECEPTION
(PORT 0x34) 4
en-938846/4 15 - 33
15.5 Exchanges With a Remote Station
15.5.1 Send a Request neto
Syntax
Description
Sends a request to a remote station. The request is sent on one of the 16 source ports with addresses 0x50 to 0x5F.
Operation
If the source port number is valid (between 128 and 143) when the neto(..) function is called and if series 7 addressing
(network, station, port, module, channel) is valid, the monitor:
- sends the request to the destination server and returns to the caller with an OK return code if the transmit channel
is free,
- returns to the caller with the SATURATION return code if the transmit channel is saturated.
If a programming error is detected, a return is made to the caller with the return code indicating the error detected.
As many requests can be exchanged simultaneously as there are source ports available.
Return Code
If OK
Error
REMARK The Network, Station, Port, Module and Channel fields correspond to the
Telemecanique Series 7 addressing identifying the request recipient. Refer to the
manual on the corresponding network.
15 - 34 en-938846/4
Exchanges by Protocol
Line number
(1 word)
Spare Network
(1 byte) (1 byte)
Station Port
Written by (1 byte) (1 byte)
the user
programme Module Channel
(1 byte) (1 byte)
1 word
en-938846/7 15 - 35
Description
The neti function works on ports 0x50 to 0x5F.
This function:
- Receives the answer to a request sent earlier on the network by neto(..)
- Receives an «unsolicited» request sent by a remote station.
Operation
When the neti(..) function is called, if the queue does not contain any requests with the same source port as in the call
to neti(..), the monitor returns to the calling programme with the NO_REQ return code «0x6».
If the size allocated for reception of the datagram is sufficient, the request is transferred to the address &datagram and
a return is made to the caller with the OK return code «0x0».
If the buffer size is insufficient, the return is made to the caller with the SMALL_BUFF return code «0x7».
It is possible to wait simultaneously for as many requests as there are source ports (16 answers to requests sent by
neto(..) or «unsolicited» requests).
Return Code
If OK
Error
REMARK If the return code is 0x06, the neti(..) function must be called cyclically until the request
is received.
15 - 36 en-938846/4
Exchanges by Protocol
Line number
(1 word)
Spare Network
(1 byte) (1 byte)
1 word
REMARK The Network, Station, Port, Module and Channel fields correspond to the
Telemecanique Series 7 addressing identifying the request recipient. Refer to the
manual on the corresponding network.
Line No. Machine processor First Second Special
card IT/serial line card IT/serial line card controller
REMARK With UNI-TELWAY, if the answer is 2 bytes and the return code is 0xFF, the return
code can have the following values:
- 0x03: recipient inaccessible
- 0x04: NACK: recipient buffer full
- 0x0A: timeout.
Programming error causing a CPU fault
Access to a prohibited address:
- &datagram parameter error,
- &datagram+size outside authorised area.
en-938846/7 15 - 37
15.5.3 Examples of Series 7 Addressing
SOURCE DESTINATION Line No. Spare Network Station Port Module Channel
Requester Server
UNI-TELWAY Master UNI-TELWAY Slave S 0x20+L 0 0 0xFE 5 0xFE 0x64
Line L (16) +S
UNI-TELWAY Slave UNI-TELWAY Master 0x20+L 0 0 0xFE 0 0 0
Line L (1)
UNI-TELWAY Slave UNI-TELWAY Master 0x20+L 0 0 0xFE P 0 0
Line L (1) Port P application
programme
UNI-TELWAY Slave UNI-TELWAY Slave S 0x20+L 0 0 0xFE 5 0xFE 0x64
Line L (1) +S
MAPWAY-ETHWAY MAPWAY-ETHWAY 0x30 0 0 S 0 0 0
(16) Station S of my network
MAPWAY-ETHWAY MAPWAY-ETHWAY 0x30 0 R S 0 0 0
(16) Station S of network R
MAPWAY-ETHWAY MAPWAY-ETHWAY 0x30 0 R S P 0 0
(1) Port P application
programme
Station S of network R
(1) 1 source port (0x50 to 0x5F) authorised per destination allows only one exchange with this destination.
(16) 16 source ports (0x50 to 0x5F) authorised per destination allows 16 simultaneous exchanges with the same
destination.
15 - 38 en-938846/4
Exchanges by Protocol
Description
Sets up the common word service.
Operation
Function setcomw(..) must be called in task %INI. If this function is not called, the common word service is not active.
The same number of bytes must be allocated to each station in the network. If the value set for a station is incorrect,
this station is ignored by the other stations.
Since the stations can share a maximum of 256 words (512 bytes), the size chosen determines the maximum number
of stations that can use the common word service.
Return Code
If OK
en-938846/4 15 - 39
Error
netst_ad(&status_address)
Description
Defines the address of the user area containing the specific values concerning the status of the numerical control
accessible by the STATUS request (code 0x31) (see UNITE Protocol Manual).
Operation
This function must be called in task %INI.
It defines the start address for storage of the 16 bytes of the USER_SPECIFIC field.
REMARK If this function is not called, the USER_SPECIFIC field is not significant.
Example
netst_ad(%M100.&)
The STATUS request reads the USER_SPECIFIC field at address %M100.&.
Return Code
If OK
15 - 40 en-938846/7
Programming in C Language
16 Programming in C Language
16.1 General 16 - 3
16.2 Call Executable Module exec 16 - 3
16.3 Identify an Executable Module exechdl 16 - 4
16.4 Programming in C 16 - 5
16.4.1 Concept of Module 16 - 5 16
16.4.2 Interface between C Modules 16 - 5
16.4.3 Exchange Area 16 - 7
16.4.4 Accessing the Saved Common Internal
Variables 16 - 7
16.4.5 Accessing Unsaved Common Internal
Variables 16 - 7
16.4.6 Accessing the Card Inputs 16 - 8
16.4.7 Accessing the Card Outputs 16 - 8
16.4.8 Standard Data Types 16 - 8
16.4.9 Library Functions 16 - 9
16.4.9.1 System Functions 16 - 9
16.4.9.2 Using System Functions 16 - 11
16.4.9.3 Functions for Exchanges by Protocol 16 - 12
16.4.9.4 Managing the Serial Lines 16 - 13
16.4.9.5 Managing the Transparent Mode 16 - 14
16.4.9.6 Programming the Analogue
Inputs/Outputs 16 - 20
16.4.9.7 Explicit Read/Write 16 - 21
16.4.9.8 Programming the Interrupt Inputs 16 - 22
16.4.9.9 Managing Background Tasks 16 - 22
16.4.9.10General Purpose Functions 16 - 23
16.4.9.11File Management 16 - 26
16.4.9.12Directory Management 16 - 30
en-938846/7 16 - 1
16 - 2 en-938846/7
Programming in C Language
16.1 General
Programming the automatic control function in C has the following advantages:
- the programmes are structured (use of explicit variable names, language syntax, data structure, character strings,
etc.)
- libraries of functions can be used (management of character strings, arithmetic, etc.) 16
- the user can write function libraries available for use by several applications.
All the variables of the exchange area are accessible to programmes written in C.
Functions exec(..) and exechdl(..) are used to manage the C executables resulting from the C compiler in a ladder
module.
! CAUTION
When a pointer is used, it must be correctly initialised. If this check is not made, there is a
risk of generating a "prohibited address" fault.
For instance, the return code of the MALLOC function must be tested before using the
address returned by the function.
exec(whexec, {arg }6 )
arg: Arguments (if any), extended on 32 bits and passed via the stack.
Principle
The (signed) arguments arg are extended on 32 bits and stacked in accordance with the C-language convention (the
first argument is at the top of the stack). whexec is not stacked.
The system analyses whexec and calls the associated executable module.
Return code
If OK
en-938846/7 16 - 3
16.3 Identify an Executable Module exechdl
Syntax
exechdl(&string)
Reads the logic identifier of a function of an executable module from a C-language compiler.
Principle
To be recognised by the monitor, the function name must be sent from a C-language module by function exporte()
(see Sec. 16.4.9).
Return code
If OK
whexec > 0: Logic identifier of the executable module (value given on 16 bits). This identifier is used to call the
executable module by function exec().
Error
whexec == 0: The system does not know the name defined by &string.
16 - 4 en-938846/7
Programming in C Language
16.4 Programming in C
16.4.1 Concept of Module
A module is a separate executable entity. All the objects defined in a module (data or functions) are internal and can
be made available to external entities (C modules, ladder modules or monitor). 16
To be valid, a module must have a single «main()» function.
A module is the result of compiling and link editing of one or more source files in C. It is visible and accessible under
PLCTOOL as a «*.XCX» type file.
An application can include one or more C modules. It is strongly recommended to split large applications into several
modules.
After editing the application, it is necessary to compile, link edit and load the entire module. The time required for these
operations can rapidly become very long.
To optimise the processing times, it is necessary to split large modules into several independent smaller modules that
can exchange all types of data (functions, tables, structures, variables).
In this way, a module works on pointers to the objects to be transferred and the pointers are initialised when the links
are edited.
Two functions, IMPORT() and EXPORT(), are available for processing imported and exported objects.
en-938846/7 16 - 5
Functions
! CAUTION
An object cannot be imported until it has been exported by its owner module.
The user defines the imported and exported objects in the main() function of his modules.
When the translator is called, the monitor updates a table of exports and a table of imports. These two tables contain
the lists of symbols and their respective addresses. Once all the main() functions of all the modules have been called,
the monitor can create the links between exported objects and imported objects.
The symbol name is used by the monitor to link objects. The same name can therefore not be used to export two
different objects.
Monitor
Table of Exports
Symbol @Symb
NAME Addr1
Module A Module B
Table of Imports
Symbol @Symb
NAME Addr2
16 - 6 en-938846/7
Programming in C Language
en-938846/7 16 - 7
16.4.6 Accessing the Card Inputs
These variables can only be accessed for read by byte, word or long word.
These variables can only be accessed for write by byte, word or long word.
16 - 8 en-938846/7
Programming in C Language
An application written in C is generated on a separate system. The NUM.OBJ function library gives access to the
monitor primitives. This library is used during link editing.
All these functions are prototyped in the NUM.H header file.
16
16.4.9.1 System Functions
This function makes a C object visible to all the other modules (total visibility) or associates a function with a PLC task.
Report:
- 0 = OK
- -1 = task already defined or too many export symbols.
Example 1
main()
{
EXPORT(«TS01»,ts01_in_C);
}
void ts01_in_C()
{
function body
}
Example 2
en-938846/7 16 - 9
Programming error causing a CPU fault
Report:
- 0 = OK
- -1 = call outside the initialisation task or too many import symbols.
Example
void(*import_function)();
main()
{
IMPORT(«LABEL», &import_function);
}
void test()
{
import_function();
function body
}
16 - 10 en-938846/7
Programming in C Language
In file EXP.C
#include <NUM.H> 16
SINT16 table[100];
main()
{
EXPORT(«LABEL», table);
}
In file IMP.C
#include <NUM.H>
SINT16 *ptab;
main()
{
IMPORT(«LABEL», &ptab);
}
In module 1
#include <NUM.H>
SINT16 Display(UINT8 what, SINT16 quantity)
{
SINT16 i;
for (i = 0; i < quantity; i++);
{
EMIV(what);
}
return(i);
}
main()
{
EXPORT(«FUNCT1», Display);
}
en-938846/7 16 - 11
In module 2
#include <NUM.H>
SINT16 (*ImpFunc)(UINT8, SINT16);
/* ImpFunc: Pointer to a function requiring two parameters that return SINT16*/
void funct2()
{
PCUR(5, 2);
ImpFunc(«_», 10);
/* Execution of the imported function*/
}
main()
{
IMPORT(«FUNCT1», &ImpFunc);
/* Initialisation of the pointer to the external function*/
}
The operation and parameters of these functions are the same as for the corresponding ladder functions (see
Chapter 15).
16 - 12 en-938846/7
Programming in C Language
The operation and parameters of these functions are the same as for the ladder functions (see Chapter 12).
en-938846/7 16 - 13
Read the Reception Buffer COMIN
Syntax
The operation and parameters of these functions are the same as for the ladder functions (see Chapter 8).
16 - 14 en-938846/7
Programming in C Language
void INIG()
16
Select the Main Window MAIN_WINDOW
Syntax
void MAIN_WINDOW()
void STATUS_WINDOW()
void KEY_WINDOW()
en-938846/7 16 - 15
Line_Type: Type of line to be drawn
16 - 16 en-938846/7
Programming in C Language
void ARCA(UINT8 Line_Type, UINT16 Endx, UINT16 Endy, UINT16 Centrex, UINT16 Centrey)
void ARCT(UINT8 Line_Type, UINT16 Endx, UINT16 Endy, UINT16 Centrex, UINT16 Centrey)
en-938846/7 16 - 17
RECT: Rectangle CERC: Circle
Start
Start
Length
Radius
Width
End End
Width
HalfWidth Start
HalfBase Start Height
Half-
Height
Half-
TotalHeight
Height
End
End
Start End
Y
Width
EndX
Start
End
End
Length CentreX
EndY
Start
Circle CentreY
centre
0 X
16 - 18 en-938846/7
Programming in C Language
en-938846/7 16 - 19
Read a String SCANS
Syntax
SINT32 SCANC()
16 - 20 en-938846/7
Programming in C Language
The operation and parameters of these functions are the same as for the ladder functions (see Chapter 10).
en-938846/7 16 - 21
16.4.9.8 Programming the Interrupt Inputs
The operation and parameters of these functions are the same as for the ladder functions (see Chapter 11).
The operation and parameters of these functions are the same as for the ladder functions (see Chapter 7).
void CSBEGIN(void)
16 - 22 en-938846/7
Programming in C Language
void CSEND(void)
16
Start a %TF Task TFSTART
Syntax
void WHTR(UINT16 n)
The operation and parameters of these functions are the same as for the corresponding Ladder functions (see
Chapter 6).
en-938846/7 16 - 23
Optimise Circular Search QCKTOOL
Syntax
Call a Subroutine SP
Syntax
void SP(n_moduleno)
16 - 24 en-938846/7
Programming in C Language
Semaphore SEMA
Syntax
SINT8 SEMA(SINT8*semaphore)
16
Programming error causing a CPU fault
TMGET(*date)
en-938846/7 16 - 25
Read Current Date and Day in Week DTGET
Syntax
DTGET(*date)
The global memory is managed like a disk drive. The data are stored in it as files in directories.
Programming in C allows you to create your own files. A number of primitives are available for managing these files.
The error codes returned by the primitives (file and directory) are:
Parameters
Inputs: pfilename: The path must not be specified because the user files are necessarily stored in a
particular directory.
Output: None
16 - 26 en-938846/7
Programming in C Language
REMARKS If the filename already exists, the function returns error code «UF_ERRNAME». An
existing file must first be deleted by function «USER_REMOVE_F» before the name
can be reused for another file.
After execution of function «USER_CREATE_F», the new file is empty. Function
«USER_CREATE_F» is only used for data files. Function «USER_CREATE_F»
does not automatically open the file. To open it, use function «USER_OPEN_F». 16
Programming error causing a CPU fault
Parameters
Inputs: pfilename: The path must not be specified because the user files are necessarily stored in a
particular directory.
Output: None
Description
Opens the file identified by pfilename. This file is accessible for read and write. If the operation is executed normally,
the file manager returns an identifier pF_id used by functions «USER_CLOSE_F», «USER_READ_F»,
«USER_WRITE_F» and «USER_SEEK_F».
Parameters
Inputs: pfilename: The path must not be specified because the user files are necessarily stored in a
particular directory.
en-938846/7 16 - 27
REMARKS Function «USER_OPEN_F» does not check the file type.
Function «USER_OPEN_F» sets the file pointer to the first byte in the file.
Programming error causing a CPU fault
Access to a prohibited address:
- *pF_id parameter error,
- *pfilename parameter error.
Description
Closes a file opened by function «USER_OPEN_F».
Parameters
Inputs: pF_id: File identifier
Outputs: None
REMARK Since only a limited number of files can be opened simultaneously, function
«USER_CLOSE_F» must be used as soon as it is no longer necessary to have the
file open.
Parameters
Inputs: pF_id: File identifier returned by USER_OPEN_F.
pBuf: Received data buffer.
Requestno: Number of bytes to be read.
Outputs: No_read: Number of bytes effectively read. If this number is less than the number requested, the
end of the file was reached.
REMARKS The data are read from the current position of the file pointer. The file pointer is
automatically repositioned after the read.
Programming error causing a CPU fault
Access to a prohibited address:
- *pBuf parameter error,
- *pBuf+Requestno outside authorised area,
- *No_read parameter error.
16 - 28 en-938846/7
Programming in C Language
Parameters
Inputs: pF_id: File identifier returned by function «USER_OPEN_F».
pBuf: Buffer containing the data to be written.
Buf_Size: Buffer size.
Outputs: None
REMARKS The data are written starting from the current position of the file pointer. The file
pointer is automatically repositioned after the write.
Programming error causing a CPU fault
Description
Repositions the pointer for read or write in the file specified by pF_id.
Parameters
Inputs: pF_id: File identifier returned by function «USER_OPEN_F».
mode: Seek start position. 0 seek from beginning of file.
1 seek from current position.
2 seek from end of file.
offset: Signed offset relative to the mode selected.
Outputs: Old_Ptr: Initial pointer value.
REMARKS The pointer is different for each file.
The pointer is an unsigned variable. Movement outside the file limits generates an
error.
en-938846/7 16 - 29
Programming error causing a CPU fault
Only the user directory is accessible. Three primitives are available to read the contents of this directory.
SINT32 USER_OPEN_DIR()
Parameters
Inputs: None
Outputs: None
REMARK A directory is open for read only.
Close User Directory USER_CLOSE_DIR
Syntax
SINT32 USER_CLOSE_DIR()
Description
Closes the user directory opened by the primitive «USER_OPEN_DIR».
Parameters:
Inputs: None
Outputs: None
Parameters
Inputs: pBuf: Data receive buffer.
No_Requested: Number of bytes to be read.
Outputs: No_Read: Number of bytes effectively read. If this number is less than the number requested, the
end of the directory was reached.
16 - 30 en-938846/7
Programming in C Language
The time, date and size are in INTEL format, i.e. the MSBs and LSBs are reversed with respect to the MOTOROLA
format.
en-938846/7 16 - 31
Time
Bit 15 Bit 0
Date
Bit 15 Bit 0
To facilitate read of these data, the following structures (defined in the NUM.H header file) can be used:
struct S_TIME_FILE
{
UINT8 Sec :5; /* Second */
UINT8 Min :6; /* Minutes */
UINT8 Hour :5; /* Hours */
};
struct S_DATE_FILE
{
UINT8 Day :5; /* Day */
UINT8 Month :4; /* Month */
UINT8 Year :7; /* Year */
};
struct S_DIRECTORY_ELEMENT
{
UINT8 filename[8];
UINT8 Extension[3];
UINT8 Attribute;
UINT8 Spare[10];
UINT16 Intel_Time; /*Word in INTEL format*/
UINT16 Intel_Date /*Word in INTEL format*/
UINT16 Start_Cluster;
UINT32 Intel_File_Size; /*Long word in INTEL format*/
};
16 - 32 en-938846/7
Programming of the PLC Axes
17 PLC Axes
17.1 General
The PLC axis programming function allows the automatic control function to control these axes.
These PLC axes are controlled by the CNC function.
Depending on the 1060 system, the CNC function can control a maximum of:
The PLC axes are contained in PLC axis groups within which they can be interpolated.
The number of axis groups (CNC and PLC) in the system is defined by machine parameter P97 (see Parameter
Manual).
The part programming functions performed by the PLC axis groups are the same as those performed by the CNC axis
groups except for functions M01, M12 and G75 (see Part Programming Manual).
The main operating modes of the PLC axis groups are the AUTO and SINGLE modes (see Operator Manual). A PLC
axis group operates in one of these modes independently of the modes of the other groups (CNC or PLC).
17.2.1 Data Transfers from the Automatic Control Function to the CNC Function
The data concerning the PLC axis groups sent by the automatic control function to the CNC function include:
en-938846/8 17 - 1
17.2.2 Data Transfers from the CNC Function to the Automatic Control Function
The data concerning the PLC axis groups sent by the CNC function to the automatic control function include:
17 - 2 en-938846/7
18 Programme Debugging
en-938846/7 18 - 1
18 - 2 en-938846/6
Programme Debugging
Requirements
Utility 7 does not have any particular access requirements. 18
Actions
en-938846/6 18 - 3
Display of the main menu, «PLC APPLICATION MANAGEMENT».
PLC operation
Monitor and %TS time profile
File management
I/O configuration
Software backup
Animation
../.. EXIT
18 - 4 en-938846/6
Programme Debugging
Requirements
«PLC APPLICATION MANAGEMENT» menu displayed.
Actions
en-938846/6 18 - 5
18.2.2.1 PLC Status
The «PLC STATUS» field gives information on the CPU status.
The comments that can be displayed in this area are detailed in the table below:
Messages Comment
No error PLC function operating correctly
Bad I/O bus implementation Cause:
Unidentified card present
Card missing
Discrepancy between programmed configuration and real
configuration
Watchdog programming error
Corrective action
Check the input/output configuration (see Sec. 18.2.5)
Check the state of %R97F.B (see Sec. 3.8.5)
Check %INI in the user programme (card and watchdog
configuration variables)
Erroneous I/O bus behaviour Cause:
Link error on the bus
Corrective action
Check the state of bus status signal %Rrc39.B
(see Sec. 3.7.3)
Check the continuity of the fibre-optic ring
Contact NUM CUSTOMER SERVICE
Messages Comment
Internal monitor fault Cause:
Serious internal error
Corrective action
Contact NUM CUSTOMER SERVICE
Application time limit overrun Cause:
RTC overrun (endless loop in a programme)
Corrective action
Correct the user programme
Unknown PLC error Cause:
Serious internal error
Corrective action
Contact NUM CUSTOMER SERVICE
18 - 6 en-938846/6
Programme Debugging
Messages Commentaire
Bad I/O bus configuration Cause:
Unidentified card resent
Card missing
Discrepancy between programmed configuration and real
configuration
Watchdog programming error
Corrective action
Check the input/output configuration (see Sec. 18.2.5)
Check the state of %R97F.B (see Sec. 3.8.5)
Check %INI in the user programme (card and watchdog
configuration variables)
Erroneous I/O bus behaviour Cause:
18
Link error on the bus
Corrective action
Check the state of bus status signal %Rrc39.B
(see Sec. 3.7.3)
Check the continuity of the fibre-optic ring
Contact NUM CUSTOMER SERVICE
Too many boards in I/O bus Cause:
Too many inputs and outputs for the system
Corrective action
Decrease the number of inputs and outputs cards within the
authorised limits
Messages Comment
Can't read the application Cause:
Serious internal error
Corrective action
Contact NUM CUSTOMER SERVICE
Errors in module TSi / TFi / THi / SPi / Cause:
C code / ??? Problems when loading (module too large, not enough space
in the local memory for loading the module)
Corrective action
Decrease the module size
Increase the local memory size
If «???», contact NUM CUSTOMER SERVICE
C module: duplicate export of a symbol Cause:
Double export of symbols in a C module
Corrective action
Check and edit the C module
Duplicate definition of module TSi / TFi / THi / SPi / Cause:
C code / ??? A module with the same name is present twice in the
application
Corrective action
The user application modules must all have different names.
Correct the user application
If «???», contact NUM CUSTOMER SERVICE
en-938846/7 18 - 7
During execution of the user programme
A message is displayed on three lines.
Line 1: Message text
Line 2: Indicates the task involved: TSi/THi/TFi/INI
Line 3: Indicates the module involved: «Module: *.*[@ with respect to the module start
address]» or «Module: ??? [@ with respect to the start of the PLC monitor mapping]».
REMARK Relative addresses with respect to the module start address can only be used for C
modules (*.XCX). The *.MAP file of the C application gives these addresses.
Messages Comment
User code: divide overflow Cause
Overflow on a division
Corrective action
Check and edit the module involved
If «???», contact NUM CUSTOMER SERVICE
User code : Cause
@ with respect to the monitor = Illegal address Operation on a prohibited address
Corrective action
Check and edit the module involved
If «???», contact NUM CUSTOMER SERVICE
Messages Comment
Inconsistent user code Cause:
Use of incoherent functions or symbols in the user programme
User programme incoherent
Corrective action
Check and edit the module involved
If «???», contact NUM CUSTOMER SERVICE
18 - 8 en-938846/7
Programme Debugging
Requirements
«PLC OPERATION» menu displayed.
Actions
Messages Comment
Unknown module name Cause:
A pointer that was not correctly initialised in a C module has
destroyed a code area.
Corrective action
Identify the C module and make the necessary corrections.
Errors in module INI, TSi, TFi, THi, C code Cause:
A pointer that was not correctly initialised in a C module has
destroyed a code area.
Corrective action
Identify the C module and make the necessary corrections.
Messages Comment
Illegal access address Cause:
The address parameter of a Ladder or C function point to an
area other than a data area.
Corrective action
Edit the module involved and correct the function.
No more 512 authoritatives Cause:
zones address The application loaded contains more than 512 non-
continguous data areas.
Corrective action
Group the strings and constants so that they follow one
another contiguously.
en-938846/7 18 - 9
18.2.2.5 Resetting Saved Variables
This function is used to reset saved variables (%M).
Requirements
«PLC OPERATION» menu displayed.
Actions
PLC OPERATION
PLC status: RUNNING
(No error)
TF Activity:
(0-7) 0 0 0 0 0 0 0 0
(8-15) 0 0 0 0 0 0 0 0
TH Activity:
(0-7) 0 0 0 0 0 0 0 0
(8-15) 0 0 0 0 0 0 0 0
Commands: GO / STOP / INIT
Reset saved variables
../.. EXIT
18 - 10 en-938846/6
Programme Debugging
Requirements
«PLC APPLICATION MANAGEMENT» menu displayed.
18
Actions
The percentage is calculated with reference to the time allocated to the monitor and user programme, i.e.:
- 18 ms for Series I and Series II biprocessor, even though the RTC cycle is 20 ms, since 2 ms are reserved by the
system (see Sec. 2.1)
- Value in ms of P99 in Series II UCSII.
en-938846/6 18 - 11
Measurement Acquisition
Stop Measurements
Reset Maxima
18 - 12 en-938846/6
Programme Debugging
Requirements
«PLC APPLICATION MANAGEMENT» menu displayed.
Actions
../.. EXIT
The numbers after «PLC» indicate the occupied and free memory space (in bytes).
en-938846/6 18 - 13
18.2.4.1 Format the Volume
This command is used to initialise the PLC memory and delete all the files in the memory.
Actions
../.. EXIT
18 - 14 en-938846/6
Programme Debugging
Actions
18
LADDER FILES DIRECTORY
en-938846/6 18 - 15
18.2.4.3 File Deletion
This function is used to delete files from the PLC memory.
Actions
Enter the name of the file to be deleted [Sector name]. [File type]. ☞
(Example: TS0.XLA).
The message «File deleted» is displayed.
18 - 16 en-938846/6
Programme Debugging
Requirements
«PLC APPLICATION MANAGEMENT» menu displayed.
Actions
I/O CONFIGURATION
Racks Slots
0 (P8) C B x 9 x 7 6 5 x x x 1 0
3 (E12) C B A 9 x x x x x 3 2 1 0
4 (E12) x x x x x x x x x 3 2 1 0
../.. EXIT
en-938846/6 18 - 17
Card Identification
18 - 18 en-938846/6
Programme Debugging
Example
I/O CONFIGURATION 18
Racks Slots
0 (P8) C B x 9 x 7 6 5 x x x 1 0
3 (E12) C B A 9 x x x x x 3 2 1 0
4 (E12) x x x x x x x x x 3 2 1 0
../.. EXIT
en-938846/6 18 - 19
18.2.6 Software Backup
Via a CPU serial interface, this module is used to:
- back up the user programme on a peripheral (diskette drive or tape reader/punch),
- check the backed up programme against the source programme,
- restore the backed up programme.
Requirements
Transmission data rate correct and communication parameters correct on the peripheral.
CNC connected to the peripheral (on a CPU serial interface)
«PLC APPLICATION MANAGEMENT» menu displayed.
Actions
APPLICATION BACKUP
../.. EXIT
18 - 20 en-938846/6
Programme Debugging
Actions
Actions
Actions
en-938846/6 18 - 21
18.2.7 Software Load/Download to/from PLCTOOL
For further details, refer to the PLCTOOL - Ladder Language Programming Tool Manual.
Check that the data rates on the CNC and PC are the same.
REMARK The current loading procedure does not require any action on the CNC.
18.2.8 Ladder Animation
Ladder animation is used to dynamically display the Ladder contacts of a PLC programme. This gives a graphic display
of changes in a Ladder network.
Requirements
«PLC APPLICATION MANAGEMENT» menu displayed.
Actions
LADDER directory
Name Size Date Time
TS0 .XLA 2674 08/07/94 13:28:13
QUIT
18 - 22 en-938846/6
Programme Debugging
Select the module to be animated using the arrow keys then confirm. ☞
The Ladder grid to be animated is displayed.
- L A D D E R a n i m a t i o n - T S 0 . X L A : 0 / 1 6
Text :
Value : 18
%W4.7
%W4.O
%W4.3
%W100.1
%W100.O
%W200.5
en-938846/6 18 - 23
Browsing Through the Application
Operation Command
➞
Focus on the next object or SHIFT
or SHIFT ➞ or SHIFT
➞
➞
➞
Move around in the Ladder grid Focus on the Ladder grid then or or or
Pg Dn
Display the next Ladder component Focus on the vertical scroll bar then
Display the previous Ladder component Focus on the vertical scroll bar then Pg Up
End
Display the last Ladder component Focus on the vertical scroll bar then
Home
Display the first Ladder component Focus on the vertical scroll bar then
Stop Animation
Ladder animation is stopped. A new key appears in the key bar: «CLEAR».
18 - 24 en-938846/6
Programme Debugging
LADDER directory
Name Size Date Time
TS0 .XLA 2674 08/07/94 13:28:13
18
QUIT
Press «F9». ☞ ON
Define Options
Decimal/hexadecimal display
Or
en-938846/6 18 - 25
Gridlines
Or
- L A D D E R a n i m a t i o n - % T S 0 . X L A : 0 / 1 6
Text :
Value :
%W4.7
%W4.O
Search
%W4.3
Sequence number : %W100.1
%W100.O
%W200.5
CANCEL
18 - 26 en-938846/6
Programme Debugging
Write a Variable
- L A D D E R a n i m a t i o n - % T S 0 . X L A : 0 / 1 6
Text : 18
Value :
%W4.7
%W4.O
Write
%W4.3
Write : %W100.1
%W100.O
%W200.5
CANCEL
en-938846/6 18 - 27
18 - 28 en-938846/6
Errors and Diagnostic
19
en-938846/6 19 - 1
19 - 2 en-938846/6
Lists of Functions
A Lists of Functions
en-938846/7 A-1
A-2 en-938846/7
Lists of Functions
en-938846/7 A-3
Function Description Page
W_E42000 Write n variables E42000 6-32
y_init() Initialisation of the base associated with the %Y variables 6-33
A-4 en-938846/7
Lists of Functions
en-938846/7 A-5
A.2 Alphanumerical List
Function Description Page
anaa() Reassign an analogue card 9-7
anai() Read an analogue input 9-6
anao() Write an analogue output 9-5
anas() Configure an analogue I/O card 9-3
atoi() Convert an ASCII string to a signed integer of 32 bits 6-3
atoj() Convert an ASCII string to a signed integer of 32 bits 6-4
bcd_bin() BCD —> binary code conversion 6-5
bin_bcd() Binary —> BCD code conversion 6-6
bit() Separate bits into bytes 6-7
call() Jump to a module label with return 6-19
comctl() Control the serial line driver 12-11
comf() Select data rates and formats 12-4
comin() Read the reception buffer 12-7
comout() Send a buffer 12-6
comreg() Read the status of a serial line 12-10
cpyarg() Read the parameters stored on the stack 6-8
cpyb() Copy one or more bytes 6-9
cpyl() Copy one or more long words 6-11
cpyw() Copy one or more words 6-10
csbegin() Start a critical section 7-3
csend() End a critical section 7-3
diagiq() Set the self-test period 6-11
dtget() Read the current date and day in week 14-2
exec() Call an executable module 16-3
exechdl() Identify an executable module 16-4
goto() Jump to a module label without return 6-19
inig() Graphic init 8-17
itictl() Configure an interrupt input 11-6
itiget() Read an interrupt input 11-8
iti_gr() Associate an interrupt input with an axis group 11-5
itoa() Convert a signed integer to an ASCII string 6-12
itostr() Convert an unsigned integer to an ASCII string 6-12
neti() Read a request from a distant server 15-36
neto() Send a request to a distant server 15-34
netst_ad Answer a STATUS request 15-40
oct() Concatenate a byte into bits 6-13
pcur() Position the cursor 8-7
print() Display a buffer 8-8
printf() Display a string with format 8-9
putchar() Display a character 8-7
A-6 en-938846/7
Lists of Functions
en-938846/7 A-7
Function Description Page
write_q() Explicit write of an output card 10-4
W_E42000 Write n variables E42000 6-32
y_init() Initialise the base associated with the %Y variables 6-33
A-8 en-938846/7
Index
Index
en-938846/8 I-1
comin 12-7 DIRECTORY request 15-22 G
Comment 4-3 Display
Common elements of sequences 5-3 a buffer 8-8 G function status 3-54
Common word configuration 3-69 a character 8-7 General organisation of
Common word service 15-38 a string 8-8, 8-9s multicard CPU 1-4
Common word variables 3-68 an image 8-16 single card CPU 1-5
comout 12-6 management 8-3 goto 6-19
Compact panel 3-27 DNC1000 15-3 Grafcet step 2-15, 5-3
Comparison 4-3 DNC1000 protocol 15-4 Grafcet step deactivation 5-4
Comparison operator 4-6 Downcounters 5-12 Graphic init 8-17
Comparison_operator 4-4 Draw a key bar 8-40 Graphic instructions 8-29
comreg 12-10 dtget 14-2 Graphic space 8-18
Concatenate bytes into bits 6-11 Group commands 3-61
Conditional action 5-9 E Group status 3-53
Configuration errors 19-1
Contact 5-7 E30xxx 3-66 H
Convert E33xxx 3-14
a decimal number 8-14 E40xxx 3-67 Handwheel assignment 3-44
a hexadecimal number 8-15 E42000 6-31, 6-32 Hardware errors 19-1
a signed integer 6-12 E42xxx 3-67 Hardware task activity 18-8
an ASCII string 6-3, 6-4 E43xxx 3-14 Header 5-3
an unsigned integer 6-12 Encoded M function Hex_digit 4-4
Copy with report 3-55 Hexadecimal number acquisition 8-15
a byte 6-9 without report 3-55 Highlighted character 8-27
a character string 6-27 Endless loop in a programme 2-10, 2-11
a long word 6-11 Exchange I
a word 6-10 area 3-5, 3-72, 16-7
mechanism 15-5 Icons 8-36
Counters 5-12
protocol 15-3 Immediate integers 4-7
CPU control 18-9
variable 8-4 Immediate_integer 4-4
CPU monitoring 18-5
with a remote station 15-34 IMPORT 16-10
cpyarg 6-8
Exchanges 3-5 Import an object 16-10
cpyb 6-9
by protocol functions 16-12 Index 3-7
cpyl 6-11
exec 16-3 Index field 3-7
cpyw 6-10
exechdl 16-4 Indirect addressing 3-70
Creating objects 15-9
Executable C module 2-13 Inhibited JOG increments 3-48
Critical section
Executable module identification 16-4 Inhibited modes 3-49
end 7-3
Explicit input card read 10-3 inig 8-17
start 7-3
Explicit output card write 10-4 Initialisation 2-3
csbegin 7-3
Explicit read/write accesses 16-20 Initialise Ladder grid 18-24
csend 7-3
EXPORT 16-9 Initialised axes 3-32
CTD_n 5-12
Export an object 16-9 Initialising the table of constants 2-15
CTU_n 5-12
Input image 3-10
Current mode 3-34
Current reduction 3-51 F Input/output configuration 18-17
Input/output update 1-6
Cursor F_T cell 5-8 Internal computation format 4-7
movement 8-28 Falling trig 5-8 Interpretation of colours 18-23
not visible 8-28 Feed rate potentiometer setting 3-62 Interrupt input configuration 11-6
steady 8-28 Feed stop per axis 3-51 Interrupt inputs 16-22
Cyclic task 2-5 File *.XCX 2-13 IT/axis group association 11-5
File *.XLA 2-13 iti_gr 11-5
D File load 18-22 itictl 11-6
Date-time stamp 14-1 File management 16-26 itiget 11-8
Date-time stamp function 14-1 File unload 18-22 itoa 6-12
Debugging on CNC 18-3 Flag 6-19 itostr 6-10
Decimal number acquisition 8-14 Flow control 12-14
Decoded M function 3-56, 3-58 Font format 8-26 J
Delete 8-29 Format a character string 6-24
Format volume 18-14 JOG increment 3-34, 3-42
Delete a file 18-16
Forward movement on path 3-51 Jump with return 6-19
DELETE_FILE request 15-19
Function 4-4 Jump without return 6-19
diagiq 6-11
Dialogue error counter 3-11 Function library 16-9
Digit 4-4 Function_call 4-3, 4-4, 5-9, 5-15 K
Directory management 16-30 Function_name 4-4
Keyboard characters 3-29
I-2 en-938846/8
Index
en-938846/8 I-3
sscanf 6-25 uniti 15-30
Standard unito 15-29
RS232 12-12 Unsaved variable 3-8, 16-7
RS422 12-13 Unsigned_number 4-4
RS485 12-13 Unsolicited data 15-6
Standard data 16-8 Use of string 2-16
Start a %TF task 7-4 Use of table of constants 2-15
Step 4-3 User area filling 8-38
Stop a %TF task 7-5 User drawing 8-32
Stop animation 18-24 User reference system 8-29, 8-31, 8-38
strcmp 6-26 User task 2-5
strcpy 6-27 Utility 7 18-3
String
acquisition 8-13 V
comparison 6-26
initialisation 2-16 Variable
length calculation 6-27 %I 3-9
strlen 6-27 %Q 3-9
Suspend a %TF task 7-4 %R 3-29
Swap the bytes of a long word 6-29 %R, other 3-35
Swap the bytes of a word 6-28 %W 3-38
swapl 6-29 %Y 3-70, 6-23
swapw 6-28 Variable representation 3-6
Symbol field 3-6
System error management 3-66 W
System errors 3-65 W_E42000 6-32
System task 2-3 W1D.B 3-44
Watchdog 3-14
T whtr 7-4
Table of constants 2-15 whtr(..) 2-7
Task Window
%INI 2-5 definition 8-18
%TF 2-6 dimensions 8-19
%TH 2-9, 11-3 selection 8-24
%TS 2-5 Word value search 6-17
Test area 4-3, 5-7, 5-9 Word variable 4-7
tfstart 7-4 Write
tfstart(..) 2-6 analogue output 9-5
tfstop 7-5 byte 6-20
tfstop(..) 2-6 E42000 6-32
thiti 11-9 long word 6-22
thtimer 13-1 output cards 3-66
Timeouts 5-10 word 6-21
Timer 13-1 WRITE_BLOCK request 15-26
Timer function 13-1 WRITE_OBJECT request 15-18
tmget 14-1 write_q 10-4
TOF_n 5-10 wstrcmp 6-25
TON_n 5-10
Tool correction 6-30 X
Tool number 3-56 Xon/Xoff 12-14
tooldyn 6-30
TP_n 5-10 Y
Transfer current point 8-35
Transmission standards 12-12 y_init 6-33
Transparent mode 8-3
instructions 8-22
management 16-14
U
Unary_operator 4-4
Underlined character 8-27
UNITE requests 2-5
UNITE server 2-5
I-4 en-938846/8