SINUMERIK 840C
Software Versions 1, 2, 3, 4, 5 and 6
135 WB2/WD PLC Function Blocks
Package 0: Basic Functions
Planning Guide01.99 Edition
Manufacturer Documentation
SINUMERIK 840C
Software Versions 1, 2, 3, 4, 5 and 6
135 WB2/WD PLC Function Blocks
Package 0: Basic Functions
Planning Guide
Manufacturer Documentation
Applies to:
ControlSoftware versions
SINUMERIK 840C/CE
(Standard/Export Version)1, 2, 3, 4, 5 and 6
01.99 Edition
SINUMERIK® documentation
Printing history
Brief details of this edition and previous editions are listed below.
The status of each edition is shown by the code in the "Remarks" column.
Status code in ”Remarks” column:
A . . . New documentation
B . . . Unrevised reprint with new Order No.
C . . . Revised edition with new status.
If factual changes have been made on a page since the last edition, this is
indicated by a new edition coding in the header on that page.
EditionOrder No.Remarks
06.936FC5197-2AA30-0BP0A
12.936FC5197-3AA30-0BP0C
10.946FC5197-4AA30-0BP0C
09.956FC5197-5AA30-0BP0C
04.966FC5 197-5AA30-0BP1C
07.976FC5 197-6AA30-0BP0C
01.996FC5 197-6AA30-0BP1C
This manual is included in the documentation on CD-ROM (DOCONCD)
EditionOrder No.Remarks
01.996FC5198-6CA00-0BG1C
For more information, refer to the Internet:
http://www.a&d.siemens.de/sinumerik
The publication was produced on the Siemens 5800 0ffice System.
The reproduction, transmission or use of this document or its
contents is not permitted without express written authority.
Offenders will be liable for damages. All rights, including created by
patent grant or registration of a utility model or design, are reserved,
Order No. 6FC5197-6AA30-0BP1
Printed in the Federal Republic of Germany
Other functions not described in this documentation might be
executable in the control. This does not, however, represent an
obligation to supply such functions with a new control or when
servicing.
We have checked that the contents of this publication agree with
the hardware and software described herein. The information given
in this publication is reviewed at regular intervals and any
corrections that might be necessary are made in the subsequent
printings. Suggestions for improvement are welcome at all times.
Subject to change without prior notice.
Siemens-Aktiengesellschaft
Definitions1
Data Sheets for Digital Functions
Data Sheets
for Scanning/Displaying Messages
Data Sheets for Sequencer Blocks4
Block Data
Appendix6
2
3
5
Preliminary Remarks
Notes for the reader
This documentation is intended for manufacturers of machine tools using SINUMERIK 840C.
The publication explains the application of the complete Software Package 0, Basic Functions,
which the machine tool manufacturer can incorporate in his PLC program.
The SINUMERIK documentation is organized in 4 levels:
•General documentation
•User documentation
•Manufacturer documentation
•Service documentation
The Manufacturer Documentation for the SINUMERIK 840C control is divided into the
following parts:
•
Interface Description
Part 1: Signals
Part 2: Connection Conditions
The diskette for package 0 contains package versions 16, 20, 21 and 22. Depending on the
SINUMERIK 840C software version being used, one of the following package 0 versions must
be used.
Not applicable
Not applicable
KMBinary pattern, 16 positions
KYTwo absolute values from 0 to 255
KHHexadecimal number, max. of 4 positions
KSTwo alphanumeric characters
KTTime (1.0 to 999.3)
KCCount (0 to 999)
KFFixed-point number (-32768 to +32767)
Allowed actual operand
In.m Input
Qn.m Output
Fn.m Flag
IBn Input byte
QBn Output byte
FBn Flag byte
DLn Data byte left
DRn Data byte right
PBn I/O byte
IWn Input word
QW n Output word
FWn Flag word
DW n Data word
PWn I/O word
DBn Data block
FBn Function block
PBn Program block
SBn Sequence block
Input signal, statically effective
Input signal which is acknowledged by the FB
Input signal whose leading edge is evaluated
No DW allowed as parameter
Input signal which must be applied before the FB call
Defined input signal which need not be applied,
e.g. NC signal
Output signal, statically effective
Output signal which must be acknowledged by the
user
Output signal for one cycle (pulse)
Output signal on defined flag or data word which
can be evaluated immediately after the FB
Defined output signal, e.g. NC signal
Error number ACCU2 for system stop (STS); ACCU1
FB number
Additional specification of interface byte number
in high byte ACCU2
1 Definitions06.93
1.2 Overview of PLC interface
1.2Overview of PLC interface
1.2.1Inputs
Inputs
Byte
No.
76543210
0
127
128
255
1.2.2Outputs
Byte
No.
76543210
0
127
Bit No.
Physical interface with process image
(Input modules, DMP submodules, machine control panel)
Physical interface without process image
(Input modules, DMP submodules)
Outputs
Bit No.
Physical interface with process image
(Output modules, DMP submodules, machine control panel)
1. To simplify programming, the interface signals from data blocks can be copied into flag
area FY 25 - 99 using function macros FB 70, FB 71.
Function macros are function blocks programmed in Assembler and integrated in the PLC
operating system.
2. Flag area FY 224 - 255 is saved by the basic program integrated in the system software
on a level change and on a warm restart. The flag area is reloaded when the relevant
program has ended.
This flag area can also be used to store intermediate results.
Flag area FY 200 - 223 is used in part by function blocks (see FB Package Description). If
the user does not require these function blocks, these flags can be used in the same
manner as those in flag area FY 25 - 199.
Caution:
Flag area FY 200 - 255 is also used in part by SIMATIC FBs. Flag area FY 200 - 255 is saved;
this setting is performed via PLC MD.
Data formats:
All word-oriented interface signals are input and output as fixed-point numbers. Exceptions
MELD
DB-ZENTRAL
MDG WO
MDF WO
MDA WO
MDG BI
MDF BI
MDA BI
IKO-DB
INT-MSTT
SEA WO
SEA BI
Diagnostic DB
PLC status channel (up to SW2, not used in SW3), from
SW4 used for ”Rapid data channel” function
PLC data channel (up to SW2, not used in SW3), from
SW4 used for ”Rapid data channel” function
Error and operational messages
Interface NC channel 1
Interface NC channel 2
Interface NC channel 3
GI signals and 611D signals (GI=gearbox interpolation)
Decoded M functions (list)
Interface for spindle-specific signals
Interface for axis-specific signals
Reserved
Input buffer, computer link
Output buffer, computer link
Interface for data transfer NC
<-> PLC
Data transfer control
Status DB computer link
Interface for operator panel
Interface for command channel
Interface for NC/PLC communication
Input signals from PLC 1880/880 GAZ only
Output signals to PLC 1880/880 GAZ only
Input signals from PLC 2880/880 GAZ only
Output signals to PLC 2880/880 GAZ only
Input signals from PLC 3880/880 GAZ only
Output signals to PLC 3880/880 GAZ only
Input signals from PLC 4880/880 GAZ only
Output signals to PLC 4880/880 GAZ only
Interface for general messages
Central DB in link RAM880/880 GAZ only
MD words operating system
MD words function blocks
MD words user
MD bits operating system
MD bits function blocks
MD bits user
Icon control in MMC
Internal machine control panel
SE user words
SE user bits
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
FB
OS
OS
OS
OS
CL
CL
OS
OS
CL
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
OS
Abbreviations:
OS PLC operating system
CL Computer link
SE setting data
FB Description of
Functions
Safety Integrated
1–4
Note:
Data blocks marked * are generated and initialized by the PLC
operating system on each cold restart, after a general reset. These
blocks are always reinitialized with every automatic cold restart.
EM/OM acknowledgement signals (up to SW2)
DB status words for EMs/OMs (up to SW2)
EM/OM acknowledgement signals (up to SW2)
EM/OM acknowledgement signals (up to SW2)
List for M decoding, NC Channel 1
List for M decoding, NC Channel 2
List for M decoding, NC Channel 3
List for M decoding, NC Channel 4
Assignment user-interface/logical peer destination
Texts for file transfer display (operator request)
Input user interface
Output user interface
Buffer for tool data
Tool management, operator interface
system
0FB Package 0
CLComputer link
UR User
1FB Package 1
Note:
Data blocks marked * are generated and initialized by the PLC
operating system on each cold restart, after a general reset. These
blocks are always reinitialized with every automatic cold restart.
Identifiers
Identifiers
Identifiers
Ident. number
Ident. number
Duplo number
User data
User data
User data
User data
User data
User data
User data
Reference list
Reference list
Reference list
Reference list
Reference list
Reference list
Reference list
Reference list
Reference list
Replacement location number
Tool holder L1
Tool holder L1
Tool holder L2
Tool holder L2
Adapter geometry L1
Adapter geometry L1
Adapter geometry L2
Adapter geometry L2
Adapter position
system
0FB Package 0
CLComputer link
UR User
1FB Package 1
Note:
Data blocks marked * are generated and initialized by the PLC
operating system on each cold restart, after a general reset. These
blocks are always reinitialized with every automatic cold restart.
1)
Data blocks marked
are created contiguously according to the
tool management configuration.
DBs 150 to max. DB 182 are needed when tool management is used. The
actual number of data blocks depends on the "width" of the magazine
table (see documentation: SINUMERIK 840/840C/880/880 GA2, Function
Blocks for PLC 135 WB, Package 1 and 2: Tool Management).
1.3.2Class DX data blocks
Data blocks DX0-105 are used or reserved for Siemens applications.
Data blocks DX106-255 are available to the user.
Function blocks FB0-199 are used or reserved for Siemens applications.
Function blocks FB200-255 are available to the user.
FB
No.
11 *
12 *
17
27
30
32
33
35
36
37
39
40
41
42
43
45
45
47
48
48
49
50
51
52 *
FB desig.FB namePack.
EINR-DB
WDTGR
STATUS
IM308C
MUL:16
DIV:16
DIV:32
DIV/100
ADD:32
SUB:32
DUAL/BCD
COD:16
COD:32
Create data blocks
Retriggering cycle monitoring
PLC status channel (840C SW 1 and 2)
Profibus interface for 840C (SW 6.1 and higher)
Multiplication of two 16-bit binary numbers
Division of two 16-bit binary numbers
Division of two 32-bit binary numbers
Division by 100
Addition of two binary numbers
Subtraction of two binary numbers
Convert binary to BCD, 4 decades
Convert fixed-point binary number (16 bits) to BCD
number
OS
OS
0
0
0
0
0
0
0
0
0
0
Convert fixed-point binary number (32 bits) to BCD
COD:B4
number (flags used: FW 220, 238)
0
Convert BCD number (4 decades) to fixed-point binary
COD:B8
number
0
Convert BCD number (8 decades) to fixed-point binary
0
0
0
0
0
0
0
0
0
OS
GST-FMBM
ANLAUF
PSP:FMBM
FMBM:HSG
FMBM:MMC
UP:57/58
UP:FB49
UP:FB45
BTR 8-16
number
Initial settings for error messages/operational messages
Initial settings for error messages/operational messages
(840C SW 3)
Buffer, error/operational messages
Auxiliary signals for EMs/OMs
Auxiliary signals for EMs/OMs(840C SW 3)
Subroutine FB57, FB58
Subroutine FB49
Subroutine FB45
Block transfer between 8 bit and 16 bit memory
Display error messages (840C SW 1 and 2)
Display operational messages (840C SW 1 and 2)
Display message groups (840C SW 1 and 2)
Scan error messages
Scan operational messages
Scan message groups (840C SW 1 and 2)
Block transfer
Read NC data
Write NC data
Read PLC data from PLC 1/2/3/4
(applies to 880 only)
Write PLC data to PLC 1/2/3/4(applies to 880 only)
Note:
Blocks marked * are function macros which are integrated in
the PLC operating system.
SUCH
SUCHROUT
LEERPL1
SUCH-SYM
SUCH-VOR
SUCH-RWS
WZV-INIT
EINR-MAG
WZ-GR:ST
Transfer flags -Flag stack-Transfer direction keys (840C T version) to axes
Aperiodic program call
G functions decoding
Transfer interface DB to I/Q/F
Transfer I/Q/F to interface DB
Transfer NC channel -Transfer DB channel -Transfer spindle -Transfer DB spindle -Transfer axis -Transfer DB axis -Transfer machine control panel -Transfer machine control panel --
Mode LED driver
Read block start address
Sequencer forwards/reverse
Sequencer reverse
Sequencer forwards/reverse Graph 5
Sequencer automatic Graph 5
Computer link FB
Reserved, transfer tool data
Reserved
Reserved
Reserved
Global functions
Messages
File transfer (operator request)
Reserved
Reserved
Reserved
Reserved
Subroutine for FB 101
Subroutine
Reserved
Search for word
Search routine
Search for empty location without default
Direction of search, symmetrical
Forward search
Backward search
Initialize tool management
Create magazine table
Standard tool size
Reserved
Reserved
Magazine assignments
Selection tool according to T number
Load/unload magazine from preselect/spindle
Spare
Display tool data from buffer assignments
Change tool data from buffer assignments
Display tool data from magazine assignments
Change tool data from magazine assignments
Selection tool according to cursor position from magazine
assignments
Additional cutter from buffer and magazine
Additional cuffer from loading
Load
Unload
Spare
Manual acknowledgement
Abort manual magazine/spindle
Display next cutter
Reactivate tool
Delete last cutter
Select loading display, punched tape
Acknowledge punched tape positive/negative
Abort punched tape
Spare
Spare
Diagnostics main module
General functions 1
General functions 2
SINUMERIK-dependent functions
PLC-dependent functions
Reserved
Reserved
Logging measuring data
Transfer part program
Process part program
Printer output
Subroutine
Send data to MMC (reserved for OEM customers)
Receive data from MMC (reserved for OEM customers)
Decode axis-specific G functions (840C SW 3 and higher)
Reserved
Reserved address calculation flag area
Reserved
Reserved
Reserved
Icon display
Star-delta switchover (840C SW 3)
Reserved PG functions
Reserved PG functions
Reserved PG functions
Reserved PG functions
Reserved PG functions
Reserved PG functions
Reserved
8FB Package 8
OS PLC Operating System
CP Cycles Package
CL Computer Link
Caution:
1. Make sure that no confusion with SINUMERIK blocks is possible. The user must not utilize
a SINUMERIK standard block name, nor may he assign a SINUMERIK library number to
his user blocks.
2. In the range of FB 0 - FB 199
FX 0 - FX 99 SINUMERIK blocks have absolute priority.
If SINUMERIK blocks must be used at a later time that overlap user block numbers, the
user blocks must be given a new number.
The ”Multiplier:16” function block can be used to multiply two fixed-point binary numbers
(15+1 bits).
The result is a fixed-point binary number (31 + 1 bits).
The function block also scans the result for ”zero”.
If 8-bit numbers are to be multiplied, they must be transferred to 16-bit words.
Function:Y = A x B
Y = Z32, Z31; A = Z1; B = Z2
2. Block data
Lib. No.: E88530-B 6030-A-_ _
FBs to be loaded: FB30
DBs to be loaded: None
Type of FB call: Unconditional
DBs to be input: None
Error messages: None
06.932 Data Sheets for Digital Functions
FB 32 DIV:16 16-bit binary divider
FB 32 DIV:16
16-bit binary divider
1. Description
The ”Divider:16” function block is used to divide two fixed-point binary numbers (15+1 bits).
The result (quotient and remainder) is a fixed-point binary number (15 + 1 bits).
The function block also scans the result for ”zero”.
If 8-bit numbers are to be divided, they must be transferred to 16-bit words.
Function:A
Y = –––
B
Y = Z3; remainder = Z4
A = Z1, B = Z2
2. Block data
Lib. No.: E88530-B 6032-A-_ _
FBs to be loaded: FB32
DBs to be loaded: None
Type of FB call: Unconditional or conditional
DBs to be input: None
Error messages: None
2 Data Sheets for Digital Functions06.93
FB 32 DIV:16 16-bit binary divider
3. Block call
FB 32 DIV:16
I, W –Z1OV– Q,BI
I, W –Z2FEH– Q,BI
Z3=0– Q,BI
Z4=0– Q,BI
Z3– Q,W
Z4– Q,W
4. Signal descriptions
Z1, Z2The dividend must be stored in Z1, the divisor in Z2.
OVA ”1” signal indicates overflow (divisor is negative).
FEHOutput FEH is set on division by zero.
Z3=0A ”1” signal indicates that the arithmetic result is zero.
Z4=0A ”1” signal indicates that the remainder is zero.
Z3, Z4The result of the division is stored in Z3, the remainder in Z4.
06.932 Data Sheets for Digital Functions
FB 33 DIV:32 Divider:32
FB 33 DIV:32
Divider:32
1. Description
The ”Divider:32” function block divides two fixed-point binary numbers (31+1 bits).
The result (quotient and remainder) is a fixed-point binary number (31 + 1 bits).
The function block also scans the result for ”zero”.
Function:A
Y = ––––
B
Y = Z32, Z31; remainder = Z42, Z41
A = Z12, Z11; B = Z22, Z21
2. Block data
Lib. No.: E88530-B 6033-A-_ _
FBs to be loaded: FB33
DBs to be loaded: None
Type of FB call: Unconditional
DBs to be input: None
Error messages: None
2 Data Sheets for Digital Functions06.93
FB 33 DIV:32 Divider:32
3. Block call
FB 33 DIV:32
I, W –Z12OV– Q,BI
I, W –Z11FEH– Q,BI
I, W –Z22 Z3=0– Q,BI
I, W –Z21 Z4=0– Q,BI
Z32– Q,W
Z31– Q,W
Z42– Q,W
Z41– Q,W
4. Signal descriptions
Z12,High-word dividend, low-word dividend
Z11The high word of the dividend must be stored in Z12 and the low word in Z11.
Z22,High-word divisor (bits 16 to 31), low-word divisor (bits 0 to 15)
Z21The high word of the divisor must be stored in Z22 and the low word in Z21.
OVOverflow
A ”1” signal signifies an overflow.
FEHFault (division by 0)
Output FEH is set on division by zero.
Z3=0Quotient equal to zero
A ”1” signal indicates that the arithmetic result is zero.
Z4=0Remainder equal to zero
A ”1” signal indicates that the remainder of the division is zero.
Z32,High-word quotient (bits 16 to 31), low-word quotient (bits 0 to 15)
Z31The high word of the arithmetic result (with sign) is stored in Z32, the low word in
Z31.
Z42,High-word remainder (bits 16 to 31), low-word remainder (bits 0 to 15)
Z41The remainder of the division is output in words Z42 (high word) and Z41 (low