osai 10 CNC PLUS LIBRARY User Manual

10 Series CNC
PLUS LIBRARY
User Manual
Code: 45006682C Rev. 09
PUBLICATION ISSUED BY:
OSAI S.p.A. Via Torino, 14 - 10010 Barone Canavese (TO) – Italy
e-mail: sales@osai.it Web: www.osai.it
Copyright 20001-2002 by OSAI All rights reserved
Edition: July 2001
This document has been prepared in order to be used by OSAI. It describes the latest release of the product. OSAI reserves the right to modify and improve the product described by this document at any time and without prior notice. Actual application of this product is up to the user. In no event will OSAI be responsible or liable for indirect or consequential damages that may result from installation or use of the equipment described in this text.
ABC ABC

Update

10 Series CNC PLUS Library - User Manual
SUMMARY OF CHANGES
General
This publication has been issued with the software release 6.1. This issue completely replaces the previous ones (MOV.08)
PAGE TYPE OF UPDATE
INDEX updated CHAPTERS 5, 6, 9, 10, 11 updated: the various functions with maximum process number to 20
CHAPTER 7
page 16 corrected: diagrams to which the $ANAIN function refers
CHAPTER 10
page 3 inserted: parameter 9 RCM in function $GBPROVAR
CHAPTER 11
page 7 inserted: Pilot Panel management in the multi-process environment
CHAPTER 12
pages 29, 32 pages 36, 38 page 41 page 63
page 65 pages 66, 67
APPENDIX D modified: field 7 in the axes table APPENDIX G inserted: missing error messages
inserted: parameters 24 and 25 for reading Jerk information in function $AX_GET7 inserted: parameters 21 to 25 in function $AX-PUT1.
inserted: note concerning the parameter “STANDSTILL_GAIN” inserted: examples and details for the parameters for using function
$AXD_RDD inserted: new results in the description of function $AXD_WRD added: new considerations in the description of functions $AXD_RDS
and $AXD_WRS.
10 Series CNC PLUS Library - User Manual (09)
asda

Preface

10 Series CNC PLUS Library - User Manual
PREFACE
This manual contains the description of all block functions (FB) needed for the logic application projects of the 10 Series CNC.
It contains the corresponding instruction list (IL) code for each FB and a description of the input and output variables.
This manual deals specifically with functions and function blocks. For further information on PLUS, its language and its applications in the 10 Series CNC environment consult the following manuals:
10 Series CNC PLUS APPLICATION MANUAL Code 45006677Z 10 Series CNC PLUS LANGUAGE & PLUSEDIT Code 45006672 P
You can find an FB or a function more easily if you look up the Function Reference List below in this preface.
In this list the functions are ordered alphabetically and for each of them there is a short description plus the page number.
In this manual the various function blocks have been subdivided into groups depending on the type of operation they fulfil or the environment to which they belong. So if you do not know the exact name of an FB, but know the environment to which it refers, you can easily find the FB in the manual by consulting the index.
COMMON FEATURES OF FUNCTION BLOCKS:
All function blocks can be used in the Ladder Diagram / Function Block Diagram (LD/FBD) editors and in the MACRO Instruction List (MACRO-IL) editor. The function blocks discussed in Chapters 1 and 3 are base function blocks i.e. built from standard elements of the instruction list (IL). All the other function blocks are extensions which internally use a function call. These functions can also be used in the IL editor. For each FB there is an example for the calls and the necessary parameters in IL.
NOTE:
When using function calls in IL, there is no control to ensure that the number and type of parameters are correct. When using the MACRO-IL editor, the function block parameters are always checked.
10 Series CNC PLUS Library - User Manual (09) 1
Preface
10 Series CNC PLUS Library - User Manual
enable input Many of the function blocks shown in this manual have an “enable” input which enables/disables the
execution of the block.
Enable is a Boolean variable which can be inverted if necessary.
You can link all types of Boolean variables available in PLUS including the Boolean constants KB1
and KB0.
The enable signal linked to the FB P1 (pulse) or the use of FBs for controlling the program flow allows you to write faster and attain a more efficient machine code. In general it is better to try to limit the number of always enabled FB (enable always = 1) by disabling them when their function is not required, in order to increase the performance of the machine logic.
stat_wrd output (function status output word) The function status output is available on all system function blocks. After the relevant function has
been completed, this word contain a value indicating that all went well or that there was some kind of problem. When everything was ok, the status word will be zero. In case of problems the value of the status word is different from zero. Please refer to the specific function block for the meaning of the values returned in the status word. Often you're not interested in knowing the status of the functions because your program has been tested and always works well. You can then hook up only one single short variable, e.g. MW 999, to the status output of many functions.
ax_id input (physical axis identifier) The axis identifier is used for many system functions. It is a number identifying the internal resources
for one axis on an axes module. Each axes module supports 8 axes, 6 resources are reserved for physical axes (which read encoders and/or write to D/A converters) and 2 for virtual axes. A machine axis (e.g. "X") may be related to any of the available physical axis resources on any of the axes modules. There can be up to 4 axes modules in the 10 Series CNC chassis, allowing for up to 32 axes (theoretically). The axis identifier now, is a number in the range of 1 through 32. It must be assigned during the axes configuration in AMP and will also serve to define the page number of the axes table on which this axis will be managed. Even when you move the physical connections (encoder, D/A) of an axis to another axes module, its ax_id will remain unchanged and the axis data will remain available on the same page of the axes table. The function A_TO_ID converts an ASCII axis address to its physical axis identifier number.
tc_id input (transducer/converter physical identifier) The identifiers of the tansducer inputs are numbers in the range of 100Hex up to 1nnHex. On the first
servo module you will find (top to bottom) the transducers 100Hex through 105Hex, on the second 106Hex through 10BHex, on the third module 10CHex through 111, and so on. The D/A converters have a similar numbering system. On the first module you will find the converters 200Hex through 205Hex, on the second module 206Hex through 20BHex, and so on.
2 10 Series CNC PLUS Library - User Manual (09)
Preface
10 Series CNC PLUS Library - User Manual
symbolic names Symbolic names to be associated to the user subroutine (DSRB) and to the label (LBL) must be
different from those predefined in PLUS (FB names, predefined routines, etc.) and should never begin with a $. Furthermore, symbolic names should always begin with a letter and not with a number.
TYPES OF SYSTEM FUNCTION CALLS
There can be 3 different types of system function calls (system function blocks):
WAIT
A WAIT function call suspends the execution of the task that called it. This task will resume its activity after the function has been completely executed.
The suspension of a task implies the suspension of all routines that make up this task. The WAIT function is normally executed by an environment other than the I/O processor module (the system).
For this reason a WAIT function is a synchronous call: when the logic scan exits from a WAIT function block, this block has been completely executed.
NOWAIT
A NOWAIT function call does not suspend the execution of the logic task that called it. Immediately after the call has been issued, the logic task resumes execution. The function call will be executed by an environment other than the I/O processor module (system).
For this reason a NOWAIT function is an asynchronous call: when the logic scan exits from a NOWAIT function block, the function is still being executed by another environment.
The execution of many NOWAIT function calls from a logic task may cause a system overloading since the simultaneous execution of many functions is required.
When 15 NOWAIT functions are in parallel execution, the function that has generated the last call is in any case executed and it returns to the word status a warning code (1000 hexadecimal).
If you continue to call NOWAIT functions after the warning message, that is when 25 functions are in parallel execution, an unrecoverable emergency is generated ("too many requests").
INTERNAL
An INTERNAL function is similar to a WAIT function call but its execution is much faster because it's done by the same environment that calls the function (PLUS). An INTERNAL function call is in all aspects like a subroutine available to the PLUS environment. For this reason an INTERNAL function is a synchronous call: when the logic scan exits from an INTERNAL function block, this block has been completely executed.
10 Series CNC PLUS Library - User Manual (09) 3
Preface
10 Series CNC PLUS Library - User Manual
LIST OF THE BASE ELEMENTS OF THE LANGUAGE
$=N Boolean inverter..............................................................................................1-5
$<< Logically shift 16 bit word sc places left ............................................................1-9
$>> Logically shift 16 bit word sc places right ........................................................ 1-10
$ADD Add two or more floating point numbers ...........................................................1-16
$ADDW Add two or more 16 bit words .........................................................................1-11
$AND Boolean AND gate..........................................................................................1-5
$ANDW Bitwise logical AND on 16 bit words ..................................................................1-8
$BCD_BIN Convert an integer from BCD to binary .............................................................1-13
$BIN_BCD Convert an integer from binary to BCD............................................................. 1-13
$CAL Call user defined subroutine and pass parameters............................................1-20
$CTD Count Down....................................................................................................3-3
$CTR Counter Reset ................................................................................................3-3
$CTS Set Counter Accumulator = Preset Value ..........................................................3-3
$CTU Count Up........................................................................................................3-3
$DECW Decrement word............................................................................................ 1-11
$DIV Divide floating point numbers, floating point result............................................. 1-17
$DIVW Divide two shorts, short result ........................................................................ 1-12
$DLY Wait for time-out ........................................................................................... 1-25
$DSBR Define user subroutine ...................................................................................1-20
$DTSK Define PLUS routine ......................................................................................1-21
$ELSE Alternative execution of a part of the program................................................... 1-26
$ENDIF End of alternative execution part of the program............................................... 1-26
$EQ Double equal comparison (I1 = I2)...................................................................1-31
$EQW Equal comparison of two words (I1 = I2).......................................................... 1-29
$ESBR Define End of user subroutine......................................................................... 1-20
$ETSK Define end of PLUS routine............................................................................ 1-21
$GE Double greater equal comparison (I1 >= I2)...................................................... 1-32
$GEW Greater equal word comparison (I1 >= I2)....................................................... 1-30
$GOTO Conditional jump to label................................................................................ 1-22
$GT Double greater than comparison (I1 > I2)......................................................... 1-32
$GTW Greater than comparison for words (I1 > I2) ..................................................... 1-30
$IF Conditional execution of a part of the program.................................................. 1-26
$IFWAIT Semaphore state inquiry................................................................................ 1-24
$INCW Increment word............................................................................................. 1-11
$LBL Define jump label .......................................................................................... 1-22
$LE Double less or equal comparison (I1 <= I2) ......................................................1-31
$LEW Less or equal comparison for words (I1 <= I2) ................................................1-29
$LT Double less than comparison (I1 < I2)............................................................. 1-31
$LTW Less than comparison for words (I1 < I2)......................................................... 1-29
$MOD Division remainder .........................................................................................1-13
$MUL Floating point multiplication............................................................................ 1-17
$MULW Multiply two shorts, short result...................................................................... 1-12
$NE Double not equal comparison (I1 <> I2)........................................................... 1-32
$NEG Negate word (2's complement).........................................................................1-9
$NEGD Invert sign of floating point number.................................................................. 1-15
$NEW Not equal comparison for words (I1 <> I2)........................................................ 1-30
$NOT Invert a 16 bit word (1's complement)................................................................1-9
$OR Boolean OR gate............................................................................................1-5
$ORW Bitwise logical OR 16 bit words ........................................................................1-8
$P1 Impulse on rising edge of inp I1 ...................................................................... 1-33
$P2 Divide by 2 element....................................................................................... 1-33
4 10 Series CNC PLUS Library - User Manual (09)
Preface
10 Series CNC PLUS Library - User Manual
$P3 Impulses on rising and falling edges of input signal I1....................................... 1-34
$R/S RS flip flop with RESET priority ........................................................................1-6
$RES Reset a 16 bit word to 0................................................................................. 1-10
$RESD Reset a floating point variable (to 0) ................................................................ 1-15
$S/R RS flip flop with SET priority .............................................................................1-7
$SEND SEND a semaphore ...................................................................................... 1-23
$SET Set a 16 bit word to a value ............................................................................1-10
$SETD Set a floating point variable to a value.............................................................. 1-15
$STRADD Concatenation of strings ................................................................................ 1-14
$SUB Subtract floating point numbers ...................................................................... 1-16
$SUBW Subtract two or more 16 bit words .................................................................. 1-12
$TIM Timer enabled .................................................................................................3-7
$TMR Timer Reset/Preset .........................................................................................3-7
$WAIT Wait on semaphore .......................................................................................1-23
$XCH Swap low and high byte in a 16 bit word ............................................................1-9
$XOR Boolean XOR gate...........................................................................................1-6
$XORW Bitwise XOR operation on 16 bit words..............................................................1-8
10 Series CNC PLUS Library - User Manual (09) 5
Preface
10 Series CNC PLUS Library - User Manual
FUNCTION REFERENCE LIST
$232_INIT: Initialize the RS 232 interface...........................................................................7-5
$232_RESE: Reset the RS 232 interface ............................................................................7-13
$232_RXD: Receive a data buffer via the RS-232 interface.................................................. 7-10
$232_RXS: Receive an ASCII string via the RS 232 interface.............................................. 7-12
$232_STAT: Get the RS-232 interface status ..................................................................... 7-14
$232_TERM: Set termination characters used in message handling........................................7-6
$232_TXD: Transmit data buffer via the RS 232 interface.....................................................7-8
$232_TXS: Transmit an ASCII string via the RS 232 interface...............................................7-9
$A_TO_ID: Requests conversion from process axis name to axis identifier.......................... 2-31
$AABORT: Abort a point-to-point-interpolator ......................................................................8-3
$ACLOSE: Close channel for point-to-point-interpolator .......................................................8-4
$ACOS: Calculate the angle for a given cosine ...............................................................4-6
$ACTOFFS: Request activation of a tool offset .....................................................................9-5
$ACTRES: Request an active reset to be executed........................................................... 13-2
$ANAIN: Read one of the analog input channels of the I/O processor module ...................7-16
$AOPEN: Open channel for point-to-point-interpolator ........................................................8-5
$ARESET: Request to reset a point-to-point-interpolator......................................................8-6
$ASIN: Calculate the angle for a given sine value...........................................................4-5
$ATAN: Calculate the angle for a given tangent value ......................................................4-7
$ATOF: Convert an ASCII string to a floating point number..............................................2-4
$ATOI: Convert an ASCII string to an integer number (16 bit)..........................................2-2
$AUX_STAT: Read the status of a point-to-point axis and the spindle.................................... 8-18
$AX_CHAS: Change the servo mode of an axis.................................................................. 12-4
$AX_DISA: Disable the servo loop of an axis or disable its D/A converter. .............................6-3
$AX_ENAB: Enable the servo loop of an axis or enable its D/A converter................................6-2
$AX_GET1: Get axis (spindle) servo parameters..............................................................12-15
$AX_GET2: Get axis (spindle) servo parameters..............................................................12-17
$AX_GET3: Get axis (spindle) servo parameters..............................................................12-20
$AX_GET4: Get axis (spindle) servo parameters..............................................................12-22
$AX_GET5: Get axis (spindle) servo parameters..............................................................12-24
$AX_GET6: Get axis (spindle) servo parameters..............................................................12-26
$AX_GET7: Get axis (spindle) servo parameters..............................................................12-28
$AX_GET8: Get axis (spindle) servo parameters..............................................................12-33
$AX_GETS: Get axis status...........................................................................................12-46
$AX_PROB: Enable probing signal for one or more axis ...................................................... 12-5
$AX_PUT1: Set axis servo parameter.............................................................................12-35
$AX_PUT2: Set axis servo parameter.............................................................................12-42
$AX_PUT3: Set axis servo parameter.............................................................................12-44
$AX_RDPB: Read the probed positions of one or more axis................................................. 12-6
$AX_RESE: Aborts the actual operation of the addressed axis............................................ 12-8
$AX_RPOS: Resets the axis' position..............................................................................12-13
$AX_SELE: Activate axis monitor functions / gear range...................................................12-11
$AX_SETZ: It allows the activation of different functions for the specified axis .....................12-14
$AX_ZSH1: Write PLUS zero shift offset #1 ...................................................................... 12-9
$AX_ZSH2: Write PLUS zero shift offset #2 ....................................................................12-10
$AXD_PUT: It sets the enable/disable bits of a digital drive associated with a D.S.I.
axis...........................................................................................................12-68
$AXD_RDD: It reads a numerical parameter from a digital drive associated to a D.S.I.
axis...........................................................................................................12-63
$AXD_RDS: It reads a string parameter from a digital drive associated to a D.S.I. axis.........12-66
$AXD_WRD: It writes a numerical parameter to a digital drive associated to a D.S.I. axis......12-65
6 10 Series CNC PLUS Library - User Manual (09)
Preface
10 Series CNC PLUS Library - User Manual
$AXD_WRS: It writes a string parameter to a digital drive as sociated to a D.S.I. axis............12-67
$AXMANFED: It sets the feedrate override for one or more axes in manual movement ...............5-41
$AXSELEC: Select one or more axes for manual operations ................................................5-16
$AXSELFED: It selects one or more axes allowing to change feedrate override ....................... 5-40
$AXTAN_D: It disables the tangent axis algorithm .............................................................6-14
$AXTAN_E: Tangent axis algorithm enabling ..................................................................... 6-12
$COMPOFF: Compute new axes offset .................................................................................9-7
$CON_LED: It manages the leds on the OPLink operator panel .........................................11-14
$COS: Calculates the cosine of an angle.....................................................................4-3
$CTOW: Convert a character to a word ...........................................................................2-9
$CYCLE: Request cycle start for a selected process ........................................................5-3
$CYSTART: Request cycle start for a selected process ........................................................5-2
$CYSTOP: Request cycle stop for the selected process .....................................................5-4
$DE_ETH: Enables or disables communication via Ethernet ...........................................13-10
$DIVF: Division of two short operands with a double result........................................... 2-29
$ENDRESE: Logic has finished reset actions ..................................................................... 5-19
$EXP: Calculates the power of “e” raised to the power of X..........................................4-11
$FAST_RD: Reads data from a dedicated DP area .............................................................13-8
$FAST_WR: Writes data in the DP dedicated area.............................................................. 13-6
$FAX_GET: Reads in real time axis parameters ...............................................................12-61
$FAX_PUT: Real time updating of an axis' zero shift value................................................12-59
$FAX_RCON: Configures the driver for real time data communication from AXES to PLUS...... 12-57
$FAX_WCON: Configures the driver for real time data communication from PLUS to AXES......12-55
$FEED_GO: Request the interpolator to exit the feedhold status ............................................5-6
$FEEDBYOF: Restore the programmed feedrate after feedrate bypass.................................... 5-32
$FEEDBYON: Activate feedrate bypass................................................................................ 5-30
$FEEDHLD: Request the interpolator to enter the feedhold status ..........................................5-5
$FOUT: Set fast output.............................................................................................. 7-17
$FRORIDE: Set process feedrate override percentage value ................................................5-11
$FTOA: Convert a floating point number to an ASCII string..............................................2-5
$FTOI: Convert a floating point format to an integer format .............................................2-7
$GBPROVAR: Get Boolean process variable .........................................................................10-3
$GET_INTP: Reads in real time a number of interpolator data............................................... 5-35
$GET_POSD: Read the position and feed rate of a point-to-point axis interfaced with the
DAC drive via a RS-232 serial line ...................................................................8-21
$GETAXINT: Get real axis position .................................................................................... 12-3
$GETEPAR: Get part program E parameter ........................................................................10-5
$GETHFL: Reads part program H parameter flag (HF)....................................................... 10-9
$GETHPAR: Get part program H parameter ........................................................................10-7
$GETPNTR: Get block numbers of the active part program and nested
subroutines/macros.......................................................................................5-22
$GETPPNAM: Get the names of the active part programs ...................................................... 5-20
$GETSC: Get ASCII global part program variable (SC)...................................................10-11
$GETSN: Get numerical global part program variable (SN) .............................................10-13
$GETUSED: Reads double process user variables ............................................................10-15
$GJOG: Read jog value.............................................................................................. 5-14
$GSYSDATE: Get system date.............................................................................................7-2
$GSYSTIME: Get system time .............................................................................................7-3
$HISPROC: Select a process to control............................................................................ 11-2
$HOLDOFF: Exit from hold status .......................................................................................5-8
$HOLDON: Entry in hold status.........................................................................................5-7
$HPG_OFF: It-disables the hand pulse generator (HPG)...................................................... 6-11
$HPG_ON: It activates the hand pulse generator (HPG) .......................................................6-9
10 Series CNC PLUS Library - User Manual (09) 7
Preface
10 Series CNC PLUS Library - User Manual
$HUM_ABI: It enables specified softkeys........................................................................11-10
$HUM_DIS: It disables specified softkeys .......................................................................11-12
$IBS_INP: Transfer of physical inputs from the INTERBUS modules to the
MW variables ................................................................................................7-35
$IBS_OUT: Transfer of the MW variables to the physical outputs of the
INTERBUS modules...................................................................................... 7-36
$I_STR: Copies a number of words to the ASCII array................................................... 2-27
$ID_TO_A: Conversion from physical axis identifier to ASCII axis name and its
process........................................................................................................ 2-32
$ILDGD: Indexed load of double from GD variables area................................................. 2-15
$ILDGW: Indexed load of word from GW word variables area........................................... 2-11
$ILDMD: Indexed load of a double from the MD variables memory area ............................2-14
$ILDMW: Indexed load of a word from the MW variables memory area.............................. 2-12
$ILDSW: Indexed load of the word from the SW word variables memory area.................... 2-13
$INDEX: Copy a range of M variables ........................................................................... 2-25
$INDEXA: Copy a range of ASCII variables ......................................................................2-24
$INTP_ABI: Enables the driver for real time reading of interpolator parameters...................... 5-33
$INTP_CMD: Send a command to the interpolator ............................................................... 5-42
$INTP_DIS: Disables the driver for real time reading of the interpolator parameters. ...............5-34
$INWORD: Read an n bit input word from the I/O ring ........................................................7-18
$ISTGD: Indexed storage of the input double to the GD variables memory area ...............2-19
$ISTGW: Indexed storage of the input word to the GW variables memory area .................2-16
$ISTMD: Indexed storage of the input double to the MD variables memory area ...............2-18
$ISTMW: Indexed storage of the input word to the MW variables memory area................. 2-17
$ITOA: Convert an integer number to an ASCII string .....................................................2-3
$ITOF: Convert a short variable to a double variable ......................................................2-8
$LOCKTAB: Set table interlock status (inhibit third party access)........................................ 13-3
$LOG10: Calculate the base 10 logarithm ..................................................................... 4-10
$LOGE: Calculates the natural logarithm .......................................................................4-9
$MANFEED: Sets manual feedrate override percentage .........................................................5-9
$MDI_CMD: Enter part program blocks from PLUS in the MDI buffer .................................... 5-25
$MTB_OFF: Disconnect an Pilot panel from a process........................................................ 11-9
$MTB_ON: Assign an Pilot panel to a process ................................................................. 11-7
$MULF: Multiply two short operands with double result................................................. 2-28
$NAXOFF: Activate new axes offset ..................................................................................9-8
$OUTWORD: Write an n bit output word to the I/O ring......................................................... 7-19
$PALMOVE: Move a point-to-point-axis................................................................................8-7
$POW: Calculates the power of X raised to Y ..............................................................4-12
$PP_BSRC: It positions the pointer on the active Part Program by n blocks, onwards or
backwards....................................................................................................5-38
$PP_EXEC: Request part program execution up to a defined block ......................................5-24
$PP_SELE: Select a part program for execution ................................................................ 5-23
$PP_TSRC: It finds the string inside the active part program................................................ 5-37
$PPRESUME: Request process to resume part program execution after calculation stop
request ........................................................................................................ 5-27
$PREC_OFF: Disable part program block precalculation ....................................................... 5-28
$PREC_ON: Enable part program block precalculation........................................................ 5-29
$RCM_MOD: It defines how the auxiliary functions are sent to the Plus logic during the
search in memory......................................................................................... 5-39
$RD_ADA: Reads an ADARING device A/D channel......................................................... 7-24
$RD_ASCII: Read ASCII input parameters of a task (indexed store of ACCUS in ASCII
buffer) .......................................................................................................... 2-21
$RESRIF: Reset axes homed flag ....................................................................................6-6
8 10 Series CNC PLUS Library - User Manual (09)
Preface
10 Series CNC PLUS Library - User Manual
$RIO_INP: Reads remote I/O inputs................................................................................ 7-33
$RIO_OUT: Write the remote I/O outputs ..........................................................................7-34
$RQESTOP: Request process E-STOP.............................................................................. 7-20
$RQRESET: Request process RESET............................................................................... 5-17
$RTIRES: Read RTI axes and spindle monitor table......................................................... 8-17
$SBPROVAR: Set Boolean process variable......................................................................... 10-4
$SCLOSE: Close RTI channel for spindle...........................................................................8-9
$SEL_SCR: It selects a screen ........................................................................................ 7-27
$SETCUSK: Set OEM softkey status; ON/OFF type........................................................... 11-3
$SETCUSL: Set OEM softkey status; Maintained, Data Entry and Normal ........................... 11-4
$SETEPAR: Set part program E parameter........................................................................ 10-6
$SETHFL: Sets part program HF flag ............................................................................10-10
$SETHINT: Set human interface protection bits................................................................. 11-5
$SETHPAR: Set part program H parameter........................................................................ 10-8
$SETMODE: Request mode of operation for a selected process ........................................... 5-13
$SETRANG: Select spindle gear range .............................................................................. 8-10
$SETRIF: Set axes homed flag .......................................................................................6-5
$SETSC: Set global ASCII part program "SC" variable ..................................................10-12
$SETSN: Set global numerical part program "SN" parameter .........................................10-14
$SETTEST: Set tes t mode / Reset test mode......................................................................6-8
$SG96RPM: Request G96 constant surface speed spindle control ....................................... 8-11
$SG97RPM: Set spindle speed in RPM ............................................................................. 8-13
$SIN: Calculate the sine of an angle ..........................................................................4-2
$SJOG: Write incremental jog value............................................................................ 5-15
$SOFTOTL: Enable /disable software overt ravel limits...........................................................6-4
$SOPEN: Open a channel for spindle management......................................................... 8-14
$SORIENT: Request spindle orientation ............................................................................8-15
$SPEPN: Request to energize the E-STOP relay(s)........................................................ 7-21
$SPORIDE: Forces process spindle speed override percentage value .................................. 5-12
$SQRT: Calculate the square root.................................................................................4-8
$SRESET: Request to reset a spindle............................................................................. 8-16
$STR_I: Copy ASCII characters from the ASCII buffer to the M variables......................... 2-26
$STR_LEN: Calculate string length................................................................................... 2-23
$STRCMP: Compare ASCII strings..................................................................................2-22
$STTRAVEL: Set coordinated axes hardware overtravel condition............................................6-7
$T_READ: Reads the timer status .................................................................................. 3-12
$T_START: Enables/disables PLUS timer......................................................................... 3-11
$TAN: Calculates the tangent of an angle ....................................................................4-4
$TBLGETD: Read double information from a system or user table........................................ 9-10
$TBLGETW: Read short information from a system or user table ............................................9-9
$TBLPUTD: Write double information to a system or to the user table.................................. 9-12
$TBLPUTW: Write short information to a system or to the user table ....................................9-11
$TBLSRCD: Request a table lookup (floating point entry).................................................... 9-13
$TBLSRCW: It requests a table search (short format field) ................................................... 9-15
$TC_CONF: It configures the transducer ERDC for read operations ....................................12-48
$TC_READ1: It reads the physical position of the transducer ..............................................12-50
$TC_WRIT: Set D/A Converter output .............................................................................12-52
$TCPACT: Enable/disable the Tool Center Point feature.................................................... 6-15
$TCPREAD: Reads the variables associated to the Tool Center Point................................... 6-18
$TCPWRT: Writes the variables associated to the Tool Center Point ...................................6-16
$TOOL_RD: Acquisition of the identifiers of the slave tools involved in multitool T
function programming.................................................................................... 9-17
$TOOLACT: Update axis table with new tool offset ...............................................................9-2
10 Series CNC PLUS Library - User Manual (09) 9
Preface
10 Series CNC PLUS Library - User Manual
$UNLKTAB: Cancel table interlock status (enable third party access).................................. 13-5
$URLFEED: Forces rapid feedrate override percentage........................................................ 5-10
$WARN_HIS: Displays a message defined by the user and stores it in system history............ 7-26
$WARNING: Display user defined error message..................................................................7-4
$WR_ADA: Writes an ADARING device D/A channel .........................................................7-22
$WR_ASCII: Write ASCII task output parameters (indexed loading of ACCUS from
ASCII buffer)................................................................................................. 2-20
$WRI_SCR: User-defined (PLUS screen) ...........................................................................7-30
$WTOC: Convert a word to character............................................................................ 2-10
END OF PREFACE
10 10 Series CNC PLUS Library - User Manual (09)
10 Series CNC PLUS Library - User Manual

INDEX

BASIC LANGUAGE FUNCTION BLOCKS
LINE ELEMENT ........................................................................................................1-3
BOOLEAN FUNCTION BLOCKS ...............................................................................1-5
FUNCTION BLOCKS FOR WORD OPERATIONS.......................................................1-8
FUNCTION BLOCKS FOR STRING OPERATIONS.....................................................1-14
FUNCTION BLOCKS FOR FLOATING POINT OPERATIONS ......................................1-15
PROGRAM FLOW CONTROL FUNCTION BLOCKS...................................................1-18
Subroutines ....................................................................................................1-18
PLUS PRE-DEFINED ROUTINES (TASKS).................................................................1-21
JUMPS....................................................................................................................1-22
TASK SYNCHRONIZATION BLOCKS ........................................................................1-23
CONDITIONAL EXECUTION OF BLOCKS .................................................................1-26
Application Note:.............................................................................................1-27
WORD COMPARISON FUNCTION BLOCKS ..............................................................1-29
FLOATING POINT COMPARISON FUNCTION BLOCKS ............................................1-31
COMPOSED FUNCTION BLOCKS ............................................................................1-33
Index
LANGUAGE EXTENSIONS
NUMBER AND FORMAT CONVERSIONS ..................................................................2-2
$ATOI: Convert an ASCII string to an integer number (16 bit)...............................2-2
$ITOA: Convert an integer number to an ASCII string ..........................................2-3
$ATOF: Convert an ASCII string to a floating point number ..................................2-4
$FTOA: Convert a floating point number to an ASCII string ..................................2-5
$FTOI: Convert a floating point format to an integer format ...................................2-7
$ITOF: Convert a short variable to a double variable............................................2-8
$CTOW: Convert a character to a word ..............................................................2-9
$WTOC: Convert a word to character.................................................................2-10
INDIRECT LOAD AND STORE ..................................................................................2-11
$ILDGW: Indexed load of word from GW word variables area ...............................2-11
$ILDMW: Indexed load of a word from the MW variables memory area..................2-12
$ILDSW: Indexed load of the word from the SW word variables memory
area ...............................................................................................................2-13
$ILDMD: Indexed load of a double from the MD variables memory area .................2-14
$ILDGD: Indexed load of double from GD variables area ......................................2-15
10 Series CNC PLUS Library - User Manual (09) i
Index
10 Series CNC PLUS Library - User Manual
$ISTGW: Indexed storage of the input word to the GW variables
memory area..................................................................................................2-16
$ISTMW: Indexed storage of the input word to the MW variables
memory area..................................................................................................2-17
$ISTMD: Indexed storage of the input double to the MD variables
memory area..................................................................................................2-18
$ISTGD: Indexed storage of the input double to the GD variables
memory area..................................................................................................2-19
$WR_ASCII: Write ASCII task output parameters (indexed loading of
ACCUS from ASCII buffer)...............................................................................2-20
$RD_ASCII: Read ASCII input parameters of a task (indexed store of
ACCUS in ASCII buffer) ..................................................................................2-21
STRING / CHARACTER HANDLING ..........................................................................2-22
$STRCMP: Compare ASCII strings ...................................................................2-22
$STR_LEN: Calculate string length...................................................................2-23
$INDEXA: Copy a range of ASCII variables.........................................................2-24
$INDEX: Copy a range of M variables .................................................................2-25
$STR_I: Copy ASCII characters from the ASCII buffer to the M variables...............2-26
$I_STR: Copies a number of words to the ASCII array.........................................2-27
ARITHMETICAL FUNCTIONS ...................................................................................2-28
$MULF: Multiply two short operands with double result.......................................2-28
$DIVF: Division of two short operands with a double result...................................2-29
SPECIAL CONVERSIONS ........................................................................................2-31
$A_TO_ID: Requests conversion from process axis name to axis
identifier..........................................................................................................2-31
$ID_TO_A: Conversion from physical axis identifier to ASCII axis
name and its process. .....................................................................................2-32
COUNTERS AND TIMERS
COUNTERS .............................................................................................................3-2
TIMERS...................................................................................................................3-5
TIMERS AND FB PROGRAMMING............................................................................3-7
$T_START: Enables/disables PLUS timer..........................................................3-11
$T_READ: Reads the timer status ....................................................................3-12
MATH LIBRARY FUNCTIONS
$SIN: Calculate the sine of an angle ..................................................................4-2
$COS: Calculates the cosine of an angle ...........................................................4-3
$TAN: Calculates the tangent of an angle ..........................................................4-4
$ASIN: Calculate the angle for a given sine value ................................................4-5
$ACOS: Calculate the angle for a given cosine ...................................................4-6
$ATAN: Calculate the angle for a given tangent value..........................................4-7
$SQRT: Calculate the square root.....................................................................4-8
$LOGE: Calculates the natural logarithm...........................................................4-9
$LOG10: Calculate the base 10 logarithm ..........................................................4-10
$EXP: Calculates the power of “e” raised to the power of X..................................4-11
$POW: Calculates the power of X raised to Y.....................................................4-12
NC RELATED FUNCTIONS
ii 10 Series CNC PLUS Library - User Manual (09)
Index
10 Series CNC PLUS Library - User Manual
$CYSTART: Request cycle start for a selected process ......................................5-2
$CYCLE: Request cycle start for a selected process ..........................................5-3
$CYSTOP: Request cycle stop for the selected process .....................................5-4
$FEEDHLD: Request the interpolator to enter the feedhold status........................5-5
$FEED_GO: Request the interpolator to exit the feedhold status .........................5-6
$HOLDON: Entry in hold status ........................................................................5-7
$HOLDOFF: Exit from hold status .....................................................................5-8
$MANFEED: Sets manual feedrate override percentage......................................5-9
$URLFEED: Forces rapid feedrate override percentage .......................................5-10
$FRORIDE: Set process feedrate override percentage value ................................5-11
$SPORIDE: Forces process spindle speed override percentage value...................5-12
$SETMODE: Request mode of operation for a selected process..........................5-13
$GJOG: Read jog value ....................................................................................5-14
$SJOG: Write incremental jog value..................................................................5-15
$AXSELEC: Select one or more axes for manual operations ................................5-16
$RQRESET: Request process RESET ..............................................................5-17
$ENDRESE: Logic has finished reset actions ....................................................5-19
$GETPPNAM: Get the names of the active part programs ...................................5-20
$GETPNTR: Get block numbers of the active part program and
nested subroutines/macros ..............................................................................5-22
$PP_SELE: Select a part program for execution ................................................5-23
$PP_EXEC: Request part program execution up to a defined block ......................5-24
$MDI_CMD: Enter part program blocks from PLUS in the MDI buffer ....................5-25
$PPRESUME: Request process to resume part program execution
after calculation stop request ............................................................................5-27
$PREC_OFF: Disable part program block precalculation .....................................5-28
$PREC_ON: Enable part program block precalculation .......................................5-29
$FEEDBYON: Activate feedrate bypass ............................................................5-30
$FEEDBYOF: Restore the programmed feedrate after feedrate bypass.................5-32
$INTP_ABI: Enables the driver for real time reading of interpolator
parameters. ...............................................................................................5-33
$INTP_DIS: Disables the driver for real time reading of the
interpolator parameters. ...................................................................................5-34
$GET_INTP: Reads in real time a number of interpolator data ..............................5-35
$PP_TSRC: It finds the string inside the active part program................................5-36
$PP_BSRC: It positions the pointer on the active Part Program by n
blocks, onwards or backwards..........................................................................5-37
$RCM_MOD: It defines how the auxiliary functions are sent to the
Plus logic during the search in memory.............................................................5-38
$AXSELFED: It selects one or more axes allowing to change feedrate override 5-39 $AXMANFED: It sets the feedrate override for one or more axes in
manual movement ...........................................................................................5-40
$INTP_CMD: Send a command to the interpolator..............................................5-41
AXIS MOTION FUNCTIONS
$AX_ENAB: Enable the servo loop of an axis or enable its D/A
converter.........................................................................................................6-2
$AX_DISA: Disable the servo loop of an axis or disable its D/A
converter.........................................................................................................6-3
$SOFTOTL: Enable /disable software overtravel limits.........................................6-4
$SETRIF: Set axes homed flag .........................................................................6-5
10 Series CNC PLUS Library - User Manual (09) iii
Index
10 Series CNC PLUS Library - User Manual
$RESRIF: Reset axes homed flag .....................................................................6-6
$STTRAVEL: Set coordinated axes hardware overtravel condition ........................6-7
$SETTEST: Set test mode / Reset test mode....................................................6-8
$HPG_ON: It activates the hand pulse generator (HPG)......................................6-9
$HPG_OFF: It-disables the hand pulse generator (HPG).....................................6-11
$AXTAN_E: Tangent axis algorithm enabling ......................................................6-12
$AXTAN_D: It disables the tangent axis algorithm .............................................6-14
$TCPACT: Enable/disable the Tool Center Point feature ......................................6-15
$TCPWRT: Writes the variables associated to the Tool Center Point....................6-16
$TCPREAD: Reads the variables associated to the Tool Center Point ..................6-18
GENERAL PURPOSE FUNCTIONS
$GSYSDATE: Get system date........................................................................7-2
$GSYSTIME: Get system time .........................................................................7-3
$WARNING: Display user defined error message ...............................................7-4
$232_INIT: Initialize the RS 232 interface ...........................................................7-5
$232_TERM: Set termination characters used in message handling .....................7-6
$232_TXD: Transmit data buffer via the RS 232 interface.....................................7-8
$232_TXS: Transmit an ASCII string via the RS 232 interface...............................7-9
$232_RXD: Receive a data buffer via the RS-232 interface...................................7-10
$232_RXS: Receive an ASCII string via the RS 232 interface...............................7-12
$232_RESE: Reset the RS 232 interface...........................................................7-13
$232_STAT: Get the RS-232 interface status .....................................................7-14
$ANAIN: Read one of the analog input channels of the I/O processor
module...........................................................................................................7-16
$FOUT: Set fast output ....................................................................................7-18
$INWORD: Read an n bit input word from the I/O ring .........................................7-19
$OUTWORD: Write an n bit output word to the I/O ring.......................................7-20
$RQESTOP: Request process E-STOP.............................................................7-21
$SPEPN: Request to energize the E-STOP relay(s)...........................................7-22
$WR_ADA: Writes an ADARING device D/A channel..........................................7-23
$RD_ADA: Reads an ADARING device A/D channel ...........................................7-25
$WARN_HIS: Displays a message defined by the user and stores it
in system history.............................................................................................7-27
$SEL_SCR: It selects a screen ........................................................................7-28
$WRI_SCR: User-defined (PLUS screen) ...........................................................7-31
$RIO_INP: Reads remote I/O inputs..................................................................7-34
$RIO_OUT: Write the remote I/O outputs ...........................................................7-35
$IBS_INP: Transfer of physical inputs from the INTERBUS modules to
the MW variables ...........................................................................................7-36
$IBS_OUT: Transfer of the MW variables to the physical outputs of
the INTERBUS modules..................................................................................7-37
POINT-TO-POINT-AXES / SPINDLE LIBRARY
$AABORT: Abort a point-to-point-interpolator .....................................................8-3
$ACLOSE: Close channel for point-to-point-interpolator .......................................8-4
$AOPEN: Open channel for point-to-point-interpolator.........................................8-5
$ARESET: Request to reset a point-to-point-interpolator .....................................8-6
$PALMOVE: Move a point-to-point-axis .............................................................8-7
$SCLOSE: Close RTI channel for spindle...........................................................8-9
iv 10 Series CNC PLUS Library - User Manual (09)
$SETRANG: Select spindle gear range..............................................................8-10
$SG96RPM: Request G96 constant surface speed spindle control.......................8-11
$SG97RPM: Set spindle speed in RPM.............................................................8-13
$SOPEN: Open a channel for spindle management ............................................8-14
$SORIENT: Request spindle orientation.............................................................8-15
$SRESET: Request to reset a spindle ...............................................................8-16
$RTIRES: Read RTI axes and spindle monitor table ............................................8-17
$AUX_STAT: Read the status of a point-to-point axis and the spindle ...................8-18
$GET_POSD: Read the position and feed rate of a point-to-point axis
interfaced with the DAC drive via a RS-232 serial line..........................................8-21
OFFSET AND TOOLS HANDLING
$TOOLACT: Update axis table with new tool offset .............................................9-2
$ACTOFFS: Request activation of a tool offset ...................................................9-5
$COMPOFF: Compute new axes offset .............................................................9-8
$NAXOFF: Activate new axes offset ..................................................................9-9
$TBLGETW: Read short information from a system or user table.........................9-10
$TBLGETD: Read double information from a system or user table ........................9-11
$TBLPUTW: Write short information to a system or to the user table ...................9-12
$TBLPUTD: Write double information to a system or to the user table..................9-13
$TBLSRCD: Request a table lookup (floating point entry)....................................9-14
$TBLSRCW: It requests a table search (short format field) ..................................9-16
$TOOL_RD: Acquisition of the identifiers of the slave tools involved in
multitool T function programming.......................................................................9-18
Index
10 Series CNC PLUS Library - User Manual
PROCESS/SYSTEM VARIABLES HANDLING
$GBPROVAR: Get Boolean process variable.....................................................10-3
$SBPROVAR: Set Boolean process variable......................................................10-4
$GETEPAR: Get part program E parameter.......................................................10-5
$SETEPAR: Set part program E parameter........................................................10-6
$GETHPAR: Get part program H parameter.......................................................10-7
$SETHPAR: Set part program H parameter........................................................10-8
$GETHFL: Reads part program H parameter flag (HF) .........................................10-9
$SETHFL: Sets part program HF flag ................................................................10-10
$GETSC: Get ASCII global part program variable (SC) ........................................10-11
$SETSC: Set global ASCII part program "SC" variable ........................................10-12
$GETSN: Get numerical global part program variable (SN)...................................10-13
$SETSN: Set global numerical part program "SN" parameter ...............................10-14
$GETUSED: Reads double process user variables .............................................10-15
HUMAN INTERFACE
$HISPROC: Select a process to control ............................................................11-2
$SETCUSK: Set OEM softkey status; ON/OFF type..........................................11-3
$SETCUSL: Set OEM softkey status; Maintained, Data Entry and
Normal ...........................................................................................................11-4
$SETHINT: Set human interface protection bits..................................................11-5
$MTB_ON: Assign an Pilot panel to a process ...................................................11-7
$MTB_OFF: Disconnect an Pilot panel from a process .......................................11-9
10 Series CNC PLUS Library - User Manual (09) v
Index
10 Series CNC PLUS Library - User Manual
$HUM_ABI: It enables specified softkeys...........................................................11-10
$HUM_DIS: It disables specified softkeys ..........................................................11-12
$CON_LED: It manages the leds on the OPLink operator panel...........................11-14
AXES RELATED FUNCTIONS
$GETAXINT: Get real axis position ....................................................................12-3
$AX_CHAS: Change the servo mode of an axis..................................................12-4
$AX_PROB: Enable probing signal for one or more axis......................................12-5
$AX_RDPB: Read the probed positions of one or more axis.................................12-6
$AX_RESE: Aborts the actual operation of the addressed axis............................12-8
$AX_ZSH1: Write PLUS zero shift offset #1 .......................................................12-9
$AX_ZSH2: Write PLUS zero shift offset #2 .......................................................12-10
$AX_SELE: Activate axis monitor functions / gear range.....................................12-11
$AX_RPOS: Resets the axis' position ...............................................................12-13
$AX_SETZ: It allows the activation of different functions for the
specified axis ...............................................................................................12-14
$AX_GET1: Get axis (spindle) servo parameters .................................................12-15
$AX_GET2: Get axis (spindle) servo parameters .................................................12-17
$AX_GET3: Get axis (spindle) servo parameters .................................................12-20
$AX_GET4: Get axis (spindle) servo parameters .................................................12-22
$AX_GET5: Get axis (spindle) servo parameters .................................................12-24
$AX_GET6: Get axis (spindle) servo parameters .................................................12-26
$AX_GET7: Get axis (spindle) servo parameters .................................................12-28
$AX_GET8: Get axis (spindle) servo parameters .................................................12-33
$AX_PUT1: Set axis servo parameter................................................................12-35
Notes concerning the “STANDSTILL-GAIN” parameter.........................................12-41
$AX_PUT2: Set axis servo parameter................................................................12-42
$AX_PUT3: Set axis servo parameter................................................................12-44
$AX_GETS: Get axis status .............................................................................12-46
$TC_CONF: It configures the transducer ERDC for read operations ......................12-48
$TC_READ1: It reads the physical position of the transducer...............................12-50
$TC_WRIT: Set D/A Converter output ................................................................12-52
$FAX_WCON: Configures the driver for real time data communication
from PLUS to AXES.........................................................................................12-55
$FAX_RCON: Configures the driver for real time data communication
from AXES to PLUS .........................................................................................12-57
$FAX_PUT: Real time updating of an axis' zero shift value ...................................12-59
$FAX_GET: Reads in real time axis parameters .................................................12-61
$AXD_RDD: It reads a numerical parameter from a digital drive
associated to a D.S.I. axis...............................................................................12-63
$AXD_WRD: It writes a numerical parameter to a digital drive
associated to a D.S.I. axis...............................................................................12-65
$AXD_RDS: It reads a string parameter from a digital drive
associated to a D.S.I. axis...............................................................................12-66
$AXD_WRS: It writes a string parameter to a digital drive associated to a D.S.I. axis 12-67 $AXD_PUT: Sets Control Word bits of a digital drive associated with a D.S.I. axis 12-68
vi 10 Series CNC PLUS Library - User Manual (09)
SPECIAL FUNCTIONS
$ACTRES: Request an active reset to be executed ............................................13-2
$LOCKTAB: Set table interlock status (inhibit third party access) ........................13-3
$UNLKTAB: Cancel table interlock status (enable third party access)..................13-5
$FAST_WR: Writes data in the DP dedicated area .............................................13-6
$FAST_RD: Reads data from a dedicated DP area.............................................13-8
$DE_ETH: enables or disables communication via Ethernet ................................13-10
PLUS PRE-DEFINED SYMBOLS
Pre-defined logic routine names ........................................................................A-2
Pre-defined logic interface routines....................................................................A-3
Names suggested for global system variables ....................................................A-4
Names suggested for process pre-defined variables ............................................A-6
Names suggested for fields and tables ..............................................................A-9
Index
10 Series CNC PLUS Library - User Manual
NC MESSAGES
ERROR CODES DISPLAYED IN THE NC ENVIRONMENT ...........................................B-1
POINT-TO-POINT AXES / SPINDLE MESSAGES
POINT-TO-POINT AXES / SPINDLE MESSAGES .......................................................C-1
AVAILABLE TABLES
AVAILABLE TABLES ...............................................................................................D-1
Axes table......................................................................................................D-1
Tool table........................................................................................................D-2
Tool offset table ...............................................................................................D-2
User table .......................................................................................................D-2
HUMAN INTERFACE AND PLUS RELATED MESSAGES
Human Interface Related Messages .................................................................E-1
PLUS Related Messages .................................................................................E-1
ERROR MESSAGES FOR THE D.S.I. INTERFACE
Error List ........................................................................................................F-1
MESSAGES FOR POINT TO POINT AXIS CONTROLLED VIA RS­232 SERIAL LINE
Serial Driver ....................................................................................................G-1
DAC/DSC Osai Drive .......................................................................................G-2
10 Series CNC PLUS Library - User Manual (09) vii
Index
10 Series CNC PLUS Library - User Manual
END OF INDEX
viii 10 Series CNC PLUS Library - User Manual (09)
Chapter
1
BASIC LANGUAGE FUNCTION BLOCKS
The basic language function blocks are the direct equivalents of the corresponding instruction list elements. Every time you use one of these function blocks, its internal (IL) code will be inserted in your program. In this sense the basic language function block behave like macros. The function blocks discussed in this chapter do not call any functions. Each one of the sections in this chapter covers a group of function blocks which all work on the identical data format.
Those function blocks which internally use a system function call are covered in the other chapters of this manual. They are called language extensions because they expand the capabilities of the language beyond the capabilities of the single instructions.
For each of the basic language function blocks you will find a table which contains the attributes of the inputs and outputs of a function block. The columns in this table are:
NAME : Name of the connection INVERSION : Indicates whether the input or output can be logically inverted. This attribute
is only available for Boolean connections.
DUPLICATION : If this attribute shows yes, you are allowed to make one or more copies of
this connection. Each one of the copied connections will have the same attributes as the original and the connected variable will be processed just like the original variable.
FORMAT : The format of an operand to be connected to an input or an output can be
one of:
Boolean only bits allowed short 16 bit integer operand double 64 bit floating point operand char string or string constant all no check, all formats possible special for special operands NAM and LAB only
As you enter an operand for a function block, it will be checked if it matches the required format.
GROUP : The different types of operands are divided into groups. For certain function
block connections some groups will be excluded (e.g. it is not allowed to connect an input to a Boolean function block output). The letters in this column indicate which type of operand may be used:
10 Series CNC PLUS Library - User Manual (08) 1-1
Chapter 1
WARNING
Basic Language Function Blocks
M M variables (depending on the format you must select M Boolean
MW -> short MD -> double).
G global retentive G variables (depending on the format you must
select G -> Boolean, GW -> short or GD -> double).
S System flags or S variables. (again, select the S or SW
depending on the format of the connection; S -> Boolean or SW ­> short)
T Timer variables. T or TW depending on the format (T -> Boolean,
TW -> short).
C Counter variables. C or CW depending on the format (C ->
Boolean, CW short).
K Constants. KB -> Boolean, KW or KH -> short, KD -> double. X local variables. Select X -> Boolean, XW -> short or XD -> double,
depending on the format of the connection.
Y subroutine parameters. select Y -> Boolean, YW -> short or YD -
> double in accordance with the format of the connection.
A ASCII string variable. #" Text constants. NAM subroutine names, PLUS routine names LAB label names
Double constants (KD) are defined with the following format:
KD ± x.yyyyE ± zzz
The decimal part yyyy must always be written in full (4 figures).
1-2 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
IMPORTANT
Basic Language Function Blocks

LINE ELEMENT

The line element can be used to "connect" a variable or a constant (left side) with one or more other variables (right side). The variables (constants) on both sides must have the same type (i.e. short). The line element is only available to connect Boolean, short and double variables and constants.
Examples:
short constant c onnected to short variable s
KH00FF
Boolean constant connect ed to boolean variables
KB1 O 24,03
Short constant connected to a timer preset word
KW100 TW 020
MW 200 MW 201
G 010,00
.
Of course you cannot connect inputs and/or constants to the right side of a line element. For an explanation of how to insert a line element please refer to the Plusedit manual.
When you design a logic program using Function Blocks please consider some rules related to “broken” Line Elements. We will explain this using an example:
GD 00 I 00,00
SE TD I1 En
O1
GD 01
The use of a 'broken' line element in this example forces the PLUS development package to assign an automatic variable (MD 151) for this line. This variable will always be assigned to the destination variable GD 1, independent of the status of I 00,00. The translation of the block shows clearly why:
rec. word instr. operand symbol comment
00001 ; Assignment with broken line 00005 L I 00,00 00006 AND( 00007 LD GD 00 00008 = MD 151 00009 )
00002 00010 L MD 151 00015 = GD 01
10 Series CNC PLUS Library - User Manual (08) 1-3
Chapter 1
Basic Language Function Blocks
As you can see, the assignment of MD 115 to GD 01 is not conditioned by the input I 00,00 of the Function Block SETD.
To avoid this probably undesired behaviour you should connect the destination variable GD 01 using a straight line:
G D 00 I 0 0,0 0
S E T D I1 E n
G D 0 1
Using this straight connection, the translation in IL does not require an automatic variable:
rec. word instr. operand symbol comment
00000 ; Assignment with straight line 00000 L I 00,00 00001 AND( 00002 LD GD 00 00003 = GD 01 00004 )
Please keep in mind these considerations when using FB programming:
The use of 'broken' line elements as explained above can cause 'abnormal' behaviour of your logic
program. Problems due to an unwanted assignment as in above example
Broken' line elements use automatic variables and generate extra code which requires more
memory and more execution time.
Avoid to use 'broken' line elements to keep your logic as fast as possible.
1-4 10 Series CNC PLUS Library - User Manual (08)
Basic Language Function Blocks

BOOLEAN FUNCTION BLOCKS

$=N BOOLEAN INVERTER
=N
I1 O1
name inversion duplication format group
I1 YES NO Boolean I O M G S X Y T C K
O1 YES YES Boolean O M G S X Y
$AND BOOLEAN AND GATE TRUTH TABLE
AND I1
I20
AND
O1
I20I1
0 0
1
0
Chapter 1
O1
0
0
1
0 1 1
Connection attributes:
name inversion duplication format group
I1 YES NO Boolean I O M G S X Y T C K I2 YES YES Boolean I O M G S X Y T C K
O1 YES NO Boolean O M G S X Y
The output O1 will be true when Boolean input I1 and I20 are true.
$OR BOOLEAN OR GATE TRUTH TABLE
OR I1
I20
O1
OR
I20I1
0 0 0
1
0 1 1
0 1
O1
0
1
1
1 1
10 Series CNC PLUS Library - User Manual (08) 1-5
Chapter 1
Basic Language Function Blocks
Connection attributes:
name inversion duplication format group
I1 YES NO Boolean I O M G S X Y T C K I2 YES YES Boolean I O M G S X Y T C K
O1 YES NO Boolean O M G S X Y
The output O1 will be true when either Boolean input I1 or I20 or both are true.
$XOR BOOLEAN XOR GATE TRUTH TABLE
XOR XO R I1I2O1
0 0 0
1
0 1 1
I2I1
O1
0
1
1
1
0
name inversion duplication format group
I1 YES NO Boolean I O M G S X Y T C K I2 NO NO Boolean I O M G S X Y T C K
O1 NO NO Boolean O M G S X Y
The output O1 will be true when either Boolean input I1 or Boolean input I2 is true.
$R/S RS FLIP FLOP WITH RESET PRIORITY TRUTH TABLE
R S Q
R/S
R S
Q
R/S
0 0
1
0 1 1
NC = No Change
N C
0
0
1
Connection attributes:
name inversion duplication format group
1 0
R YES NO Boolean I O M G S X Y T C S YES NO Boolean I O M G S X Y T C Q NO NO Boolean O M G S X Y
1-6 10 Series CNC PLUS Library - User Manual (08)
Basic Language Function Blocks
$S/R RS FLIP FLOP WITH SET PRIORITY TRUTH TABLE
Chapter 1
S/R
S Q R
Connection attributes:
name inversion duplication format group
R YES NO Boolean I O M G S X Y T C S YES NO Boolean I O M G S X Y T C Q NO NO Boolean O M G S X Y
S/R
0 0
1
1 1
NC = No Change
RS Q
001
1
NC
0 1
10 Series CNC PLUS Library - User Manual (08) 1-7
Chapter 1
Basic Language Function Blocks

FUNCTION BLOCKS FOR WORD OPERATIONS

$ORW BITWISE LOGICAL OR 16 BIT WORDS
O R W I1
I20
O 1
E X A M P L E : I1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 1 1 ( 1 3 7 3 5 ) I20 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 (17 9 6 1 ) O 1 0 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 ( 3 0 6 3 9 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I20 NO YES short M G S X Y T C K O1 NO NO short M G S X Y T C
$ANDW BITWISE LOGICAL AND ON 16 BIT WORDS
ANDW I1
I20
O1
E X A M P L E : I1
I20 O1
0011 0101 1010 0111 0100 0110 0010 1001 0000 0100 0010 0001
Connection attributes:
name inversion duplication format group
(13735) (17961) (1057)
I1 NO NO short M G S X Y T C K I20 NO YES short M G S X Y T C K O1 NO NO short M G S X Y T C
$XORW BITWISE XOR OPERATION ON 16 BIT WORDS
X O RW I1
I2
O 1
E X A M P L E : I1 0 0 1 1 010 1 101 0 01 1 1 (13 7 3 5 ) I2 0 1 0 0 011 0 001 0 10 0 1 (17 9 6 1 ) O 1 0 1 1 1 001 1 100 0 11 1 0 (2 9 5 8 2 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
I2 NO NO short M G S X Y T C K O1 NO NO short M G S X Y T C
1-8 10 Series CNC PLUS Library - User Manual (08)
$XCH SWAP LOW AND HIGH BYTE IN A 16 BIT WORD
Chapter 1
Basic Language Function Blocks
XCH I1 O1
E X A M P L E : I1 : 0 0 1 1 010 1 10 1 0 01 1 1 (13 7 3 5 ) O 1 : A F T E R "x c h " 1 0 1 0 0111 001 1 01 0 1 ( -2 2 7 3 1 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
O1 NO NO short M G S X Y T C
$NOT INVERT A 16 BIT WORD (1'S COMPLEMENT)
NOT I1 O1
E X A M P L E : I1 : 0 0 1 1 010 1 10 1 0 01 1 1 (1 3 7 3 5 ) O 1 : A F T E R "N O T " 110 0 101 0 01 0 1 10 0 0 (-13 7 3 6 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
O1 NO YES short M G S X Y T C
$NEG NEGATE WORD (2'S COMPLEMENT)
N EG I1 O1
E X A M P L E : I1: 001 1 01 0 1 10 1 0 0 1 1 1 (1 3 7 3 5 ) O 1 : A FT E R "N E G " 1 1 0 0 10 1 0 0 1 0 1 1 0 0 1 (-1 3 7 3 5 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
O1 NO YES short M G S X Y T C
$<< LOGICALLY SHIFT 16 BIT WORD SC PLACES LEFT
E X A M P L E :
< < I1
S C
O 1
T h e u p p e r 4 bits fro m t h e a c cu m u la tor a re se t to z e ro . I1:
O 1 : a f ter 4 b it rig h t shift 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 0 ( 2 3 1 5 2 ) the sh i f t cou n t sc m u st h a ve a v a lu e in th e ra n g e of 0 - 1 6 .
0 0 1 1 0 1 0 1 101 0 011 1 ( 1 3 7 3 5 )
10 Series CNC PLUS Library - User Manual (08) 1-9
Chapter 1
Basic Language Function Blocks
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
sc NO NO short M G S X Y T C K
O1 NO NO short M G S X Y T C
$>> LOGICALLY SHIFT 16 BIT WORD SC PLACES RIGHT
E X A M P L E :
> > I1
S C
O 1
T h e u p p e r 4 bits fro m t h e a c cu m u la tor a re se t to z e ro . I1:
O 1 : a f ter 4 b it rig h t shift 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 0 ( 0 0 8 5 8 ) the sh i f t cou n t sc m u st h a ve a v a lu e in th e ra n g e of 0 - 1 6 .
0 0 1 1 0 1 0 1 101 0 011 1 ( 1 3 7 3 5 )
name inversion duplication format group
I1 NO NO short M G S X Y T C K
sc NO NO short M G S X Y T C K
O1 NO NO short M G S X Y T C
$RES RESET A 16 BIT WORD TO 0
RE S
O1
En
Connection attributes:
name inversion duplication format group
En YES NO boolean I O M G S X Y T C K
O1 NO YES Short M G S X Y T C
$SET SET A 16 BIT WORD TO A VALUE
SET
I1
En
O1
NOTE:
The output branch must be a straight line (see page 1-3)
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
En YES NO Boolean I O M G S X Y T C K
O1 NO YES short M S X Y G T C
1-10 10 Series CNC PLUS Library - User Manual (08)
$INCW INCREMENT WORD
Chapter 1
Basic Language Function Blocks
INCW I1
O 1
E X A M P L E : I1:
001 1 0101 101 0 011 1
O 1 : 0 0 1 1 0 1 0 1 10 1 0 1 0000
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K
O1 NO NO short M G S X Y T C
$DECW DECREMENT WORD
D E C W I1 O 1
E X A M P L E : I1: 001 1 01 0 1 10 1 0 0 1 1 1 (1 3 7 3 5 ) O 1 : 0 0 1 1 0 1 0 1 1 0 1 0 01 1 0 (1 3 7 3 4 )
name inversion duplication format group
I1 NO NO Short M G S X Y T C K
(13735) (13736)
O1 NO NO Short M G S X Y T C
$ADDW ADD TWO OR MORE 16 BIT WORDS
A D D W I1
I20
0 1
E X A M P L E : I1: 001 1 01 0 1 10 1 0 0 1 1 1 (1 3 7 3 5 ) I20: 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 (1 7 9 6 1 ) O 1 : 0 1 1 1 1 0 1 1 1 1 0 1 00 0 0 (3 1 6 9 6 )
name inversion duplication format group
I1 NO NO short M G S X Y T C K I20 NO YES short M G S X Y T C K O1 NO NO short M S X Y G T C
10 Series CNC PLUS Library - User Manual (08) 1-11
Chapter 1
Basic Language Function Blocks
$SUBW SUBTRACT TWO OR MORE 16 BIT WORDS
S U B W I1
I20
O 1
E X A M P L E : I1: 0 0 1 1 0 1 0 1 1 0 1 0 01 1 1 (1 3 7 3 5 ) I20: 01 0 0 0 1 1 0 0 0 1 0 1 0 0 1 (1 7 9 6 1 ) O 1 : 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 (-4 2 2 6 )
name inversion duplication format group
I1 NO NO short M G S X Y T C K I20 NO YES short M G S X Y T C K O1 NO NO short M G S X Y T C
$MULW M ULTIPLY TWO SHORTS, SHORT RESULT
M U L W
MU1
O 1
MU2
E X A M P L E : I1 0 0 0 0 01 0 1 10 1 0 0 1 1 1 ( 0 1 4 4 7 )
I2 0 0 0 0 00 0 0 00 0 0 1 0 0 1 ( 0 0 0 0 9 )
O 1 0 0 1 1 001 0 110 1 11 1 1 (1 3 0 2 3 )
Connection attributes:
name inversion duplication format group
MU1 NO NO short M G S X Y T K MU2 NO NO short M G S X Y T K
O1 NO NO short M G S X Y
$DIVW DIVIDE TWO SHORTS, SHORT RESULT
D IVW
I1
O 1
I2
E X A M P L E : I1 0 0 1 1 01 0 1 10 1 0 0 1 1 1 (1 3 7 3 5 )
I2 0 0 0 0 00 1 1 11 1 0 1 0 0 0 ( 0 1 0 0 0 )
O 1 0 0 0 0 000 0 000 0 11 0 1 (0 0 0 1 3 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T K
I2 NO NO short M G S X Y T K O1 NO NO short M G S X Y
1-12 10 Series CNC PLUS Library - User Manual (08)
$MOD DIVISION REMAINDER
Chapter 1
Basic Language Function Blocks
M O D
I1
O 1
I2
E X A M P L E :
I1 0 0 1 1 01 0 1 10 1 0 0 1 1 1 (1 3 7 3 5 ) I2 0 0 0 0 00 1 1 11 1 0 1 0 0 0 ( 0 1 0 0 0 )
O 1 0 0 0 0 001 0 110 1 11 1 1 (0 0 7 3 5 )
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO short M G S X Y T C
$BIN_BCD CONVERT AN INTEGER FROM BINARY TO BCD
B IN_B C D
B IN B C D
E X A M P L E : B IN (3 5 7 9 b i
B C D 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 (1 3 6 8 9 b
0 0 0 0 1 1 0 1 1 1 1 1 10 1 1
3 5 7 9 (3 5 7 9 B
Connection attributes
name inversion duplication format group
n a ry)
C D )
in a ry)
BIN NO NO Short M G S X Y T C K
BCD NO NO Short M G S X Y T C
$BCD_BIN CONVERT AN INTEGER FROM BCD TO BINARY
BCD_BIN
BCD BIN
E X A M P L E : B C D 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 ( 1 3735)8 B IN (13736 binary)
0 0 0 0 1 1 0 1 111 1 101 1
Connection attributes
name inversion duplication format group
BCD NO NO Short M G S X Y T C K
BIN NO NO Short M G S X Y T C
C D )3 5 7 9 ( 3 5 7 9 B
10 Series CNC PLUS Library - User Manual (08) 1-13
Chapter 1
Basic Language Function Blocks

FUNCTION BLOCKS FOR STRING OPERATIONS

$STRADD CONCATENATION OF STRINGS
STRADD Sti
Sto
+0 St0 En
Connection attributes:
name inversion duplication format group
Sti NO NO char A #"
+0 YES YES Boolean I O M G S X Y T C K St0 NO YES char A #" Sto NO NO char A
En YES NO Boolean I O M G S X Y T C K
With this function block you can concatenate strings. The strings to be concatenated may be string constants (#") or strings from the ASCII-array in memory. The resulting string Sto is always stored in the ASCII-Array. The Boolean inputs +n can be used to select the strings to be concatenated with string Sti.
Example:
#"This is a I 01,00
#" useful I 01,01 #" simple I 01,02 #" example I 01,03
STRADD Sti
+0
St0 +1 St1 +2 St2
En
Sto
A 00200,033
When we assume that En is true, then the resulting output string in the above example depends on +0, +1 and +2:
+0 +1 +2 Resulting string 0 0 0 "This is a"
1 0 0 "This is a useful" 0 1 0 "This is a simple" 1 1 0 "This is a useful simple" 0 0 1 "This is an example" 1 0 1 "This is a useful example" 0 1 1 "This is a simple example" 1 1 1 "This is a useful simple example "
1-14 10 Series CNC PLUS Library - User Manual (08)

FUNCTION BLOCKS FOR FLOATING POINT OPERATIONS

$RESD RESET A FLOATING POINT VARIABLE (TO 0)
RESD En
Connection attributes:
name inversion duplication format group
En YES NO Boolean I O M G S X Y T C K
01 NO NO double M G X Y
$SETD SET A FLOATING POINT VARIABLE TO A VALUE
O1
Chapter 1
Basic Language Function Blocks
SETD
I1
E n
O 1
NOTE:
The output branch must be a staight line (see page 1-3)
Connection attributes:
name inversion duplication format group
I1 NO NO double M G X Y K
En YES NO Boolean I O M G S X Y T C K
O1 NO YES double M G X Y
$NEGD INVERT SIGN OF FLOATING POINT NUMBER
NEG D I1
O1
Connection attributes:
name inversion duplication format group
I1 NO NO double M G X Y K
01 NO YES double M G X Y
10 Series CNC PLUS Library - User Manual (08) 1-15
Chapter 1
Basic Language Function Blocks
$ADD ADD TWO OR MORE FLOATING POINT NUMBERS
The "ADD" function block adds the value of the I20 operand to the floating point operand I1 and stores the result in O1.
ADD I1
I20
O1
Connection attributes:
name inversion duplication format group
I1 NO NO double M G X Y K I20 NO YES double M G X Y K O1 NO NO double M G X Y
$SUB SUBTRACT FLOATING POINT NUMBERS
The "SUB" function block subtracts the value of the constant or variable floating point operand I20 from the floating point operand I1 and stores the result in 01
SUB I1
I20
O1
Connection attributes:
name inversion duplication format group
I1 NO NO double M G X Y K I20 NO YES double M G X Y K O1 NO NO double M G X Y
1-16 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
Basic Language Function Blocks
$MUL FLOATING POINT MULTIPLICATION
The "MUL" function block multiplies the contents of the floating point operand I1 with the value of the constant or variable floating point operand I20 and stores the result in O1.
MUL I1
I20
O1
Connection attributes:
name inversion duplication format group
I1 NO NO double M G X Y K I20 NO YES double M G X Y K O1 NO NO double M G X Y
$DIV DIVIDE FLOATING POINT NUMBERS, FLOATING POINT RESULT
The "DIV" function block divides the contents of the floating point operand I1 with the value of the constant or variable floating point operand I20 and stores the floating point result in
DIV I1
I20
O1
Connection attributes:
name inversion duplication format group
I1 NO NO double M G X Y K I20 NO YES double M G X Y K O1 NO NO double M G X Y
10 Series CNC PLUS Library - User Manual (08) 1-17
Chapter 1
Basic Language Function Blocks

PROGRAM FLOW CONTROL FUNCTION BLOCKS

Subroutines
The subroutine allows to define a number of instructions that can be easily resumed from any point of the logic program.
Subroutines must be defined by the user outside the logic tasks and from pre-defined tasks; they can be called from another PLUS program or routine and they can be nested. The maximum nesting level allowed is 5, that is the calling program plus 4 subroutine levels can be activated simultaneously. A subroutine cannot be called simultaneously by two different tasks. The last subroutine level (level 4) can not call other functions.
The subroutine starts in correspondence of the DSBR block and ends with the ESBR block. Use CAL block to call the subroutine.
The subroutine is characterized by the name (NAM parameter) and by one or more parameters (PA0 parameter can be duplicated).
The number of parameters appearing in the DSBR subroutine definition (formal parameters) must be the same as the one appearing in the CAL call (actual parameters).
The correspondence between formal and actual parameters is positional. Input parameters utilized in the DSBR block must not be Y parameters, therefore, in the subroutine
you must utilize the above parameters and not the ones utilized in the CAL block. Inside a routine you will find available local X variables that cannot be used outside the routine itself.
Furthermore, their value is lost each time you exit the subroutine: as a consequence, at the next call the previous value is not available any longer.
It is important to keep in mind that Y parameters refer directly to the parameters used in the CAL block so when you modify Y parameters in the subroutine's body you actually modify the parameters used in the CAL function.
The subroutines are not "re-entrant", i.e. they cannot be called simultaneously by several tasks. This means that a subroutine will usually be used by one task only. If it is intended to call the same subroutine from numerous tasks, access must be synchronized so
that the calls are made in sequence. An exception to the above rule is represented by the subroutines written in IL language which only
use the YW and XW variables (input parameters and local variables).
1-18 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
Basic Language Function Blocks
Example:
Definition of a subroutine called ADD that adds the two input parameters and returns the result to the variable GD0.
DTSK
NAM
Nam
(NAM = $BACK1)
. . . . . . . .
. . . . . . . .
NAM
GD 00 GD 01
KB 1
NAM
YD 00
YD 01
YD 00
CAL
Nam Pa0
Pa1
En
. . . . . . . .
. . . . . . . .
ETSK
DSB
R
Nam
Pa0
Pa1
ADD
I1
(NAM = ADD)
(NAM = ADD)
O1
YD 00
YD 01
I20
ESBR
To be noted is that when the result of the ADD function is assigned to the YD0 variable, the user will find at the end of the ADD subroutine execution the result of the addition in variable GD0.
10 Series CNC PLUS Library - User Manual (08) 1-19
Chapter 1
Basic Language Function Blocks
$DSBR DEFINE USER SUBROUTINE
DSBR
Nam
Pa 0
Connection attributes:
name inversion duplication format group
Nam NO NO special routine name
Pa0 NO YES all Y
NOTE:
The names for the user defined subroutines must not interfere with any pre-defined PLUS routine names. Therefore the routine's name should never begin with a "$"-sign.
Furthermore, the system considers lowercase and uppercase letters differently (i.e. the subroutine called MySub is different from the subroutine called MYSUB).
$ESBR DEFINE END OF USER SUBROUTINE
ESBR
$CAL CALL USER DEFINED SUBROUTINE AND PASS PARAMETERS
CAL
Nam
Pa 0 En
Connection attributes:
name inversion duplication format group
Nam NO NO special routine name Pa 0 NO YES all MGSX
En YES NO Boolean IOMGSXYTCK
1-20 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
Basic Language Function Blocks
PLUS PRE-DEFINED ROUTINES (TASKS)
There is a large number of pre-defined routines which make up the interface between the system and the logic. Most of these routines are optional. If you want to use the interfacing capacities offered by these routines, they must be defined using the following instructions and the names given in the PLUS Application Manual. The design of the interface routine is up to the user; the Application Manual gives some proposals for their structure.
$DTSK DEFINE PLUS ROUTINE
DTSK Nam
Connection attributes:
name inversion duplication format group
Nam NO NO special routine name
NOTE:
The names for the routines which can be declared with this function block are pre-defined. They can be standard logic routines like $FORE or $BACKn or can be part program interface or executive command filter routines. All pre-defined names begin with a "$" sign and you can find them listed in appendix A.
$ETSK DEFINE END OF PLUS ROUTINE
ETSK
This function block must always be used to terminate a PLUS pre-defined routine. For every DTSK block used in your logic program you must have a matching ETSK block.
10 Series CNC PLUS Library - User Manual (08) 1-21
Chapter 1
Basic Language Function Blocks

JUMPS

$LBL DEFINE JUMP LABEL
LBL Lbl
Connection attributes:
name inversion duplication format group
Lbl NO NO special Label name
$GOTO CONDITIONAL JUMP TO LABEL
GO TO Lbl
En
Connection attributes:
name inversion duplication format group
Lbl NO NO special Label name
En YES NO Boolean IOMGSXYTCK
1-22 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
Basic Language Function Blocks
TASK SYNCHRONIZATION BLOCKS
$WAIT WAIT ON SEMAPHORE
WA IT I1
En
Connection attributes:
name inversion duplication format group
I1 NO NO short M G X K
En YES NO boolean I O M G S X Y T C K
This function block suspends the execution of a PLUS routine (a routine defined with DTSK) until another routine activates the SEND function block (or the SEND instruction) on the same semaphore number. The semaphore number at the input I1 can be a constant in the range of 0-31 or a short variable in the same range.
A routine which is suspended using WAIT will not be executed all until a SEND is received. After having received the SEND command, the routine's execution will be resumed with the block following the WAIT function block.
$SEND SEND A SEMAPHORE
SEND I1
En
Connection attributes:
name inversion duplication format group
I1 NO NO short M G X K
En YES NO boolean I O M G S X Y T C K
This function block terminates the suspension of a PLUS routine waiting for the same semaphore. The semaphore number at the input I1 can be a constant in the range of 0-31 or a short variable in the same range.
When SEND is used on a non-used semaphore (no task is suspended in WAIT on this semaphore), the SEND function block /instruction will be ignored.
10 Series CNC PLUS Library - User Manual (08) 1-23
Chapter 1
sem
val
Basic Language Function Blocks
$: IFWAIT SEMAPHORE STATE INQUIRY
IFWAIT
Link Attributes:
name inversion duplication format group
Sem NO NO short M G K X
Val NO NO Boolean O M G X
This function is used for enquiring if the tasks are suspended by a semaphore. It is typically a complement to the functions $SEND and $WAIT for solving special synchronisation problems.
For example, when processing M functions, the background execution of a logic branch can be conditioned by the fact that the preparation phase for the related task has been finished i.e. has been effectively suspended.
The input value for this FB is the ID of the semaphore (sem) and can be between 0 and 32. The output value indicates the status of the semaphore.
1-24 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
Basic Language Function Blocks
$DLY WAIT FOR TIME-OUT
DLY I1
En
Connection attributes:
name inversion duplication format group
I1 NO NO short M G X K
En YES NO Boolean I O M G S X Y T C K
This function block suspends the execution of a PLUS routine (a routine defined with DTSK) for a period of time. After the time elapses, the routine execution will be continued. The time must be entered at input I1 and is expressed in .01 s. You can use a short constant or a short variable to enter the time in the range of 1-65535.
NOTES:
It is not possible to restart a task with a SEND instruction before it went into a wait. The SEND will be ignored.
You are not allowed to use the SEND instruction or the SEND function block from the foreground routine and the fast input routine. It can only be used in the background routines.
The background must release all routines in wait when a RESET or HOLD status is reported by the system (see PLUS Application Manual)
10 Series CNC PLUS Library - User Manual (08) 1-25
Chapter 1
Basic Language Function Blocks
CONDITIONAL EXECUTION OF BLOCKS
$IF CONDITIONAL EXECUTION OF A PART OF THE PROGRAM
IF Cnd
Connection attributes:
name inversion duplication format group
Cnd YES NO Boolean I O M G S X Y T C K
If the condition at the input Cnd is true, the code following this function block up to the next IF, ENDIF or ELSE block will be executed. If the condition is false the program execution will be continued with the next ENDIF or ELSE function block.
$ELSE ALTERNATIVE EXECUTION OF A PART OF THE PROGRAM
ELSE
This function block can only be used in conjunction with an IF function block. The code following the ELSE block up to the next ENDIF block will only be executed if the part between IF and ELSE was not executed.
$ENDIF END OF ALTERNATIVE EXECUTION PART OF THE PROGRAM
ENDIF
This function block must be used to define the end of a conditional group or groups of instructions. These groups may begin with either IF or ELSE.
1-26 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
code to be executed when condition false
code to be executed when condition true
Condition
Basic Language Function Blocks
Application Note:
The function blocks IF, ELSE and ENDIF have been designed to allow program flow control also when programming in FBD/LD. Using these blocks, there are basically 2 types of constructions you can apply:
1. IF - ENDIF construction
If the input condition of the IF function block is true, the code between IF and ENDIF will be
executed. If the input condition of the function block IF is FALSE the code between IF and ENDIF will not be executed.
IF
C o n d itio n
C n d
c o d e to b e e xe c u te d w h e n c o n d itio n t ru e
E N D IF
2. IF - ELSE -ENDIF construction
If the input condition of the block IF is TRUE, the code between the blocks IF and ELSE will be
executed. The code between ELSE and ENDIF will NOT be executed.
If the input condition of the IF function block is FALSE, the part of the code between IF and ELSE
will NOT be executed. The code included by ELSE and ENDIF will be executed.
IF C n d
E L S E
E N D IF
The function blocks IF, ELSE and ENDIF may be nested. The number of nesting levels is not limited. On the next page there is an example of how to use IF, ELSE and ENDIF in a 'nested' FBD
construction:
10 Series CNC PLUS Library - User Manual (08) 1-27
Chapter 1
Basic Language Function Blocks
PRO JECT: BAC K4 S M_No: 1 sym
REQUWARN
VARIABLE1
MESSAGE1
ENABLE
MESSAGE2
ENABLE
IF Cnd
IF Cnd
WARNING Ind
En
ELSE
IF
CndVARIABLE 2
WARNING Ind
En
St
St
ELSE
TX: 9 TY: 0
STATUS
STATUS
IF
CndVARIABLE 3
MESSAGE3
ENABLE
ENDIF
WARNING Ind
En
ENDIF
ENDIF
ENDIF
STATUS
If variable REQUWARN is false, no code will be executed. If variable REQUWARN is true one of the messages MESSAGE1, MESSAGE2 or MESSAGE3 will be
displayed based on the condition of VARIABLE1, VARIABLE2 and VARIABLE3 respectively. If VARIABLE1 is true, MESSAGE1 will be displayed; else if VARIABLE2 is true, MESSAGE2 will be displayed; else if VARIABLE3 is true, MESSAGE3 will be displayed. If none of the variables is true, no message will be displayed.
1-28 10 Series CNC PLUS Library - User Manual (08)
Basic Language Function Blocks

WORD COMPARISON FUNCTION BLOCKS

$LTW LESS THAN COMPARISON FOR WORDS (I1 < I2)
LTW
I1 I2
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO Boolean O M G S X Y
$LEW LESS OR EQUAL COMPARISON FOR WORDS (I1 <= I2)
O1
Chapter 1
LEW
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO Boolean O M G S X Y
$EQW EQUAL COMPARISON OF TWO WORDS (I1 = I2)
EQW
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO Boolean O M G S X Y
10 Series CNC PLUS Library - User Manual (08) 1-29
Chapter 1
Basic Language Function Blocks
$NEW NOT EQUAL COMPARISON FOR WORDS (I1 <> I2)
NEW
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO Boolean O M G S X Y
$GEW GREATER EQUAL WORD COMPARISON (I1 >= I2)
GEW
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO Boolean O M G S X Y
$GTW GREATER THAN COMPARISON FOR WORDS (I1 > I2)
GTW
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO short M G S X Y T C K I2 NO NO short M G S X Y T C K
O1 NO NO Boolean O M G S X Y
1-30 10 Series CNC PLUS Library - User Manual (08)
FLOATING POINT COMPARISON FUNCTION BLOCKS
$LT DOUBLE LESS THAN COMPARISON (I1 < I2)
LT
I1 I2
Connection attributes:
name inversion duplication format group
I1 NO NO Double M G X Y K I2 NO NO Double M G X Y K
O1 NO NO Boolean O M G S X Y
$LE DOUBLE LESS OR EQUAL COMPARISON (I1 <= I2)
O1
Chapter 1
Basic Language Function Blocks
LE
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO Double M G X Y K I2 NO NO Double M G X Y K
O1 NO NO Boolean O M G S X Y
$EQ DOUBLE EQUAL COMPARISON (I1 = I2)
EQ
I1 I2
O1
Connection attributes:
name inversion duplication format group
I1 NO NO Double M G X Y K I2 NO NO Double M G X Y K
O1 NO NO Boolean O M G S X Y
10 Series CNC PLUS Library - User Manual (08) 1-31
Chapter 1
Basic Language Function Blocks
$NE DOUBLE NOT EQUAL COMPARISON (I1 <> I2)
NE
I1 I2
O1
Connection attributes:
name inversion duplication format group I1 NO NO Double M G X Y K I2 NO NO Double M G X Y K O1 NO NO Boolean O M G S X Y
$GT DOUBLE GREATER THAN COMPARISON (I1 > I2)
GT
I1 I2
O1
Connection attributes:
name inversion duplication format group I1 NO NO Double M G X Y K I2 NO NO double M G X Y K O1 NO NO Boolean O M G S X Y
$GE DOUBLE GREATER EQUAL COMPARISON (I1 >= I2)
GE
I1 I2
O1
Connection attributes:
name inversion duplication format group I1 NO NO Double M G X Y K I2 NO NO double M G X Y K O1 NO NO Boolean O M G S X Y
1-32 10 Series CNC PLUS Library - User Manual (08)
Chapter 1
Basic Language Function Blocks

COMPOSED FUNCTION BLOCKS

Unlike the function blocks discussed up to now, the " composed function blocks" are not the implementation of a single instruction in a function block. They are little programs which consist of several instructions and can also serve as examples of how to construct your own function blocks.
$P1 IMPULSE ON RISING EDGE OF INP I1
O1P1
I1
Connection attributes:
name inversion duplication format group I1 YES NO Boolean I O M G S X Y T C K O1 NO NO Boolean O M G S X Y
The output of this function block goes to a TRUE state on the rising edge of the input signal I1 and remains TRUE until this block is scanned again by the I/O processor.
I1
O1
t
Timing diagram for P1
$P2 DIVIDE BY 2 ELEMENT
O1P2
I1
Connection attributes:
name inversion duplication format group I1 YES NO Boolean I O M G S X Y T C K O1 NO NO Boolean O M G S X Y
10 Series CNC PLUS Library - User Manual (08) 1-33
Chapter 1
Basic Language Function Blocks
The output O1 of this function block changes state on each rising edge of the input signal I1.
I1
O1
t
Timing diagram for P2
$P3 IMPULSES ON RISING AND FALLING EDGES OF INPUT SIGNAL I1
name inversion duplication format group I1 YES NO Boolean I O M G S X Y T C K O1 NO NO Boolean O M G S X Y O2 NO NO Boolean O M G S X Y
This function block supplies two impulses O1 and O2. The output O1 goes TRUE on the rising edge of the input signal I1; The output O2 goes TRUE on the falling edge of the input signal I1. When set, the outputs will remain true until the function block is scanned again by the I/O processor.
I1
O1
O2
t
Timing diagram for P3
END OF CHAPTER
1-34 10 Series CNC PLUS Library - User Manual (08)
Chapter
2
LANGUAGE EXTENSIONS
The function blocks we have covered up to now, were direct implementations of the equivalent PLUS instructions.
The extensions offer additional functionality and power which can not be obtained with the standard instructions. An extension is a routine which is supplied with the system and not by the language. It can be used either in instruction list programming or in function block programming.
This chapter contains the following sections: NUMBER AND FORMAT CONVERSIONS INDIRECT LOAD AND STORE STRING/CHARACTER HANDLING ARITHMETICS WITH FORMAT CONVERSION SPECIAL CONVERSIONS
10 Series CNC PLUS Library - User Manual (04) 2-1
Chapter 2
Language Extensions

NUMBER AND FORMAT CONVERSIONS

$ATOI: Convert an ASCII string to an integer number (16 bit)
LD/FBD:
ATOI ascstring
enable En
IL:
dest_varINT
Type: Internal
CAL $ATOI string dest_var
INPUT VARIABLE: ASCII string (char) OUTPUT VARIABLE : integer destination variable (short)
Description:
This function converts a character string to an integer (16 bit) binary number. The input string is a sequence of characters which can be interpreted as a numerical value of the integer type. The function stops reading characters from the input string at the first character which cannot be recognized as a part of the number. This character may be the NULL-character (\0) terminating the string.
The string to be converted may contain in the given order whitespace characters, (space and/or tab), a sign (+/-) and up to 5 numerical digits.
Example:
str in g
"1 0 0 " "+ 1 0 0 " "-100 " " -1 2 3 4 5 " " 1 2 3 4 5 " " 1 2 3 4 5 "
dest_var
+ 1 0 0 + 1 0 0
- 1 0 0
- 1 2 3 4 5 + 1 2
- 1
2-2 10 Series CNC PLUS Library - User Manual (04)
$ITOA: Convert an integer number to an ASCII string
LD/FBD:
Chapter 2
Language Extensions
Type: Internal
value
enable En
ITOA int
ASC
string
IL:
CAL $ITOA value string
INPUT VARIABLE: integer value to convert (short) OUTPUT VARIABLE: ASCII string (char)
Description:
The $ITOA function converts the significant digits of the given value value to a NULL-terminated character string and stores the result in the indicated A variable string. The output string length is 7 bytes (sign, 5 digit number and the terminating NULL).
If the string length indicated in the output string is less than required for the resulting string, the most significant digits of the string will be 'cut' off.
10 Series CNC PLUS Library - User Manual (04) 2-3
Chapter 2
Language Extensions
$ATOF: Convert an ASCII string to a floating point number
LD/FBD:
ATOF ASCstring
enable En
IL:
CAL $ATOF string dest_var
dest_varFLT
Type: Internal
INPUT VARIABLE: ASCII string (char) OUTPUT VARIABLE: floating point destination variable (double)
Description:
This function converts a character string string to a double precision floating point value. The input string is a sequence of characters which can be interpreted as a numerical value of the type 'double'. The function stops reading characters from the input string at the first character which cannot be recognized as a part of the number. This character may be the NULL character (\0) terminating the string.
The string may contain in the given order whitespace characters (space/tab), a sign character (+/), numerical digits, a decimal point or decimal comma and further numerical digits. Up to 15 numerical digits can be converted (maximum 8 integer digits plus 7 decimal digits).
Example:
legal strings " -1234.5678" or "+1234567" or "-33,45" etc.
2-4 10 Series CNC PLUS Library - User Manual (04)
$FTOA: Convert a floating point number to an ASCII string
LD/FBD:
FTOA
value
dig_integer
dig_fraction
enable En
IL:
Flt int Fra
ASC string
Chapter 2
Language Extensions
Type: Internal
CAL $FTOA value dig_integer dig_fraction string
INPUT VARIABLES: double value to be converted (double)
number of digits before decimal point (short) number of digits after decimal point (short)
OUTPUT VARIABLE: string result (char)
Description:
The $FTOA function converts the floating point number to a NULL-terminated character string and stores the result in the string indicated in the function call. The parameter value is the floating point number to be converted, the dig_integer parameter indicates how many digits must be converted in front of the decimal point. If the value parameter has less significant digits than indicated in dig_integer, the leading zeros will be filled up with spaces. If the number in the value parameter exceeds the value which can be represented with dig_integer places, the leading digits will be cut off.
The dig_fraction parameter indicates the number of digits after the decimal point. If the number of decimal digits in the value parameter exceeds the number indicated in dig-fraction count, the low order digits are rounded. If the resulting string after the decimal point is shorter than dig_fraction digits, the string is padded with zeros.
The values of dig_integer and dig_fraction are limited to 7 each.
10 Series CNC PLUS Library - User Manual (04) 2-5
Chapter 2
Language Extensions
Examples:
value * dig_integer dig_fraction string
-123456.654321 7 7 - 123456.6543210
12345.123 7 7 12345.1230000
123456.123456 5 5 23456.12346
-1.15 6 1 - 1.2
-1.15 2 2 - 1.15
* These numbers show the internal resolution, they cannot be entered in this way using PLUSEDIT.
2-6 10 Series CNC PLUS Library - User Manual (04)
$FTOI: Convert a floating point format to an integer format
LD/FBD:
F T O I
flt
e n a b le E n
IL:
F L T
integerIN T
Chapter 2
Language Extensions
Type: Internal
CAL $FTOI flt integer
INPUT VARIABLE: floating point input variable (double) OUTPUT VARIABLE: integer output variable (short)
Description:
This function converts a floating point number (double) to a signed 16 bit integer (short). Any fraction of the source floating point number will be truncated. In case the value of the floating point number is between 32768 and 65535, this function will return the corresponding negative short numbers. If the value of the floating point number exceeds the value of 65535, the short result will consist of the lower 16 bit of the integer representing the floating point number. The result may be either positive or negative and is really unpredictable.
10 Series CNC PLUS Library - User Manual (04) 2-7
Chapter 2
Language Extensions
$ITOF: Convert a short variable to a double variable
LD/FBD:
ITOF Intinteger
enable En
IL:
CAL $ITOF integer flt
Flt flt
Type: Internal
INPUT VARIABLE: integer input variable (short) OUTPUT VARIABLE: floating point output variable (double)
Description:
This function provides the conversion of a short integer variable to a floating point variable.
2-8 10 Series CNC PLUS Library - User Manual (04)
$CTOW: Convert a character to a word
LD/FBD:
CTOW ASCascii
enable En integer
IL:
CAL $CTOW ascii integer
Chapter 2
Language Extensions
Type: Internal
Int
INPUT VARIABLE: ASCII input character (char) OUTPUT VARIABLE: integer output word (short)
Description:
This function copies a single character string from the ASCII array to the lower byte of a single short variable. Normally the string must be one character long (A..,1). Since only the first character of the indicated string is copied, using a longer string causes no error. The upper byte of the destination variable will always contain 0.
See also:
Functions: $WTOC copy a short variable into the ASCII array Instructions/function blocks: XCH exchange upper and lower byte of the word accumulator
10 Series CNC PLUS Library - User Manual (04) 2-9
Chapter 2
Language Extensions
$WTOC: Convert a word to character
LD/FBD:
Type: Internal
integer
enable En
WTOC Int
ASC ASCII
IL:
CAL $WTOC integer ASCII
INPUT VARIABLE: integer input word (short) OUTPUT VARIABLE: ASCII output character (char)
Description:
This function copies the lower byte of a single short variable to a character in the ASCII array. The upper byte of the source variable has no influence on the result of the function.
See also:
Functions: $CTOW copy an ASCII character into a short variable Instructions/function blocks: XCH exchange upper and lower byte of the word accumulator
2-10 10 Series CNC PLUS Library - User Manual (04)

INDIRECT LOAD AND STORE

$ILDGW: Indexed load of word from GW word variables area
LD/FBD:
ILDGW
ind_gw Ind Out dest
IL:
Chapter 2
Language Extensions
Type: Internal
CAL $ILDGW ind_gw dest
INPUT VARIABLE: index of the GW variable to load (0..255) (short) OUTPUT VARIABLE: value of indexed GW variable (short)
Description:
This function can be used to load the output word dest using active indexing in the global word variable area in the dual port memory of the I/O processor module (GW variables). The indexing can be done with other variables of the word type (MW, GW, SW, XW, TW and CW) or with equivalent constants (KHxxxx or KWxxx). The index contained in this variable or constant must be in the range of 0 through 255 to be a legal index. If the index exceeds 255, nothing will happen (the output variable dest will not be changed.)
10 Series CNC PLUS Library - User Manual (04) 2-11
Chapter 2
Language Extensions
$ILDMW: Indexed load of a word from the MW variables memory area
Type: Internal
LD/FBD:
ILDMW
ind_MW
Ind Out dest
IL:
CAL $ILDMW ind_MW dest
INPUT VARIABLE: index of the MW variable to load(0..999) (short) OUTPUT VARIABLE: value of indexed MW variable (short)
Description:
This function can be used to load the output word dest using active indexing in the MW memory area. The indexing can be done with a variable of the word type (MW, GW, SW, XW, TW and CW) or with an equivalent constant (KHxxxx or KWxxx). The index contained in this variable or constant must be in the range of 0 through 4999 to be a legal index. If the index exceeds 4999, nothing will happen (the output variable dest will not be changed.)
2-12 10 Series CNC PLUS Library - User Manual (04)
Chapter 2
Language Extensions
$ILDSW: Indexed load of the word from the SW word variables memory area
Type: Internal
LD/FBD:
ILDSW
ind_SW
Ind Out dest
IL:
CAL $ILDSW ind_SW dest
INPUT VARIABLE: index of the SW variable to load (0..99) (short) OUTPUT VARIABLE: value of indexed SW variable (short)
Description:
This function can be used to load the output word dest using active indexing in the SW memory area (system variables). The indexing can be done with a variable of the word type (MW, GW, SW, XW, TW and CW) or with an equivalent constant (KHxxxx or KWxxx). The index contained in this variable or constant must be in the range of 0 through 99 decimal or 0 - 63 hex to be a legal index. If the index exceeds 99, nothing will happen (the output variable dest will not change.)
10 Series CNC PLUS Library - User Manual (04) 2-13
Chapter 2
Language Extensions
$ILDMD: Indexed load of a double from the MD variables memory area
Type: Internal
LD/FBD:
ILDMD
ind_MD
Ind O ut dest
IL:
CAL $ILDMD ind_MD dest
INPUT VARIABLE: index of the MD variable to load (0..999) (short) OUTPUT VARIABLE: value of indexed MD variable (double)
Description:
This function can be used to load the output word dest using active indexing in the MD memory area. The indexing can be done with a variable of the word type (MW, GW, SW, TW and CW) or with an equivalent constant (KHxxxx or KWxxx). The index contained in this variable or constant must be in the range of 0 through 999 to be a legal index. If the index exceeds 999, nothing will happen (the output variable dest will not be changed.)
2-14 10 Series CNC PLUS Library - User Manual (04)
$ILDGD: Indexed load of double from GD variables area
LD/FBD:
ILDGD
Chapter 2
Language Extensions
Type: Internal
ind_GD
Ind O ut dest
IL:
CAL $ILDGD ind_GD dest
INPUT VARIABLE: index of the GD variable to load (0..63) (short) OUTPUT VARIABLE: value of indexed GD variable (double)
Description:
This function can be used to load the output double dest using active indexing in the global double variable area in the dual port memory of the I/O processor module (GD variables). The indexing can be done with other variables of the word type (MW, GW, SW, TW and CW) or with equivalent constants (KHxxxx or KWxxx). The index contained in this variable or constant must be in the range of 0 through 63 to be a legal index. If the index exceeds 63, nothing will happen (the output variable dest will not be changed.)
10 Series CNC PLUS Library - User Manual (04) 2-15
Chapter 2
Language Extensions
$ISTGW: Indexed storage of the input word to the GW variables memory
area
Type: Internal
LD/FBD:
ISTGW
ind_GW
value
IL:
Ind
Val
CAL $ISTGW ind_GW value
INPUT VARIABLES: index of the destination GW variable (short)
value to be stored (short)
OUTPUT VARIABLE: none
Description:
This function can be used to store the contents of the input word value to a GW variable in the dual port memory using active indexing. The indexing can be done with a variable of the word type (MW, GW, SW, XW, CW and TW) or an equivalent constant (KHxxxx or KWxxx). The contents of the indexing variable or constant ind_GW must be in the range of 0 through 255. If the index exceeds the value of 255, nothing will happen. In this case also no error condition will be issued.
2-16 10 Series CNC PLUS Library - User Manual (04)
Chapter 2
Language Extensions
$ISTMW: Indexed storage of the input word to the MW variables memory
area
Type: Internal
LD/FBD:
ISTMW
ind_MW
IL:
Ind
Valvalue
CAL $ISTMW value ind_MW
INPUT VARIABLES: index of the destination MW variable (short)
value to be stored (short)
OUTPUT VARIABLE: none
Description:
This function can be used to store the contents of the input word value to an MW variable using active indexing. The indexing can be done with a variable of the word type (MW, GW, SW, XW, CW and TW) or an equivalent constant (KHxxxx or KWxxx). The contents of the indexing variable or constant ind_MW must be in the range of 0 through 4999. If the index exceeds the value of 4999, nothing will happen. In this case also no error condition will be issued.
10 Series CNC PLUS Library - User Manual (04) 2-17
Chapter 2
Language Extensions
$ISTMD: Indexed storage of the input double to the MD variables memory
area
Type: Internal
LD/FBD:
ISTMD
ind_MD
IL:
Ind Valvalue
CAL $ISTMD ind_MD value
INPUT VARIABLES: index of the destination MD variable (short)
value to be stored (double)
OUTPUT VARIABLE: none
Description:
This function can be used to store the contents of the input double value to an MD variable using active indexing. The indexing can be done with a variable of the word type (MW, GW, SW, XW, CW and TW) or an equivalent constant (KHxxxx or KWxxx). The contents of the indexing variable or constant ind_MD must be in the range of 0 through 999. If the index exceeds the value of 999, nothing will happen. In this case also no error condition will be issued.
2-18 10 Series CNC PLUS Library - User Manual (04)
Chapter 2
Language Extensions
$ISTGD:Indexed storage of the input double to the GD variables memory
area
Type: Internal
LD/FBD:
ISTGDD
ind_ GD
IL:
Ind
Valvalue
CAL $ISTGD ind_GD value
INPUT VARIABLES: index of the destination GD variable (short)
value to be stored (double)
OUTPUT VARIABLE: none
Description:
This function can be used to store the contents of the input double value to an GD variable using active indexing. The indexing can be done with a variable of the word type (MW, GW, SW, XW, CW and TW) or an equivalent constant (KHxxxx or KWxxx). The contents of the indexing variable or constant ind_GD must be in the range of 0 through 63. If the index exceeds the value of 63, nothing will happen. In this case also no error condition will be issued.
10 Series CNC PLUS Library - User Manual (04) 2-19
Chapter 2
Language Extensions
$WR_ASCII:Write ASCII task output parameters (indexed loading of ACCUS
from ASCII buffer)
Type: Internal
LD/FBD:
WR_ASCII
start
length enable
IL:
Ind Num En
CAL $WR_ASCII start length
INPUT VARIABLES: starting index in the ASCII buffer (short)
length of string to copy to the string accu (short)
OUTPUT VARIABLE: none
Description:
This function can be used to load the string accumulator using active indexing in the ASCII array. The indexing can be done with 2 variables of the type short (MW, XW, SW, GW). The first variable is the index of the first character of the ASCII array to be copied. The value of this index must be in the range between 0 and the maximum limit established by the ASCIEDIT utility; if the maximum limit established is exceeded, the function has no effect.
The second variable indicates, how many characters must be copied. The string accumulator will always be filled up from the bottom upwards.
For some tasks the string accumulator (ACCUS) serves as an output parameter.
NOTE:
The NULL ('\0') end of string character will be treated as a normal character. For this reason NULL characters will be copied to the string accumulator together with other characters.
See also:
Functions: $RD_ASCII Read ASCII input parameters of a task
$INDEXA Copy a range of ASCII variables
2-20 10 Series CNC PLUS Library - User Manual (04)
Chapter 2
Language Extensions
$RD_ASCII: Read ASCII input parameters of a task (indexed store of ACCUS
in ASCII buffer)
Type : Internal
LD / FB D :
s t a rt
l e n g t h
e n a b l e
R D _A S C II
In d N u m
E n
IL:
CAL $RD_ASCII start length
INPUT VARIABLES: starting index in the ASCII array (short)
length of string to copy from the string accu (short)
OUTPUT VARIABLE: none
Description:
This function can be used to store the contents of string accumulator to the ASCII array using active indexing. The indexing can be done with 2 variables of the type short (MW, XW, SW, GW). The first variable indicates the index of the first destination character in the ASCII array. The value of this index must be in the range between 0 and the maximum limit established by the ASCIEDIT utility; if the maximum limit established is exceeded, the function has no effect.
The second variable indicates, how many characters must be copied (0-128). The copying always starts with the first character of the string accu.
NOTE:
The NULL ('\0') end of string character will be treated as a normal character. For this reason, NULL characters will be copied from the string accumulator just like normal characters.
See also:
Functions: $WR_ASCII Write ASCII task output parameters
10 Series CNC PLUS Library - User Manual (04) 2-21
Chapter 2
Language Extensions

STRING / CHARACTER HANDLING

$STRCMP: Compare ASCII strings
LD/FBD:
STRCMP string1 string2
case
ST1
ST2
Cas
Enenable
Type: Internal
Res result
IL:
CAL $STRCMP string 1 string 2 case result
INPUT VARIABLES: first string (char)
second string (char) case sensitivity selection (short)
OUTPUT VARIABLE: comparison result (short)
Description:
This function compares two strings. If the strings are identical, the result (RESULT) is 1, otherwise the output result will be 0. If you set the case sensitivity input (CASE) to a positiv value, the comparison will differentiate between upper and lower case characters.
The length of the string specified in the input parameter (i.e. A0,15) is never taken into consideration. The character sequence beginning from the specified address (in the case 0) and ending with the first null character found (end of string), is considered as a string.
2-22 10 Series CNC PLUS Library - User Manual (04)
$STR_LEN: Calculate string length
LD/FBD:
source_ind
enable En
IL:
Chapter 2
Language Extensions
Type: Internal
STR_LEN Sind
Num number
CAL $STR_LEN source_ind number
INPUT VARIABLE: source_ind string (0..3999) (short) OUTPUT VARIABLE: number of characters (short)
Description:
This function can be used on strings stored in the ASCII-array of the I/O processor module which are addressable with an index.
It writes to the output number the number of characters in the string that begins starting from the index specified in source_ind. The count begins with the character in the ASCII-array pointed at by source_ind and ends when the NULL character is encountered. The returned output number does not include the NULL character. source_ind must assume a value between 0 and the maximun limit set by the ASCIEDIT utility. If the NULL character will not be encountered until the fixed limit set by the ASCIEDIT utility, the function doesn’t work
10 Series CNC PLUS Library - User Manual (04) 2-23
Chapter 2
Language Extensions
$INDEXA: Copy a range of ASCII variables
LD/FBD:
INDEXA
source_index
number
dest_index
IL:
Sind Num
Dind
Enenable
Type: Internal
CAL $INDEXA source_index number dest_index
INPUT VARIABLES: index in ASCII buffer (start) (0..4999) (short)
number of characters to read (1..127) (short) index of destination variable (0..4999) (short)
OUTPUT VARIABLE: none
Description:
This function copies a block of characters within the ASCII buffer. The parameters source_index and number indicate the start position in the buffer and the number of characters to copy. The block will
be copied to the destination index dest_index in the ASCII buffer. This function can be used to read the ASCII buffer and to display messages of fixed lengths.
The copy is not interrupted when the function encounters a NULL character in the ASCII buffer.
NOTE:
If source_index + number exceeds 3999 or dest_index + number exceeds the fixed limit set by the ASCIEDIT function, this system function call will not copy at all.
Related function calls: Functions: $WSCREEN message visualisation in PLUS video screen
$WARNING message visualisation in all screens
2-24 10 Series CNC PLUS Library - User Manual (04)
$INDEX: Copy a range of M variables
LD/FBD:
source_ind
number
dest_ind
IL:
Chapter 2
Language Extensions
Type: Internal
INDEX Sind Num
Dind
Enenable
CAL $INDEX source_ind number dest_ind
INPUT VARIABLES: index of first source M variable (0..4999) (short)
number of m variables to copy (1..4999) (short) index of destination M variable (0..4999) (short)
OUTPUT VARIABLE: none
Description:
This function copies a block of M variables within the M variables memory area. Source and destination index (source_ind and dest_ind) can be defined with constants of the word type (KHxxxx and KWxxx) or with word type variables (MW, GW, SW, TW, CW and XW).
NOTE:
If source_index + number exceeds 999 or dest_index + number exceeds 4999, this system function call will not copy at all.
10 Series CNC PLUS Library - User Manual (04) 2-25
Chapter 2
Language Extensions
$STR_I: Copy ASCII characters from the ASCII buffer to the M variables
Type: Internal
LD/FBD:
STR_I
ind_source
number
ind_dest
IL:
CAL $STR_I ind_source number ind_dest
Ain Num
Min
Enenable
INPUT VARIABLES: first character to copy (short)
number of characters to copy (short) index of first destination M variable (short)
OUTPUT VARIABLE: none
Description:
This function copies a number of characters from the ASCII array starting at index ind_source to the M variables starting from the given word index ind_dest. The most significant bytes of the M destination variables will be set to zero. The variables ind_source and ind_dest can be M, G or S variables or can be constants of the word type containing the index of source or destination.
NOTE:
The function will copy nothing in case all input parameters do not follow the following conditions:
number must be between 1 and 5000
M_index + number must be minor or equal to 5000
M_index + number must not exceed the limit established through the ASCIEDIT utility
Example:
L KH0100 constant hex constant 0x0100 -> decimal 256 = MW 100 ind_source CAL $STR_I copy string from A array to M variables MW 100 ind_source index of source variable in A array KW 5 number number of characters to copy KW 500 ind_dest index of destination in MW variables
2-26 10 Series CNC PLUS Library - User Manual (04)
Chapter 2
Language Extensions
Above example copies 5 characters from the A array (A 00256,005) into variables from MW 500 through MW 504.
10 Series CNC PLUS Library - User Manual (04) 2-27
Chapter 2
Language Extensions
$I_STR: Copies a number of words to the ASCII array
LD/FBD:
I_STR
M_index
number Num
A_index
IL:
Min
Ain
Enenable
Type: Internal
CAL $I_STR M_index number A_index
INPUT VARIABLES: index of first M variable to copy (short)
number of M variables to copy (short) destination index in the ASCII array (short)
OUTPUT VARIABLE: none
Description:
The function copies a number of integers from the local M memory variables to the ASCII array. Only the lower byte (least significant byte) will be copied. The most significant byte of the M variables is discarded.
You can use constants of the word type (KHxxxx or KWxxx) or word type variables (MW, GW, SW, TW, CW and XW) to indicate the index of source and destination.
NOTE:
The function will copy nothing in case all input parameters do not follow the following conditions:
number must be between 1 and 5000
M_index + number must be minor or equal to 5000
M_index + number must not exceed the limit established through the ASCIEDIT utility
2-28 10 Series CNC PLUS Library - User Manual (04)

ARITHMETICAL FUNCTIONS

$MULF: Multiply two short operands with double result
LD/FBD:
MULF
mul1 mul2
enable En
MU1 MU2
resultQf
Chapter 2
Language Extensions
Type: Internal
IL:
CAL $MULF mul1 mul2 result
INPUT VARIABLES: first operand of the multiplication (short)
multiplier (short)
OUTPUT VARIABLE: multiplication result (double)
Description:
Multiplication of two shorts. Use this function instead of function block MULW/instruction/MUL when a double precision format result is required. If a short result is required, use MUL instruction or MULW function block.
See also:
Functions: $DIVF division with quotient Function block: MUL multiplication of 2 double operands, double result
MULW multiplication of 2 short operands, short result
Instructions: MUL multiplication of accumulator times operand, result in the
accumulato. Function for double and short formats
10 Series CNC PLUS Library - User Manual (04) 2-29
Chapter 2
Language Extensions
$DIVF: Division of two short operands with a double result
LD/FBD:
Type: internal
DIVF
div1 div2
enable En
D1 D2
resultQf
IL:
CAL $DIVF div1 div2 result
INPUT VARIABLES: dividend (short)
divisor (short)
OUTPUT VARIABLE: quotient (double)
Description:
Division of two shorts. Quotient in double precision format.
2-30 10 Series CNC PLUS Library - User Manual (04)
Example:
Chapter 2
Language Extensions
PROJECT: PROJECT1
MW 100
MW101 I 24,00
KW 5 KW 5
KW 10 0
KW 7 KW1 2 KW 1 KW 7
DIVF
D2D1QF
En
WRI_SCR
Ind Scr
Row Col Att ModKW0 En
St
SM_NO: 1 ABS
FTOA Flt
Int Fra
En
MW 101
ASC
Display the quotient of two shorts in the PLUS #7 screen, utilizing a 5.5 format.
See also:
Function blocks: DIV Division of 2 double operands, double result
DIVW Division of 2 short operands, short result MOD Division remainder of 2 short operands
TX: 2 TY: 20
A 0 0100,012
10 Series CNC PLUS Library - User Manual (04) 2-31
Chapter 2
Language Extensions
SPECIAL CONVERSIONS
$A_TO_ID: Requests conversion from process axis name to axis identifier.
Type: Internal
LD/FBD:
ax_name
m
enable En
A_TO_ID Proproc_nu
Nam
Aid ax_id
IL:
CAL $A_TO_ID proc_num ax_name ax_id
INPUT VARIABLES: process number (short)
axis name (ASCII name) (short)
OUTPUT VARIABLE: axis identifier (short)
Description:
This function converts the ASCII axis' name belonging to a specified process into the physical axis identifier needed for most of the function calls.
The axis name and identifier are associated through "AMP" characterization program. If the process number is out of range (0÷20) and/or the axis name does not exist, the "ax_id"
parameter must be zero.
2-32 10 Series CNC PLUS Library - User Manual (04)
Chapter 2
Language Extensions
$ID_TO_A: Conversion from physical axis identifier to ASCII axis name and
its process.
Type: Internal
ID_TO_A
Aidax_id proc_num
Pro
ax_name
IL:
enable
CAL $ID_TO_A ax_id proc_num ax_name
Nam
En
INPUT VARIABLE: axis identifier (short) OUTPUT VARIABLES: process number (short)
axis name (ASCII-name) (short)
Description:
This function converts the axis identifier format to the ASCII axis representation and a process number. The axis name and the physical identifier are associated through the "AMP" characterization program.
If the axis identifier is out of range (1÷32), the function is not executed and the output parameters "proc_num" and "ax_name" remain unvaried.
END OF CHAPTER
10 Series CNC PLUS Library - User Manual (04) 2-33
Chapter
3
COUNTERS AND TIMERS
SET COUNTER................................................................................................... CTS
RESET COUNTER.............................................................................................. CTR
INCREMENT COUNTER...................................................................................... CTU
DECREMENT COUNTER..................................................................................... CTD
TIMER START..................................................................................................... TIM
RESET TIMER .................................................................................................... TMR
ENABLE/DISABLE PLUS TIMER.......................................................................... $T_START
READ TIMER...................................................................................................... $T_READ
10 Series CNC PLUS Library - User Manual (03) 3-1
Chapter 3
Counters and Timers

COUNTERS

In PLUS, 256 counters are available. A counter has: four Boolean inputs
SET RESET COUNT UP (increases) COUNT DOWN (decreases)
one Boolean output The output is set to TRUE when the count value is greater than zero and less than the counter preset value.
A counter has 2 internal "registers":
an accumulator which contains the actual count
a preset register which contains a preset value.
The accumulator of a counter is a read-only word, while preset register is a write-only word for the logic. The maximum count value is limited to a 13 bit number (0-8191) and will always be positive.
NOTE:
Counters are retentive, that is their accumulator will not loose count after a power cycle.
Preset of a counter:
The preset operation can be done by utilizing standard assign blocks such as:
. . . . . _______________ . . . . .
or
SET 01 I1 En
The preset value must not be higher than 8191: if the counter is supplied with higher numbers these will be "cut out" that is the three most significant bits will be taken to zero (bit 15,14,13).
3-2 10 Series CNC PLUS Library - User Manual (03)
Chapter 3
Counters and Timers
$CTD COUNT DOWN
CTD
I-
Cn
Q
The I- input is the count down input. Every time this input goes one, (a rising edge of the signal) the counter accumulator value will be decremented.
As long as the counter accumulator value is not equal to zero and less than the counter preset value, the output bit Q will be true. Counting down from zero will cause the accumulator to roll over to 8191. The counter number C nnn must be connected to the Cn input.
$CTU COUNT UP
CTU
I+
Cn
Q
The I+ input is the count up input. Every time this input goes true, (a rising edge of the signal) the counter accumulator value will be incremented. When the counter accumulator value is equal to 8191, a further transitions on the I+ input will cause the accumulator to roll over to 0. The counter number C nnn must be connected to the Cn input. You can use the same counter number Cnnn for both CTU and CTD function blocks.
$CTR COUNTER RESET
CTR R Cn
If the R input is at zero, the FB CTR zeroes the accumulator of the counter and the Q bit. The Cn input must be linked to a counter (Cn).
$CTS SET COUNTER ACCUMULATOR = PRESET VALUE
CTS
S Cn
If the S input is at zero, the fb CTS transfers the counter preset value to the counter accumulator and clears the Q bit.
10 Series CNC PLUS Library - User Manual (03) 3-3
Chapter 3
Counters and Timers
Connection attributes:
name inversion duplication format group
I-/I+ YES NO Boolean I O M G S X YT C R/S YES NO Boolean I O M G S X Y T C
Cn NO NO Boolean C (Cnnn)
Q YES NO Boolean O M G S X Y
NOTES:
The Q bit is only evaluated when one of the above counter instructions is executed. When you use instructions or function blocks on the accumulator/preset register values, the counter output Q will never change state.
You can use all word related function blocks on both the counter registers. Both counter accumulator and counter preset register are addressed with CW nnn (where nnn is a number in the range of 000 thru 255). Automatically, all output instructions will work on the preset register, all input will be read from the counter accumulator.
Example:
3-4 10 Series CNC PLUS Library - User Manual (03)
Chapter 3
Counters and Timers

TIMERS

In PLUS, you can use up to 128 "slow" timers and up to 128 "fast" timers. A slow timer has a 0.1 second time base and a fast timer has a 0.01 second time base. The fast timers occupy the timer numbers T 0-127, the slow timers range from T128 thru T255. These timer functions are elementary functions from which all kinds of timers can be derived by connecting their inputs and outputs in a different way. The variables used for the accumulated time (actual value), preset time and the control bits are stored in the dual port memory of the I/O processor module. This part of the dual port memory is cleared at power turn on time, so if a timer accumulated value must be saved, it must be written to retentive memory (G-variables) before switching off.
TIMER nnn
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
ACCUM PRESET
TI T R CONTROL
TIMER REGISTERS
The first register, the accumulator, is used to store the actual time value. Its initial value is loaded from the preset word at each reset of the timer. The timer will decrement the time accumulator in pre­defined time intervals (0.01 or 0.1 s), as long as the timer input is true and the actual time value is not zero.
The actual time value is a read only variable, it cannot be written. It must be read using the LW or the L instruction on the corresponding TW variable (TW000 - TW255).
The timer preset register contains the preset value of the timer. It can only be written to the dual port memory with the word assignment instructions "=", "S" and "R". The preset value cannot be read. Normally, the timer preset value is defined only once.
The control word contains the time-out bit T nnn (used by the logic) and some controls bits for internal use by the timer. You cannot access the control word in PLUS You can only use the timer instructions to change the status of these bits.
To switch the timer on, you must set the TI nnn bit. Even when the instructions containing the timer are not actively executed, the timer is active and continues decrementing its actual value.
The input RESET timer is triggered on the positive edge of the connected signal.
10 Series CNC PLUS Library - User Manual (03) 3-5
Chapter 3
Counters and Timers
The 13th bit in the timer control register is used to indicate the state of the timer. The timer sets this bit true when the timer input bit TI is set and the value in the accumulator has not yet reached zero (TI AND (ACCU > 0).
The range of a timer is 16 bit, giving a resolution of 65535 time increments, which can be translated in maximum times of 6553.5 seconds (1 hour, 49 minutes) for slow timers and 655,35 seconds (11 minutes) for fast timers.
If the value of the time accumulator must be used, you should keep in mind that the I/O processor treats integer number larger than 32767 as negative numbers. We advise to limit the timer range to values less than or equal to 32767 time increments.
Let's see, how the timer can be used in the IL programming language:
rec. word instr. CC OPNo symbol comment
00000 ; the timer preset value was 5 minutes
00000 L I 00,00 INPUT0 load the condition 00001 LW KW 3000 load the constant (5minutes) 00002 S TW 255
00001 ; timer start-up
00003 L I 00,01 INPUT1 load the condition 00004 TI T 255
00002 ; verify timer status
00005 L T 255 00006 = O 00,0 OUTPUT0 timer is counting
00003 ; stop the timer
; the preset register in the accumulator
00007 L I 00,2 00008 R T 255 INPUT2 reset input
00004 ; force the preset value to 0
00009 L I 00,03 INPUT3 clear preset 00010 R TW 255
00005 ; compare the accumulator
00011 L TW 255 00012 LE KW 600 less than one minute to finish? 00013 S O 00,1 OUTPUT1 time <= 60 seconds
As you can see, some instructions do have a special meaning when used in conjunction with a timer.
The bit reset R executed on Tnnn means that you will restore the value from the preset register into the accumulator.
The word reset instruction R on the timer word variable TW nnn means that the preset value will be reset (set to zero ).
The TI instruction can only be used together with a T nnn operand.
3-6 10 Series CNC PLUS Library - User Manual (03)
Counters and Timers

TIMERS AND FB PROGRAMMING

The PLUS FB library contains 2 dedicated function blocks for timers:
$TIM TIMER ENABLED
Chapter 3
TIM TI
Tn
Q
The TI input is the binary accu. The timer starts when this input is true. The timer stops when it is false. T nnn specifies the number of the timer. Q is the timer active bit (TW>0 AND TI=TRUE). Time counting can be suspended more than once before reaching end of timing.
$TMR TIMER RESET/PRESET
TMR
R
Tn
When the R-bit is high, the timer output bit Q will be set to 0 and the time preset value is loaded into the time accumulator. Input R can be inverted if needed. Tn specifies the number of the timer.
Connection attributes:
name inversion duplication format group
TI YES NO Boolean I O M G S X YT C R YES NO Boolean I O M G S X Y T C
Tn NO NO Boolean T (Tnnn)
Q YES NO Boolean O M G S X Y
This is an example, of how a time off delay can be programmed, using the standard timer function blocks.
10 Series CNC PLUS Library - User Manual (03) 3-7
Chapter 3
Counters and Timers
This is the corresponding timing diagram
I 14,00
Q
O12,0
< >
t
3-8 10 Series CNC PLUS Library - User Manual (03)
Counters and Timers
This is the corresponding timing diagram
Chapter 3
I14,00
Q
O12,0
< >t
10 Series CNC PLUS Library - User Manual (03) 3-9
Chapter 3
Counters and Timers
This is the corresponding timing diagram
I 14,00
Q
I 14,01
O 12, 0
< > < <> >t1 t2 t3
t1 + t2 + t3 = TW255
< t1
3-10 10 Series CNC PLUS Library - User Manual (03)
Counters and Timers
$T_START: Enables/disables PLUS timer
LD/FBD :
T_START
Chapter 3
Type: internal
timer_num preset
control
Tind Pre Ctr
St
stat_wrd
IL:
CAL $T_START timer_num preset control stat_wrd
INPUT VARIABLES : timer index (0...255) (short)
preset value (short) control word (short)
OUTPUT VARIABLES: status word (short)
Description:
The $T_START function controls PLUS timers. It facilitates timer operation by providing an alternative to the functions described in previous pages. The "preset"parameter specifies the base time units to be "loaded" in the timer. The bits of the "control" parameter must be read as follows:
bit meaning
0 go/stop
1-15 reserved
On the rising edge (from 0 to 1) of bit 0 of the "control" parameter the timer starts counting by decrementing the preset value. The current value is available on the TWn variable (where n is the timer number). FB $T_READ permits to monitor the timer status. It indicates whether the timer is counting, has stopped counting or has been disabled. On the falling edge (from 1 to 0) of bit 0 of the "control" parameter the timer is stopped and reset.
The $T_START function provides the following values of the STAT_WRD parameter:
Value Meaning
0 OK
10 Series CNC PLUS Library - User Manual (03) 3-11
Loading...