C Hoch
C Hoch
Manufacturer Documentation
SINUMERIK 840/840C
SINUMERIK 880/880 GA2
PLC 135 WB, S5-HLL,
High-Level Language Programming
Planning Guide
Manufacturer Documentation
Valid for:
11.92 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 the page since the last edition, this is
indicated by a new edition coding in the header on that page.
Planning Guide
Manufacturer Documentation
Introduction 1
Installation 3
Operation 4
Programming with C 8
Programming Examples 9
Page
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–1
3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–1
4 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–1
1 Introduction
The PLC 135 WB is programmed with the control language STEP 5. This language is tailored
to the needs of a programmable logic controller, i.e. to high-speed bit processing.
The tasks performed by the PLC as an interface between numerical controls (NC) and
machine tools have increased enormously over the years. The PLC has taken on a key role in
the powerful combination of NC and machine.
PLC programs have become so complex that high-level programming languages have
emerged as powerful tools for programming the PLC. Program branches, conditions and the
processing of large data blocks can be programmed faster and more compactly in high-level
languages than in STEP 5. Structogram generators are also available for high-level languages
for the graphical description of program structures and the automatic generation of high-level
language source code (e.g. XTOOLS).
When programming the PLC, the high-level language compiler must generate code and
runtime-optimized machine programs, because the program memory has to be utilized as
effectively as possible and the programs are components of a real-time system.
The availability of software development tools for many high-level languages even makes it
possible to create and test programs on standard PCs.
Off-line test
In combination with a standard high-level language debugger, the HLL data generator enables
the HLL blocks to be tested on the same PC on which they are programmed. The PLC is
simulated with the aid of the data generator. The PLC system data can be displayed and
modified.
On-line test
The HLL on-line debugger enables the HLL blocks to be tested on the PLC. You can use a
programming device to test the operation of your HLL function blocks directly in the application
environment.
HLL
Abbreviation for high-level language. HLL is used as a synonym for the languages PL/M and/or
C, particularly in cases where it is irrelevant whether the language is PL/M or C.
PLC
In this documentation, the term PLC always refers to the PLC 135 WB. A distinction is made
between the PLC 135 WB version with the COP coprocessor and the version with the ACOP
coprocessor.
PL/M
The term PL/M always refers to PL/M-86 of the intel Corporation.
C
C always refers to iC86 of the intel Corporation.
The target hardware for the generated function blocks is the PLC 135 WB. The block
generator distinguishes between versions of the PLC 135 WB with COP or with ACOP.
The block generator runs under MS-DOS. The following software components are required:
• S5-HLL block generator for SINUMERIK (Siemens, Version 2.2)
• ASM86 for DOS (intel, Version 2.1)
• PL/M-86 for DOS (intel, Version 2.7)
• iC-86 for DOS (intel, Version 4.1)
• LINK86 for DOS (intel, Version 2.7)
• LOC86 for DOS (intel, Version 2.5)
• OH86 for DOS (intel, Version 1.1)
• SuperCopy (Comfood Software GmbH)
• Program editor (e.g. Aedit, Word, etc.)
3 Installation
This chapter describes the installation of the S5-HLL block generator on your MS-DOS
computer.
The producers of these programs and permissible versions are listed in the section entitled
"Requirements for the Operation of the Block Generator".
On the supplied diskette, you will find the installation program INSTALL.EXE, which is used to
install the S5-HLL block generator on your hard disk. Insert the diskette in a diskette drive on
your computer and change to this drive. To start the program, enter the following command in
the command line:
INSTALL
3–2
aaaaaaaaaaaaaaaaaaaaaaaa aa
aaa
aaa
aa
a a
aa
aaa
aaa
aaaa
aaa
a
aaaaaaaaaa
aaaa aaaaaaaa aaaaaaaaaa
•
•
•
aaaaaaaaaaaa aaaa aaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaa
Paths
aaaaaaaaaaaa a
aa
aa
aa
a aaaa
aaaaa
aa
aa
aa aaaaaaaaaa
aaaa aa
a aaaaaaaaaa
3 Installation
aaaaaaaaaaaaaaaaaa a
aa
aa
aa
a
aa
a
a
aa
a
aa
aaa
a aaaaaaaaaa
aaaa aaaaa
Installation Menu
aaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaa
aaaa aaaaaaaa aaaaaaaaaa
Object Files
Source Data
aaaaaaaaaaaaaaaaaa aaa aaaaaaaa
System Data
aa
a aaaaaaaa aaaaaaaaaa
Program Lists
aaaaaaaaaaaaaaaaaa aa
aaaa aaaaaaaa
Copy
Copy
aaaaaaaaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaa
3.2 Installation Program
Block Generator
aaaaaaaaaaaaaaa a
aa
aa
aa
a aaaa
aa
aa
aa
aa
a
aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa a
aa
aa
aa
aa aaaaaaaaaa
aaaaaaaaaaaaaaaaaa aa
a aa
aaa
a aa
aaaaa
aaa
a
aaaaaaaaaa
a
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaaaaaaa
:
:
:
:
aaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaa
aaaaaaaaaaaaaaa a
aa
aa
aa
a aaaa
aa
aa
aa
aa aaaaaaaaaa
aaaaaaaaaaaaaaaaaa a
aa
aa
aa
a aa
aaaaa
aaa
a
aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaaaaaaa
aaaa aaaaa aaaaaaaaaa
> C:\PLM
aaaaaaaaaaaa aa
aaa
aa
a aaaa
aa
a aaaaaaaaaa
aaaa aa
aaa
aaa
SINUMERIK S5-HLL Installation Program
aaaa aaaaa
> C:\PLM\LIST
aaaaaaaaaaaa aaaa aaaaa aaaaaaaaaa
aaaaaa a
aa
aa
aa
a aaaa
aa
a aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
a aaaaa
a
aaaa
aa
a
aa
aaa
a aaaaaaaaaa
> C:\PLM\OBJECT
for the block generator
aaaa aaaaa
> C:\PLM\SOURCE
the installation program
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a aaaaaaaaaa
aaa aaaaa
Then start the installation with function key F2.
aaaaaaaaaaaa aaaa
a aaaaa aaaaaaaaaa
aaaaaaaaaaaa a
a
aa
aaa
a a
aa
aa
aa
aa
a aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a aaaaaaaaaa
aaaaaa aa
aaa
aa
a aaaa
aa
a aaaaaaaaaa
aaaa aa
aaa
aa
aa
aa
aaa
<
<
<
<
aaaaaaaaaaaaaaaaaaaaaaaaaaa aaaa aaaaaaaa aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a aaaaaaaaaa
aaaa aaaaa
Block Generator
Block Generator
aaaaaaaaaaaa aaaa aaaaa aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a aaaa
aa
a aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a
aa
a
a
aa
a
aa
aaa
a aaaaaaaaaa
aaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a aaaaaaaaaa
aaaa aaaaaaaa
aaaaaaaaaaaaaaa aaaa
a aaaaa aaaaaaaaaa
aaaaaaaaaaaa a
a
aa
aaa
a a
aa
aa
aa
aa
a aaaaaaaaaa
Menu 1
Menu 1
aaaa aaaaa
To start, define your individual path environment with function key F1.
End
End
aaaaaaaaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
a aaaaaaaaaa
aaaaaaaaaaaa a
aa
aa
aa
a a
aa
aa
aa
aa
a aaaaaaaaaa
Version 1.1
aaa aaaaa
Version 1.1
aaaaaaaaaaaa aa
a aaaaa aaaaaaaaaa
6FC5197-0AC00-0BP0
aaaaaaaaaaaa aaaa
aaaaaa aaaaa
a
11.92 3 Installation
3.2 Installation Program
The software suggests default directories for the standard installation of the block generator.
The following files are stored or are expected to be found in the following separate directories:
Block generator:
System Data All data relating to the block generator are stored here.
Source Data The C or PL/M source files are stored here.
Object Files The compiled, linked and located HLL blocks are stored here.
Program Lists The program lists and MAP files of the HLL blocks are stored here.
The conventional editing keys are available for changing the default directories: Ins, Del, BS,
Home, Ret and the cursor control keys. If you change the name of a directory, you can restore
the old name by pressing the Escape key as long as the cursor is positioned in the field.
When you have defined all the directories, start the installation by pressing F2.
The installation then proceeds as follows:
• The defined directories are created.
• The batch file INST.BAT is started. This file copies the files from the supplied diskette into
the directories which you have defined on the hard disk.
When all the files have been copied, you can exit the installation program by pressing function
key F8.
Note:
When installing the HLL data generator, the directories which you define for the block
generator must be the same as entered here.
A program editor call is integrated in the block generator. You can thus edit HLL programs
directly by calling the program editor from the block generator. You can choose your own
program editor; the AEDIT editor (intel) is the default setting.
The program editor is called by the block generator via the batch file EDIT_HLL.BAT. You can
integrate the desired program editor (or, to be more precise, you can integrate the call) by
editing the EDIT_HLL.BAT file. In the most straightforward case (where the editor is stored
within the search path of the operating system) you will only need to change the name of the
default editor (AEDIT).
Parameters %1 to %8 for the batch file are passed by the block generator.
Note:
Following processing of the batch file by the operating system, the same current directory and
drive must be set as when the block generator was called. If the current directory is changed
in EDIT_HLL.BAT, it must be reset at the end of EDIT_HLL.BAT using parameters %1 and
%2.
Example for EDIT_HLL.BAT with directory change:
c:
cd \editor
editor %3%4%5
%1
cd %2
The block generator expects to find the file EDIT_HLL.BAT in the current directory (the
directory that was set when the block generator was called). This allows any user to use a
program editor of his choice without having to modify the installation of the block generator.
This section summarizes all the steps for installing the block generator with the aid of the
installation program.
Installation steps:
• Start the computer
• Insert the program diskette containing the S5-HLL block generator in drive A: of your
computer.
• Make drive A: the current drive by entering A: and pressing the Return key.
• If a README file is stored on the program diskette, please read this file and follow the
instructions provided.
• Start the installation program by entering INSTALL and pressing the Return key.
• Enter the desired directory names in the menu of the installation program.
• Start the file transfer for the block generator by pressing function key F2. When the
required directories have been set up and the files have been copied from the program
diskette, you can exit the installation program by pressing function key F8.
• Press function key F1 to call up the menu for entering the directories. Enter the desired
directory names.
• Install the programs
PLM86
iC86
ASM86
LINK86
LOC86
OH86
in the directory which you have defined in the installation menu as the system directory for
the block generator. Please follow the installation instructions provided by the
manufacturers of these programs.
• Install the SUPERCOPY program in accordance with the instructions of the manufacturer.
• Define the program editor:
In the file HLL_EDIT.BAT, specify the program editor which you want to use to edit HLL
programs from the block generator (see the section entitled "Integration of the Program
Editor"). If the program editor is not yet ready for operation, please install it now on your
computer.
• Check the FILES command:
The block generator opens up to 10 files simultaneously. Check whether the value in the
FILES command in the CONFIG.SYS file on your computer is sufficiently high and
increase the number if necessary.
• Specify the screen type:
If the computer on which you install the block generator has a plasma screen, you must
include the following entry in the AUTOEXEC.BAT file of your computer (please remember
to enter the command in upper case letters):
SET SWSCREEN=MONO
When you have done this, restart your computer to invoke the command. In the event of
an operating system error message (such as "Insufficient environment memory"), please
consult your DOS manual.
The paths to these directories are defined during the installation and can be displayed and
modified in Menu 1.1 "Define Directories" of the block generator (see the section entitled
"Operation"). The directory with the system programs and the S5-DOS directory are not yet
required at the time of installation. Please enter these directories in Menu 1.1. The current
directory is the directory which is active when you call the block generator.
The following list shows which files of the block generator are stored or are expected to be
found in the individual directories.
Note:
If no path for the system programs is specified in Menu 1.1 "Define Directories", the DOS
search path is used when the listed system programs are called.
• List directory:
– Compiler lists for the HLL source blocks (*.LST)
– Assembler lists for the block headers and block ends (*.LST)
– Error list of the assembler (*.ERR)
– List file for diagnostics data and error messages (S5HLL.ERR)
– Cross-reference lists (*.CRF)
– Map files for the linker (*.MP1)
– Map files for the locator (*.MP2)
• S5-DOS directory:
– S5-DOS block file
– Copies of the link and list files for the HLL blocks entered in the block file (insofar as
link and list files exist for the blocks)
• Current directory:
– Batch file for calling the program editor EDIT_HLL.BAT
– Include files of HLL blocks (if no path is specified in the include statement)
– Temporary files for the block generator
– Parameter file S5.PAR with the data of the last block generator call made from this
directory
4 Operation
The operation of the block generator is performed mainly using the function keys. Certain
other special keys are also used in some of the menus. Particular reference should therefore
be made to the meaning of the special keys in the individual menus.
The active input field is always displayed in inverse format and/or highlighted in color.
Some functions in the block generator do not require a menu. If errors occur with these
functions, the error messages appear, where possible, in the menu last displayed.
a
a
a
aa
a
a
a
a
a
a
a
aaaaa
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
a
Menu 1 Menu 1.1
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aaaa
a
Menu 2
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Menu 6
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
Notes:
• If several processing steps are selected simultaneously in Menu 2, the block generator
determines the sequence of the menus and the other processing steps automatically. The
sequence of the processing steps is based on the requirements of the block generation.
• If the predefined directory structure does not match the real directory structure, Menu 1.1
"Define Directories" appears with an error message when the block generator is called.
You can use upper or lower case letters for input. The block generator converts the entries in
the menu fields to upper case.
When you use a progarm editor to edit the source files of the block programs, the input
notation (upper or lower case) is retained.
_______
a
aa
aa
aa
aa
aa
aa
aa
aa
a aa aa
a
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
a
aaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa
aa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
a
aaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa
aa
aa
a
aaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
a
aaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa aa
aa
a
call)
aaaaaaaa aa aaaaaaaaaaaa aa
Check parameters 2)
Define block interface
aaaaaaaaa aa
aaaaaaaaaaaaaaaaaaaa aaa
Change block interface
aaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
a
aaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa aa
aa
a
Only possible when calling other PL/M blocks from PL/M blocks
Compile HLL source program
aaaaaaaaaaaaaaaaaa aaaaaaaaa aa aaaaaa aaaaaaaaaaaaaaaaaaa aaa
6FC5197-0AC00-0BP0
Correct hex code and convert
aaaaaaaa aa a
aaaaaaaaaaaaaaaaaa aa
a aaaaaaaaaaaaaaaaaaa aa
a
or change declarations and module header
aaaaaaaaa aa
a
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
aaa
a
aa
a
a
aaaaaaaaaaaaaaaaaaa
a
aa
aaaaaaaaaaaaaaaaaaa
aaa
a
aa
aa
aa
aa
aa
aa
aa
aa aaaaaaaaaaaaaa aaaaaaaaaaaa a
aaaaaaaaa
a
Only relevant for HLL blocks generated with Version 1 of the block generator
Generate module body for the HLL source program
4–3
4.2 Block Generation Sequence
a
aa
aa
aa
aa
a aa
a
aa
aa
aa
aa
a a
aaa
aa
aa
a
4–4
4.4
4.3
aaaaa aaaaa aa
aa
aa
aa
a
aaaaa a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
Note:
aaaaa aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaa aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
a S5_DOS
aaaa aaaaa
4 Operation
aaaaa aa
aa
aaaa
aaa aaaaa
a aaaaa
reactivated.
aaaaa aaaaaa aaaaa
aaaa aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaaaa aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaaaa a
aa
aa
aa
aa
a aaaa
aa
a
aaaaaaa a
aa
aa
aa
aa
aa
a
aa
a
a
aa
a
aa
aaa
a
aaaaaaa aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaa aaaaa
Continue Defpath
aaaaaaa aaaaaa aaaaa
SINUMERIK S5-HLL
aaaaa a
aaaa
aa
a aaaa
aa
a
a
a
aa
a
aa
aaa
a
aa
a
a
aa
a
aa
aaa
a
4.3 Calling the Block Generator
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
Block Name
PLC System
aaaaa aaaaaa aaaaa
Block Number
and pressing the Return key.
aaaa
aa
a a
aa
aa
aa
aa
a
Library Number
aa
aaa
aaa aaaaa
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaa aaaaa
Language (PL/M, C)
a
aa
aa
aa
aa
a aaaa
aa
a
a
aa
aa
aa
aa
a
aa
a
a
aa
a
aa
aaa
a
aaaaa a
aaa
aa
aa
aa
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
The block generator is started by entering
aaaa
aa
a aaaa
aa
a
:
:
:
:
:
:
aa
aaa
aaa aa
aaa
aaa
aaaaa aaaaa
Calling the Block Generator
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aa
aaaa
aa
a a
aa
aa
aa
aa
a
aaaaa a
aa
aa
a
aa
aaa
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaa aaaaa
Block Generator
>X<
aaaaa aaaaa
Parameters for HLL Block (Menu 1)
a
aa
aa
aa
aa
a aaaa
aa
a
>004<
a
aa
aa
aa
aa
a
aa
a
a
aa
a
aa
aaa
a
>PL/M<
aaaaa aaaaa
>09135<
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa a
aa
aa
aa
aa
aaaaaaa aa
aa
aaaa
aaa
a aa
aaaaa
aaa
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
>TOOLVERW<
aaaaa aaaaa
appears on the screen. (The data in the input fields are examples.)
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aa
aaaa
aa
a a
aa
aa
aa
aa
a
a
a
aa
a
aa
aaa
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
Menu 1
aaaaa aaaaa
the desired directory structure has been defined (see the description of function key F2
aaaaa aaaaaa aaaaa
aaaa aaaaa
block generator), the data of the last block to be processed from the current directory are
aaaaa aa
aa
aaaa
aaa aaaaa
a aaaaa
The block generator checks your parameters to see if the block already exists. This check
aaaaaaaaaaa aaaaa
Back
If an S5.PAR file already exists in the current directory (it is generated automatically by the
aaaa aaaaa
includes the directories which appear in Submenu 1.1. You should therefore make sure that
aaaaa
aa
aaaaa aaaaa
In this menu, you enter the basic parameters for the function block which is to be processed.
When the block generator is called, the following menu (Menu 1 "Parameters for HLL Block")
a
aa
aa
aa
aa
a a
aa
aa
aa
aa
a
aaaaa aaaa
Version 2.2
6FC5197-0AC00-0BP0
aaaaa aa
a
aaaa
aaaaa
a
11.91 4 Operation
4.4.1 Define Key Data of HLL Block
When you move the cursor away from one of the input fields for the block type, block number
or programming language, the block generator checks whether a block for the current data
already exists in the defined directory structure. If the block generator finds a matching HLL
block, the remaining input fields of Menu 1 are filled with the data of this block.
Block number
Input: Meaning, effect:
0...255 Here you enter the number of the function block you want to process.
(decimal number)
Language (PL/M, C)
Input: Meaning, effect:
Space bar You enter the programming language in which the block is to be, or has
been, created. Press the space bar to change the programming
language in the display.
Block name
Input: Meaning, effect:
Alphanumeric, Here you can define a name for the block. The definition of a block
max. 8 characters name is optional and is not required for operation of the block
generator.
Library number
Input: Meaning, effect:
Decimal number Here you can define the number of a block library. The definition of a
library number is optional and is not required for operation of the block
generator.
PLC system
Input: Meaning, effect:
Space bar Here you can define the PLC system on which the block is to be used.
Use the Space bar to toggle the display between the PLC 135 WB with
COP and the PLC 135 WB with ACOP.
File names
This parameter defines the file name under which the block generator stores the source file for
a block. File names have the following structure:
xFyxxx.xxx
Block number
Value range: 000...255
Parameter with leading zeroes
Language identifier
P for PL/M
C for C
Notes:
• When you call the block generator, the data of the last block to be processed are generally
reactivated (see note in the section entitled "Calling the Block Generator"). If there are no
parameters for previous blocks, the following fixed values appear as the defaults in
Menu 1:
– Block: FB 000
– Block Name and Library Number: unassigned
– Language: PL/M
– PLC System: PLC 135 WB with ACOP
• If the last directories to be used no longer exist, Menu 1.1 appears (see the section
"Define Directories (Menu 1.1)").
• The input fields for block type, block number, language and PLC system must be filled in.
• The meaning of the PLC system for block generation is described in the section entitled
"Upwards Compatibility".
• A new block is not created until you reach the "Define Block Interface" processing step.
This processing step is therefore always selected for new blocks in Menu 2 "Select
Processing Steps".
Modifications to the library number or block name for existing blocks:
Modifications to the library number or block name only take effect when you reach the
"Change Block Interface" processing step. If you do not run this processing step following
a change to the block name or library number, the changes are cancelled.
When you change to Menu 2 "Select Processing Steps", the "Change Block Interface"
step is therefore always selected following a change to the library number or block name.
• The file names are assigned by the block generator and cannot be changed.
Examples:
• PL/M function block FB 16
File name: PFB016.PLM
• C function block FX 8
File name: CFX008.C
F2 Defpath
Menu 1.1 appears for defining the directories.
F8 Back
Exits the block generator. The last block to be processed and the directory structure which
was used are stored in the current directory. These parameters are used as defaults the next
time the block generator is called up (from the current directory).
If you exit the block generator without having activated F1 "Continue" from Menu 2 "Select
Processing Steps", F8 "Back" in Menu 1 acts as a Cancel function. Because the block has
not been processed in this case, no data are saved.
Space bar
Use the Space bar to toggle between the valid values in the input fields for block type,
language and PLC system.
a
a
aa
a
a
a
a
a
aa
a
aa
Back
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
aa
a
aa
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
aa
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Menu 1.1 Defining the Directories
Notes:
• When the block generator is called, it searches in the current directory for information on
the last directory structure to be used. These settings are reactivated when the block
generator is called.
• If the block generator does not find any information on the default directory structure, the
current directory is used for all paths. In this case, the fields in Menu 1.1 are empty.
• If the defaults for the last directory structure to be used do not match the real directory
structure, Menu 1.1 appears immediately after the block generator is called. In this case,
you must change the settings in the menu.
If you do not change the incorrect paths (and activate F8 "Back" instead), the block
generator uses the current directory for all paths. The default settings are deleted.
The above situation can arise when directories are deleted.
4.5.1 Paths
The length of the path for the directories is limited to 30 characters (including the drive
parameter).
Paths must be terminated with a Backslash (\); if the Backslash is omitted, it is automatically
inserted by the block generator. If you only enter a drive, you do not need the Backslash; your
entry is accepted unmodified by the block generator.
F1 Continue
The block generator initially checks whether the directories defined in Menu 1.1 exist. If not all
of the defined directories exist, the block generator outputs an error message. If this happens,
you should correct the path. If the defined directories exist, the directory structure set in Menu
1.1 is activated immediately.
When the path check is complete, you exit Menu 1.1 and Menu 1 "Parameters for HLL Block"
appears.
F8 Back
Menu 1 "Parameters for HLL Block" reappears. Any changes which you have made in Menu
1.1 are cancelled. The parameters which were active before you selected Menu 1.1 remain
valid; no checks are performed (exception: see notes above).
4–10
aaaaaaaaa aaaaaaaaaa
versa.
a
aa
aa
aa
aa
aa
aa
aa
aa
a aaaaaaaaaa
a
aa
aa
aa
aa
aa
aa
aa
aa
a aaaaaaaaaa
aaaaaaaa
4 Operation
aa
aaa
aa
aa
aa
aaaa
aaa
a
aaaaaaaaaa
Continue
aaaaa
aaaaaa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaa
aaaaa
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
Please Select:
a
aa
aa
aa
aa
a
aaaaaaaaaa
Check Block
aaaaa aaaaaaaaaa
SINUMERIK S5-HLL
aa
aaaa
aa
a aaaaaaaaaa
aaa
aaa
Generate Block
a
aa
aa
aa
aa
a
aaaaaaaaaa
aa
aaa
aaa
a
aa
aa
aa
aa aaaaaaaaaa
aa
aaaaa
aaa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
>PFX004<
a
aa
aa
aa
aa aaaaaaaaaa
aaaaaa
aaaaa
aaa
a
aaaaaaaaaa
aaaaa
aa
aa
aa
aa
a
aaaaaaaaaa
aaaaa aaaaaaaaaa
Select Processing Steps (Menu 2)
aaaaa
Block Generator
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa aaaaaaaaaa
aa
a aaaaaaaaaa
> <
> <
> <
> <
aa
aaa
aa
aa
aa
aa
aaa
>X<
>X<
aaaaa
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa aaaaaaaaaa
aa
aaaaa
aaa
a
aaaaaaaaaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
aaaaa aaaaaaaaaa
Menu 2
aaaaaaaaa
aa
aaa
aaa
a
aa
aa
aa
aa
a
aaaaaaaaaa
aaaaa
aa
aa
aa
aa
a
aaaaaaaaaa
a
aa
aa
aa
aa
aa
aa
aa
aa aaaaaaaaaa
In Menu 2, you can enter the processing steps for the block selected in Menu 1. You can
aa
aaa
aa
aa
aa
aaaa
aaa
a
aaaaaaaaaa
define several processing steps simultaneously. The block generator executes the defined
aaaaaaaaa aaaaaaaaaa
Back
a
aa
aa
aa
aa
aa
aa
aa
aa
a aaaaaaaaaa
The processing steps are selected with an "X" or the Space bar. The Space bar has a toggle
a
aa
aa
aa
aa
a aaaaaaaaaa
function which you can use to deselect processing steps which are already selected, and vice-
aaaaa
Version 2.2
6FC5197-0AC00-0BP0
aaaaa aaaaaaaaaa
aaaa
aaaaa
a
11.92 4 Operation
4.6.1 Description of the Processing Steps
This function defines the call parameters and the system interface for the new block. The
function runs in Menus 5 and 6. The block generator subsequently generates the module body
for the HLL block.
Caution:
In this processing step, the block generator creates a new block.
If this processing step is selected for an existing block,
the existing block is deleted. You are prompted
to overwrite the block or cancel the operation.
You can use this function to modify the block interface for existing blocks. Menus 5 and 6 are
also used for this function. In contrast to the "Define Block Interface" processing step, the
source file of the HLL block is not created, it is only modified.
Changes to the block name or library number which you have entered in Menu 1 are activated
during this processing step.
You can edit the block with the installed editor (see the section entitled "Installation") by
calling it from the block generator.
In Menu 3 "Compile and Link HLL Block", you can define additional link modules with which
the block is to be linked.
The block generator creates the assembler header for the function block and compiles the HLL
source file. Following error-free compilation of the block, the block is linked and located. The
hex code for the HLL block is subsequently generated from the resulting file.
In Menu 4 "Generate S5-DOS Block File" you can define which function blocks are to be
stored together in a block file. The block generator then creates the S5-DOS block file which is
used to transfer the blocks to the PLC (or initially to the programming device).
***********************************************************
* *
* SINUMERIK Block Generator S5-PL/M Version 2.2 Date 10.08.91 *
* Directory of all blocks called from: FB 8 Page: 1 *
* *
***********************************************************
FB 2 I/Q/F PFB008.PLM 99 NR : D KF
NR1 : I BY
F8 Back
Menu 1 is displayed again. The selected processing steps are not executed, however the
selections that you made in Menu 2 are retained.
Space bar
The Space bar can be used to set or cancel selections in the input fields. The Space bar acts
as a toggle function.
A new function block will initially have no call parameters. In Menu 5, a block without
parameters is represented by an empty box. The block generator asks you whether call
parameters are to be assigned to the block. In this case, Menu 5 will have the following
appearance:
aaaaaaaaaa
aaaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaaaaa
aaa
aaaaaaaaaa
SINUMERIK S5-HLL Block Generator Menu 5 Version 2.2
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
PL/M Block: FX 004
Block Name: TOOLVERW
Library Number: 9135
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Use function keys F1 and F2 to define whether or not call parameters are to be assigned to
the block.
If you enter "No" with function key F2, Menu 6 "Define/Change System Interface" appears
and no call parameters are assigned to the function block.
If you press function key F1 for "Yes", you are prompted to enter a parameter name.
Note:
If you change the interface on existing blocks which do not have call parameters, the block
generator responds in the same way as with a new block.
inp1
aaaaaaaaaa
aaaaaaaaaa
aaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
I Q D T C
When you have defined the parameter type, the meaning of the function keys changes; now
you can use them to enter the data type.
The following function keys are available for selecting the data type for input and output
parameters (parameter types I and Q):
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaa
Bit Byte Word DWord
Function Key Assignment in Menu 5 for Defining the Data Type (Parameter Type I/Q)
When you use constants as the input parameter (parameter type D), the following function
keys are available for selecting the data type:
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaa
KM KH KY KC KF KT KZ KG
a
a
a
a
a
a
a
a
a
aa
a
aa
a
a
aa
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
aa
aa
aa
aa
a
a
a
a
a
a
a
a
a
aa
a
aa
a
a
aa
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
aa
aa
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Function Key Assignments in Menu for Defining the Data Type (Parameter Type D)
When you use timer and counter information as input parameters (parameter types T and C),
the format is fixed; the definition of the new parameter is complete when you have entered the
parameter type.
The new call parameter is subsequently displayed as a terminal on the block symbol. If you
name the first call parameter of your block INP1, as in the last example, and then press F1
twice, your block in Menu 5 will look like this:
INP1 I Bit
Select the call parameter you want to change with the cursor control keys or Tab key.
The function keys in Menu 5 are only active in specific situations and are therefore not always
displayed (see previous sections).
The function keys in Menu 5 have multiple assignments. The meaning of the function keys
changes the first time you press a function key.
The data type is permanently assigned for timers and counters; no choice is therefore
provided for these types of parameters.
Please refer also to the details of data format and data format conversion for call parameters in
the section entitled "Call Parameters of HLL Blocks".
The special keys in Menu 5 are only active when the function key assignment is not visible.
, , Tab
Use these keys to select the call parameter you want to edit. The cursor can only be moved
vertically with the arrow keys. You can move to the call parameters on the opposite side of the
block symbol with the Tabulator key.
End
The End key moves you to the input field for new call parameters.
Ctrl-End
You can delete a parameter that you have already entered by pressing the Control key and
End key simultaneously.
, , Del, BS
These keys are used to edit the parameter name.
Esc
The Escape key clears your present entry in the input field as long as the input of the
parameter name has not been completed. (If input of the parameter name is complete, you
must also define the parameter type and data type. You can delete the complete defined
parameter again by pressing Ctrl-End).
Ret
The Return key terminates input of a parameter name.
Ins, PgDn
These keys accept the parameters in Menu 5 and advance you to Menu 6 "Define System
Interface".
a
a
aa
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
The interface options displayed depend on the PLC system set in Menu 1 and can vary.
Interpreter data: Select this item if you want to query the STEP 5 status bits for
binary and digital operations or the number of the current OB.
I/O address list...: Select this item if you require direct access to the I/O
(corresponds to L PY, T PY in STEP 5).
Process image...: Select this item if you want to access the process image of the
inputs, outputs, flags, timers and counters.
System stop from...: Select this item if you want to branch to the stop state from the
HLL block in the event of an error.
Extended I/O...: Select this item if you want to access the extended I/O (only on
systems with ACOP).
Semaphores: Select this item if you want to set and clear the disable
identifiers (corresponds to the commands SIM and LIM in STEP
5; only on systems with ACOP).
You will find more information on the individual items in the section entitled "Interfaces of the
HLL block".
,
Use these keys to move the line cursor. The current line of the table is displayed in inverse
format.
Ins
The Insert key accepts your settings. The block generator now creates (or replaces) the
declarations for the call parameters defined in Menu 5 and the system interface defined in
Menu 6. The generated declarations are entered in the HLL block by the block generator. Any
existing declarations for the block interface are replaced (please refer also to the section
entitled "Format of the Module Header").
Any changes to the library number and the block name that you have made in Menu 1 are now
activated.
Notes:
• Optimization level 0 should be set for testing the HLL block with the on-line or off-line
debugger. The tested block can subsequently be compiled with a higher optimization level.
• To ensure that the HLL block operates correctly if it has been compiled with a higher
optimization level, you should perform a test run with the optimized block.
• In addition to the default modules, you can link a further 5 object files or libraries to the
block. The number of individual object files or libraries is irrelevant, i.e. you can link 5
object files to the block.
• You can use standard intel libraries or your own libraries (created with intel-LIB86). Please
note that the functions used may not access the hardware or operating system.
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
SINUMERIK S5-HLL Block Generator Menu 3 Version 2.2
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
aaaaa a
aaaaa a
aaaaa
aaaaa a
a
aaaaa a
aaaaaa
aaaaa
aaa
PL/M Function Block: >PFX004< Name: >TOOLVERW<
Compile:
Optimization Level >0< for debugger
Link:
Block Link Modules: > AFX004.OBJ< Assembler Header
> PFX004.OBJ< PL/M Block Body
> . < Additional Object File
> . < Additional Object File
> . < Additional Object File
> DAT_COM2.LOC< System Addresses
> . < Additional Library
> . < Additional Library
> AFXEND.OBJ< Assembler Footer
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
aaaaaa
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
aaa
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
aaaaa
a
a
a
a
aaaaa
a
a
a
a
a
a
a
a
a
a
a
a
aaaaa
a
a
a
a
a
a
a
a
a
a
a
a
aaaaa
a
a
a
a
a
a
a
a
a
a
a
aaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
aaaaa
a
a
a
a
a
a
a
a
a
a
a
aaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
aa
a
aa
Continue Back
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
aa
a
aa
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
aa
a
a
a
a
a
aa
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Menu 3, Compile and Link HLL Blocks
F8 Back
You exit Menu 3, but the data you have entered are retained. The block is not compiled or
linked.
Blocks to be Transferred
a
a
a
aa
aa
a
aa
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
aa
aa
a
aa
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Blocks to be transferred
Enter the identifiers of the blocks you want to include in the S5-DOS block file in the fields in
the table.
The identifier for an HLL block is composed of 3 letters and a three-digit decimal number.
• The first letter indicates the language in which the block has been created.
P stands for PL/M
C stands for C
F1 Continue
The defined blocks are transferred to the S5-DOS block file. The S5-DOS block file is created
in the S5-DOS directory defined in Menu 1.1. All link files and program lists of the HLL blocks
transferred to the S5-DOS block file are also copied into this directory. No warning is given if
program lists or link files are missing.
Note:
Pressing F1 "Continue" always creates a new block file. If a file of the same name already
exists in the destination directory, it is overwritten without warning.
F8 Back
You exit Menu 4 but the data you have entered are retained.
, , Ins, Del, BS
These key functions are available for editing text in the input fields.
These interfaces presented by the block generator offer enormous scope. You should not
require all of the interface components provided.
The scope of the individual interfaces is defined interactively with the block generator. The
block generator uses the data you enter in Menus 5 and 6 (see the section entitled
"Operation") to generate the declarations for the interfaces required in the HLL block and
present the corresponding external references.
The block generator records the current scope of the block interfaces in the header of the HLL
source code file. It uses a special syntax based on STEP 5 for this purpose. This syntax is
described in the section entitled "Format of the Module Header". Unlike earlier versions of the
block generator, you do not have to use this syntax yourself in Version 2.1. Please note,
however, that the block generator deletes and overwrites certain areas in the source text of the
block when you make changes to the block interface.
All data are stored on the PLC in STEP 5 format. The STEP 5 format and the intel format used
with PL/M and C are not compatible.
In the case of data fields which are stored in a word, the low byte and high byte in the STEP 5
format are opposite to those in the intel data format. Similarly, the high word and low word in
doublewords are also exchanged.
Examples:
• The same word is saved at different memory locations
If you write the value 1234H into a data word in STEP 5, the high byte (which contains
12H) is stored in the byte at the lower address; the low byte (which contains 34H) is
stored at the next higher address.
Address Address+1
If you save the same value in the intel format used with PL/M and C, the higher-value byte
(which contains 12H) is stored in the higher address in the word, while the lower byte
(which contains 34H) is written to the lower address.
Address Address+1
The doubleword read access to this data array produces the value 0CDAB3412H in PL/M
and C (or 0xCDAB3412 in C notation).
The doubleword read access in STEP 5 returns the value 1234ABCDH.
a
a
a
a
aaaaaaaaaaaaaaaaaaaaaaaaaaa
a
a
a
a
a
aaaaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Caution:
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aaaaaaaaaaaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Please remember the different data formats
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
used in STEP 5 and PL/M and C when accessing data.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aaaaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
The PLC operating system can convert the call parameters of an HLL block to the intel data
format. The conversion must be requested explicitly (see the section entitled "Conversion of
Call Parameters").
In addition to the opposite representations used for the high and low byte, differences also
arise in the indexing of arrays. For example, the data word n in a STEP 5 data block is
interpreted by STEP 5 as consisting of the data bytes DL n and DR n. The data bytes in the
data word are thus addressed with the same index as the data word itself. PL/M and C,
however, interpret data word n as consisting of data bytes 2n and 2n + 1.
You will find further examples of the different data formats in the sections entitled
"Programming with PL/M", "Programming with C" and "Program Examples".
An HLL function block can have input parameters and output parameters. Parameters which
are both input and output parameters, i.e. variable parameters, are not possible. They can,
however, be simulated.
All parameters are passed via the stack (either the value or the address of the parameter).
The block generator distinguishes between the following types of call parameter:
Output parameters:
Bit Q BI Pointer plus mask byte
Byte Q BY Pointer
Word QW Pointer
Doubleword QD Pointer
Input parameters:
Bit I BI Data byte plus mask byte
Byte I BY Byte
Word IW Word
Doubleword ID Doubleword
Constants:
ASCII value D KS Word
Fixed-point number D KF Word, with leading sign
Floating-point number D KG Doubleword
Hexadecimal number D KH Word
Bit map D KM Word
Byte value D KY Word
Timer value D KT Word
Counter value D KC Word
Timer T Word
Counter C Word
In this overview, the parameter types constant, timer and counter are treated as special types
of input parameter for HLL blocks.
Notes:
• Call parameters are passed to HLL blocks via the stack; please therefore refer also to the
information on the stack loading in the section entitled "Information for the Use of the
Block Generator".
• Call parameters can be converted to the intel data format by the PLC operating system
(see next section).
• Two variants can be used for passing bit parameters (see next section).
Both format conversions must be requested explicitly in the STEP 5 program calling the HLL
block. This is performed by enabling operating system data bits (in the followin gabbreviated as
BS) BS 0.0 and BS 0.1.
System data BS 0 is valid for all levels. For example, if BS 0.0 is set to "1" in OB 1 (= format
conversion from intel data format to STEP 5 format) and OB 1 is then interrupted by a higher-
priority level (e.g. by a process interrupt), bit BS 0.0 is also set to "1" in OB 3 (which is now
active). If you do not want the format conversion in OB 3, the bit must be reset explicitly.
When you return to OB 1, the original value is reloaded in BS 0 (in this example BS 0.0 is set
to "1" again).
Examples with bit parameters are provided in the program examples and in the sections on
programming with PL/M and C.
Contained in the PLC operating system are special system functions which can be called from
HLL blocks. These system functions are used as a substitute for important STEP 5 commands
which are difficult to reproduce in a high-level language. They also enable other program
sections to be called from HLL blocks. The system function HLL_MACRO() can be used to
call up function macros of the PLC operating system.
5.4.1 Overview
The following system functions can currently be used in HLL blocks:
Name: Task:
HLL_ADB() Open data block
HLL_S5() Call STEP 5 blocks
HLL_MACRO() Call function macros
HLL_HLL() Call HLL blocks
HLL_LIM(), HLL_SIM() Disable/enable processing levels
HLL_STOP() Initiate PLC system stop from HLL block
The parentheses following the names of the system functions indicate that the system
functions have call parameters. System functions HLL_LIM() and HLL_SIM() are only
available on PLC systems with ACOP.
The system functions and their parameters are described in the following sections.
HLL_ADB() is used to open a data block. The data segment of the HLL block is set to the
data segment of the opened data block in order to associate the data block declared in the
data segment of the HLL block with the opened data block.
The assignment of the data block declared in the HLL block to the opened data block remains
active until a new data block is opened with HLL_ADB().
Each time HLL_ADB() is called, system data DB_Laenge passes the length of the opened
data block.
Example:
Open data block DB 100:
PL/M: call HLL_ADB ('DB', 100);
C: HLL_ADB ('DB', 100);
Example:
Call program block PB 255:
PL/M: call HLL_S5('PB',255);
C: HLL_S5('PB',255);
Function macros made available by the PLC operating system for use in application programs
can be called with system function HLL_MACRO(). The parameters for the function macro
are specified as call parameters of system function HLL_MACRO().
You will find examples of the HLL_MACRO() function in the sections entitled "Brief Examples
in PL/M" or "Brief Examples in C".
The following function macros can presently be called with system function HLL_MACRO():
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
Separate documentation is obtainable for the function macros:
"Function Macros" Configuring Guide
Examples for the use of function macros can be found in the sections for programming with
PL/M or C, and in the program examples.
System function HLL_HLL() can be used to call other HLL blocks from an HLL block.
Recursive calls of the same HLL block are not permitted.
Note:
String constants are not permitted as parameters when calling HLL_HLL() except to specify
the type of block called.
Example:
Call HLL block FB 123 with 2 parameters:
PL/M: call HLL_HLL (start, end, 'FB', 123);
C: HLL_HLL (start, end, 'FB', 123);
System functions HLL_LIM() and HLL_SIM() correspond to the STEP 5 commands LIM and
SIM; they are used to set and clear disable identifiers for the processing levels of the PLC
program. The disabling of processing levels is intended to protect program sections from
interruption by higher-level processing levels (e.g. timed interrupt processing).
The disable identifiers are stored in a byte. The disable identifier byte is read with the
HLL_LIM() function and written back with HLL_SIM(). The HLL program can change the
disable identifier between reading and writing the disable identifier byte.
Example:
Read disable identifiers:
PL/M: call HLL_LIM (@ dis_id_byte);
C: HLL_LIM (& dis_id_byte);
An enabled bit means that the processing level is disabled. A disabled bit means that the
processing level is enabled.
Notes:
• No processing level should be disabled for longer than absolutely necessary.
• When processing disable identifiers, only those identifiers should be modified which are
relevant for the protection of the program section. This applies both to setting and
resetting of disable identifiers.
• Several disable identifiers can be set or cleared simultaneously.
• If a request for the OB was saved when the disable identifier was reset, the previously
disabled processing level is processed before the HLL program is continued after the
disable identifiers are reset.
• The indication of lost requests in DB 1 may already have been changed by the previously
disabled processing level before the HLL program evaluates the data stored there.
• Flag FB 6.1 indicates whether a request for an OB has been lost (group identifier for all
OBs).
Example:
System stop with error number 1234:
PL/M: call HLL_STOP (1234);
C: HLL_STOP (1234);
5.5.1 Overview
The following list provides an overview of the available system data. The specified names are
reserved for the system interface to the PLC. They may not be used to declare other objects.
The HLL function blocks can presently access the following PLC system data:
Name: Task:
E_Byte Input area
A_Byte Output area
M_Byte Flag area
Zeit STEP 5 timers
Zaehler STEP 5 counters
QeA
QeE
5–12
5.5.2
FX_LST
FB_LST
SB_LST
PB_LST
DX_LST
DB_LST
OB_LST
Sp_Verw
Bin_DigA
Bin_ErgA
Dig_ErgA
XBINERG
XDIGERG
XDBLAEN
XDSPVER
GREBESP
PHENDEP
PHANFGP
GREBESD
PHENDED
PHANFGD
XAKOBNR
GREBEOP
GREBEOD
Akt_OB_Nr
DB_Laenge
5.5.1 Overview
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
a
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa
aa
a
5 Interfaces of the HLL Block
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaa
I/Q/F/C/T Areas
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
"
"
"
"
"
"
"
"
"
"
"
"
"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaa
List
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aaaa
aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
a
"
"
"
"
"
"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
with
aaaaaaa
"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
a
Status bits
aa
aa
aa
aa
aa
aa
aaa
Pointer to
"
"
"
"
"
"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
Active OB no.
"
aaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
a
" "
" "
aaaaaaaaa
" "
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaa
Length of opened DB
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa
aa
a
status bits
" "
" "
Pointer to active OB no.
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaa
block addresses
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaa
"
"
"
"
"
"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aaa
aaaaaaaaa
and
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaa
"
"
"
"
"
"
"
"
Pointer to length array DB_Laenge
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
Start address of user data memory
aaaaaaaa
"
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa a
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaa
Start address of user program memory
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
COP
aaaaaaaa
aaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa aa
aa
aa
aa
aa
aa
aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaa
6FC5197-0AC00-0BP0
SINUMERIK 840/880 Part 1 (PJ)
11.92
11.92 5 Interfaces of the HLL Block
5.5.2 I/Q/F/C/T Areas
E_Byte: IB 0
IB 1
IB 127
A_Byte: QB 0
QB 1
QB 127
E_Byte, A_Byte: Byte arrays of defined size; for a description, please refer to the
Configuring Guide "Interface Description Part 1, Signals".
M_Byte: FB 0
FB 1
FB 255
Timer T0
T1
T 127 (255)
Format of a timer:
Bit no. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aaaaaaa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
Timer value (0...999)
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
aa
a
a
a
a
a
a
aa
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
FMF: Edge flag for FT command
FMS: Edge flag for Sxt command
Time base: 00 =ˆ 0.01 seconds
01 =ˆ 0.1
10 =ˆ 1.0
11 =ˆ 10.0
ZKS: Additional identifier for status generation
0 = Timer not running
1 = Timer running
ZWG: Identifier for "timer valid"
Note:
FT command: Input a timer
SxT command: Start a timer
Timer: Array with timer data, one word long. The number of available timers
depends on the version of software on the PLC.
On PLC systems with ACOP, the timers cannot be started from HLL
blocks.
Counters
Counters: C0
C1
C 127 (255)
Format of a counter:
Bit no. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaa
0 Counter value (0...999)
Note:
FZ command: Enable counter
SZ command: Set counter
ZRZ command: Counter countdown
ZVZ command: Counter count up
Counter: Array with counter data one word in length. The number of available
counters depends on the version of software on the PLC.
On PLC systems with ACOP, the counters cannot be started from HLL
blocks.
The interpreter data comprise the status bits for binary and digital operations as well as the
active OB number.
OR
FC
RLO
Bit 7 ...... 2 1 0
XBINERG Bin_ErgA
OVER
OS
CC1
CC0
Bit 7 ... 3 2 1 0
XDIGERG Dig_ErgA
OS
OVER OR
CC0 FC
CC1 RLO
Bit 15 ... ... 8 7 6 5 4 3 2 1 0
XBINERG Bin_DigA
XAKOBNR Akt_OB_Nr
For data memory, the user can choose from data blocks of both types (DB and DX) up to a
length of 2043 words each. Data blocks are also used as an interface to the various
components of the numerical control and other PLC programs. The efficient processing of data
blocks is a key factor in HLL programming.
When data blocks are accessed from HLL blocks, the PLC operating system is not capable of
performing the usual STEP 5 checks for range violations. Particular care must therefore be
taken in the HLL program to ensure that data are not read or written beyond the boundaries of
the data block. Accesses to non-existent data blocks should also be avoided.
Each data block must be opened before the data are processed. System function HLL_ADB()
is provided for opening data blocks. Opening a data block has the effect of associating the
data block declared globally in the HLL block with the opened data block. Accesses to the DB
declared in the HLL block are then applied directly to the open DB.
Caution:
A DB must be opened before the first access to the DB declared in the HLL block. Data
blocks using offsets in OB 180 (addressing of data words greater than 255) must be opened
again, since the size of the offset is not detected by the PLC system.
XDBLAEN DB_Laenge
XDBLAEN: Pointer to a word in which the length of the opened data block is
given. XDBLAEN is returned by system function HLL_ADB().
DB_Laenge: DB_Laenge specifies the number of the last data word in the open
DB.
Note:
The reader is reminded that range checks should be included in the HLL block. It is the
responsibility of the programmer to ensure that the data block being processed actually exists
and that no accesses are made beyond the boundaries of the block.
Certain key memory management data are made available to the HLL program by the PLC.
The start and end addresses of the user program memory and the user data memory are
stored in a table (structure Sp_Verw) along with the start address of the remaining free
memory.
The start and end address parameters for memory management always refer to paragraph
boundaries. An offset therefore does not have to be specified for these addresses. The offset
must be added by the HLL program according to the method described below.
GREBESP
Boundary of the assigned user program
memory (segment, offset)
GREBEOP
GREBESD
Boundary of the assigned user data
memory (segment and offset)
GREBEOD
The boundary addresses of the assigned user program and user data memory each indicate
the address of the first free byte. The individual entries (PHANFGP, ...) are addressed via the
structure Sp_Verw.
Bit 19 4 3 0
a
a
a
a
a
a
a
a
aaaaa
a
Bit 19 4
GREBESP Absol. address of assigned user progr. memory
Bit 3 0
GREBEOP Residual offset
L
L
aaaaaaaaaaaaaaaaaa
H
H
11.92
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
5.5.6
aaaaaaaaaaaaaaaaaaaaaa
Notes:
aaa
aaaa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
FX_LST
FB_LST
PB_LST
SB_LST
DX_LST
DB_LST
OB_LST
aaaaaa aaaaaaaaaaaa
exist.
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaa
aa
aa
aa
a aaa
aa
aa
aa
aa
aa
aa
aa
aaaa
aaa
a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aaaa
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa a
aa
aa
aa
a
aa
a aaaa
COP
Offset
aa
aaa
aa
aa
aa
a aaa
aa
aa
aa
aa
aa
aa
aa
aa
aaa aaaa
aaaaaa aaaaaaaaaaaa aaaa
Segment
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aaa
aaaa
a
aaaaaa aaaaaaaaaaaa
length of a doubleword.
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaa aaaaaaaaaaaa
address is to be used.
aaaaaaaaaaaaaaaaaa
L
L
H
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaa
aaaaaa
7
6FC5197-0AC00-0BP0
aa
aaaaaaaaaaaaaaaaaaaaa
aa
a aaaaaaaaaaa aaaaaa aaaaa
aa
a
aaa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaa aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aaa
parameters in the block lists depends on the PLC system.
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaaa
aaa
a aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aaaa
aaa
a
aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa aaaaaa aaaaaa
X X X X
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa aaaaaa aaaaaaaaaa
STEP 5 blocks
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aaaaaaaaaaa aa
H Add. 4 MSB 0
aaaaaaaaaaa aaa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa aaaaaa aaaaaaaaaa
System identifiers
ACOP
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
0
aDistinction between
aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa aaaaaa aaaaaaaaaa
high-level language/
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aaaaa aaaaaaaaaa
Address 16 LSB
aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaaa
aaa
a aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aaa
aa
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a
5.5.6.1 Block Address Lists on PLC Systems with COP/ACOP
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a
aa
aaaaaaaaaaaaaaaaaaaaa
aa
a aaaaaa
aaaaaa aaaaaa aaaaa
aa
a
a
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
aaa
a
aa
aaa
aa
aa
aa aa
aaa
aa
aaa
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
On PLC systems with ACOP, bits 0...11 must be masked in the segment part if the
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaa
a
each of the blocks. The block number serves as an index in the table; each entry has the
All block address lists have 256 entries numbered from 0 to 255. The format of the address
The address parameters in the block address lists contain the start and jump addresses for
If an address entry has the value 0 (e.g. the 16 LSB and the 4 MSB), the block does not
5 Interfaces of the HLL Block
5–21
5.5.6 Block and I/O Address Lists
•
•
•
aaaaaaaaaaaaaaaaa
L
L
aaaaaaaaaaaaaaaaaa
H
H
PeA
PeE
QeA
QeE
aaaaaaaaaaaaaaaaaaaaaa
a
5–22
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
Notes:
aaa
aaaa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaa
aa
aa
aa
a aaa
aa
aa
aa
aa
aa
aa
aa
aaaa
aaa
a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
a aa
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
a a
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aa
aaa
aaaa
COP
Offset
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
a aa
Segment
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
a aa
a
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa a
aa
aa
aaa
aa
a
5 Interfaces of the HLL Block
aa
aaa
aa
aa
aa
a aaa
aa
aa
aa
aa
aa
aa
aa
aa
aaa
aaaaaa aaaaaaaaaaaa
0
a aaaaa
address is to be used.
aa
aa
aa
aa
aa
a aaa
aa
aa
aa
aa
aa
aaaaa
5.5.6 Block and I/O Address Lists
aaaaaa
a
Address list for inputs of I/O
The following I/O lists are provided:
a
aa
aa
aa
aa
aa
aaaaaaaaaaaaa
L
aaaaaaaaa
L
aaa
H
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaaa
aa
aa
aa
a
a aaaaaaaaaaaaaaaaaa
7
aa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aaa
aa
a aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aaaaa
aa aa
a aa
aaa
aaa
aaa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
a
access
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aaaaaaaaaaa aaaaaa a aaaa
aa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a
aa
a
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
a a
a
aa
a
aa
a
aa
a
aa
a
aa
a
a a
a
aa
a
aa
a
aa
a
aa
aaa
a
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
aaa
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
aa
aa
a
aaaa
H Add. 4 MSB 0
aa
aaaaaaaaaaaaaaaa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
aa
aa
a
aaaa
a
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
a
aa
aaa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
aa
aa
a
aaaa
ACOP
aa
a a aa
0
X
aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aaa aa
aaa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
aaaa
aa
aa
aa
aaaaaaaaaaaaaaaaa aaaaaaaaaaa aaaaaa a aaaaa
Identifier for byte or word
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
a
aaaaaaaaaaaaaaaaa aa
0
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a a
aa
aa
aa
aa
aa
a a
a a
aa
aa
aa
aa
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aa
aaa
aa
aaa
aa aa
a aa
aaaa
aaa
a
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
aa
a aaaaaa aaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa
a
On PLC systems with ACOP, bits 0...11 must be masked in the segment part if the
programs when changing to PLC systems with ACOP, allowance must be made for the
255); a distinction is made between inputs and outputs. The lists QeE and QeA are only
the PLC system. In order to avoid having to make changes to the source code of existing
STEP 5 programs. This is not the case on direct accesses made from HLL blocks. The
The process image for the addressed I/O is updated on direct accesses to the I/O from
If an address entry has the value 0 (e.g. the 16 LSB and the 4 MSB), the I/O byte is not
The format of the I/O address lists is, like the format of the block address lists, dependent on
The address lists consist of 256 address entries for I/O bytes PY 0 to PY 255 (or QY 0 to QY
6FC5197-0AC00-0BP0
SINUMERIK 840/880 Part 1 (PJ)
11.92
11.92 6 Format of the Module Header
6.1 Task of the Module Header
The module header contains the following information for the block generator:
• Block type and block number
• Block name and library number
• PLC system
• Names and types of call parameters for block
The parameters in the module header of the block can be edited by the user; in earlier
versions of the block generator this was the only way of modifying the block interface.
Notes:
• It is not necessary to modify the module header for blocks created with Version 2.2 of the
block generator.
• Errors can arise in certain cases where blocks created with earlier versions of the block
generator are processed by the new block generator. Always create a backup copy of the
block before it is processed. Please refer also to the notes in the section entitled
"Operation".
• You will find examples of module headers in the section entitled "Example Programs" and
in the descriptions of the module bodies for PL/M and C.
• The interface of the HLL block to the system data and the system functions cannot be
modified by editing the source program.
• The compiler statements entered in the module body by the block generator may not be
changed.
Example:
/* INP1: I BI */
• The declaration of parameter type and data type must use the following identifiers:
T for timer
C for counter
/* emil : I BI Parameter 1 */
/* q123 : T Time between a) event 1 and
b) event 2 */
/* a$a : C */
/* TYPE : FX */
/* Number : 234 */
/* Name : N@n0n@N */
/* e : I BI */
/* q123 : T Time between event 1 and event 2 */
/* a$a : Z */
/* emil_1 : I BI Parameter 1 */
/* q123 : T Time between a) event 1 and */
b) event 2 */
a$a : C */
/* e@aus : C */
/* kenn : Q Bit */
/* 1.par : D KS */
The block generator interprets the entries in the module body in the following operating
situations:
• When the block key data are entered in Menu 1 (block name, library number and PLC
system)
• When the block interface is modified in Menu 5 "Define/Change Call Parameters", the call
parameters in the module header are used to generate the block symbol. (When you exit
Menu 5, a new block header is written).
• Before the block is compiled, the block header is interpreted and new declarations are
generated for the call parameters.
• Before the program editor is called from the block generator, new declarations are
generated for the call parameters on the basis of the parameters in the module header.
This chapter describes the language-specific features of HLL block generation with the PL/M-
86 programming language.
• The PL/M module body and its declarations are language-specific; the PL/M module body
is created by the block generator as a starting basis for your PL/M block.
• The option of performing a parameter check when calling other HLL blocks is only
available for PL/M.
• The "Example Programs" section contains a collection of small program excerpts.
• Notes are provided for the use of upper and lower case letters in PL/M blocks.
• The PL/M identifiers reserved by the block generator are listed.
You will find further information for the generation of HLL blocks in Chapter 5. This chapter
contains special information which is not dependent on the programming language used.
The block generator creates a module body when generating a new PL/M function block. This
module is the starting basis for your PL/M block.
The components of the module body are described below. This description is followed by a
listing of a PL/M module body containing declarations of all PLC system data and functions
and all parameter data types. The listing is based on a PL/M block intended for use on a PLC
system with ACOP. Fewer system data and functions can be used on PLC systems with COP;
certain other deviations also arise in the format of the status bits (see the section entitled
"System Data").
The PL/M module body consists of the following components:
Module header
The block generator stores the block data in comment lines in the module header (see the
section entitled "Format of the Module Header").
Compiler statements
The compiler statements define the memory model required by the PL/M function block for
operation on the PLC 135 WB. A subsystem is also specified that contains the components of
the interface to the PLC system data and functions. FAR references are generated to these
system interface components; NEAR references are used within the PL/M block.
Literally declarations
The literallies for the parameter types BIT, CHAR and MASK are declared here. User literallies
can also be declared here.
:
Declarations
:
These comments are an essential part of the module body and may not be deleted or
modified.
When changes are made to the block interfaces, the block generator deletes the entire area
between the two comments and generates a new one. If you have made changes in this area,
the changes are deleted.
Constants
This component is used for the declaration of constants.
Parameter declaration
The parameters of the parameter list are declared here. For output parameters, the appropriate
"BASED" declaration for the passed pointer is included here for the parameter used in the
program. The masks for bit parameters are also included at this point.
Local data
You can declare local data for your PL/M block after the declarations generated by the block
generator for the call parameters. Please remember that local data are not retentive, i.e. the
content of local data is undefined every time the block is called. Data which are to retain their
value across multiple block calls (retentive data) must be stored in data blocks.
Headings are inserted in the following listing for the purposes of clarity. The headings are not a
component of the PL/M module body.
/* Type : FB */
/* Number : 000 */
/* Name : TOOLVERW */
/* Lib.number : 9135 */
/* IBI : I BI */
/* IBY : I BY */
/* IW : I W */
/* ID : I D */
/* DKH : D KH */
/* DKM : D KM */
/* DKF : D KF */
/* DKY : D KY */
/* DKS : D KS */
/* DKC : D KC */
/* DKT : D KT */
/* DKG : D KG */
/* T : T */
/* C : C */
/* QBI : Q BI */
/* QBY : Q BY */
/* QW : Q W */
/* QD : Q D */
$COMPACT ROM
$eject
PFB000: DO;
/***************************/
/* Literallies */
/***************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
END function;
END PFB000;
If required, the block generator can check whether the call parameters passed by the PL/M
block when calling other PL/M blocks formally match the call parameters of the called block.
During the parameter check, the block generator calculates the number, sequence and type of
call parameters passed from the PL/M block to system function HLL_HLL(). The block
generator compares these values with the comments stored in the module header of the called
PL/M block which describe the input and output parameters.
Only the PL/M data types of the PL/M variables or constants specified in the HLL_HLL() call
are compared. If the called block is a C block, it is not possible to perform a parameter check.
During the parameter check, the block generator expands any existing literallies and
incorporates include files.
When passing constants in the HLL_HLL() call, the block generator makes allowance for the
fact that PL/M passes them as bytes, words or doublewords, according to their size, if no
explicit type conversion functions (LOW, HIGH, INT, etc.) are used.
String constants are illegal when calling HLL_HLL(), except to specify the type of block called.
The parameter check can only be performed on single variables. In other words, the
HLL_HLL() call may not contain expressions or other function calls (even literallies). The only
exceptions to this rule are the following built-in functions:
DOUBLE, LOW, HIGH, ROL, ROR, SHL, SHR, SAL, SAR, BUILD$PTR, OFFSET$OF, SIZE,
LAST, LENGTH, SIGNED, UNSIGN, INT, IBS
Any expressions, including function calls, can be entered at index positions (array index) or
after the address operator. The type of array elements or (in the case of an address operator)
a pointer is returned as the variable type.
***********************************************************
* *
* SINUMERIK Block Generator S5-PL/M Version 2.2 Date 10.08.91 *
* Directory of all blocks called from: FB 8 Page 1 *
* *
***********************************************************
Block Called in
Type Number Name File name Line Parameters
FB 2 I/Q/F PFB008.PLM 99 NR : D KF
NR1 : I BY
With conversion of the input bit parameter (operating system data BS 0.1 = 1), the query is as
follows, for example:
:
if (INP1 = 1) then
:
else
:
Here, all numeric values (such as DW number 250) are passed as bytes; the high byte of the
parameter is undefined. In certain circumstances, this can lead to error messages in FB 61.
The FB 61 call should therefore be programmed as follows:
DECLARE NSBY WORD DATA (1);
DECLARE ANZ WORD DATA (1);
DECLARE DTY1 WORD DATA ('RP');
DECLARE DTY2 WORD DATA ('NC');
DECLARE DTY3 WORD DATA (' ');
DECLARE WER1 WORD DATA (1);
DECLARE WER2 WORD DATA (50);
DECLARE WER3 WORD DATA (0);
DECLARE ZFPN WORD DATA ('F0');
DECLARE DBZI WORD DATA (200);
DECLARE DWZI WORD DATA (250);
DECLARE TYZI WORD DATA ('DB');
CALL HLL_MACRO ( TYZI, DWZI, DBZI, ZFPN, WER3, WER2, WER1, DTY3, DTY2, DTY1, ANZ, NSBY,
SHR (M_BYTE (200), 5), 61);
:
if (error_flag = 1) then
do:
call HLL_STOP (FEHL_COD_A):
:
No distinction is made in PL/M between upper and lower case letters. There are two
exceptions, however. The block generator or PLC system expects the pseudoparameters 'DB'
and 'DX' when a data block is opened, and 'FB' or 'FX' when an HLL block is called in upper
case letters.
In addition to the PL/M identifiers listed below, which are reserved either for the block
generator or PL/M itself, the names of PLC system data and functions may not be used in user
declarations. The identifiers reserved by the system data and system functions are described
in the sections entitled "Overview of System Data" and "Overview of System Functions".
Please consult the compiler manual for information about identifiers reserved for the compiler.
8 Programming with C
This chapter describes the language-specific features of HLL block generation with the C
programming language.
• The C module body and its declarations are language-specific; the C module body is
created by the block generator as a starting basis for your C block.
• In contrast to PL/M, the option of performing a parameter check when calling other HLL
blocks is not provided.
• The "Programming Examples" section contains a collection of small program excerpts.
• The chapter shows how various type of data blocks can be accessed from C blocks.
• A description is given of how C macros can be used to access data in STEP 5 format.
• Notes are provided for the use of upper and lower case letters in C blocks.
• The C identifiers reserved by the block generator are listed.
You will find further information for the generation of HLL blocks in Chapter 5. This chapter
contains special information which is not dependent on the programming language used.
The block generator creates a C module body when generating a new C function block. This
module is the starting basis for your C block.
The components of the module body are described below. This description is followed by a
listing of a C module body containing declarations of all PLC system data and functions and all
parameter data types. The listing is based on a C block intended for use on a PLC system
with ACOP. Fewer system data and functions can be used on PLC systems with COP; certain
other deviations also arise in the format of the status bits (see the section entitled "System
Data").
The C module body consists of the following components:
Module header
The block generator stores the block data in comment lines in the module header (see the
section entitled "Format of the Module Header").
:
Declarations
:
These comments are an essential part of the module body and may not be deleted or
modified.
When changes are made to the block interfaces, the block generator deletes the entire area
between the two comments and generates a new one. If you have made changes in this area,
the changes are deleted.
Parameter declaration
The parameters of the parameter list are declared here. The pointers for output parameters are
also declared here.
The masks for bit parameters are also included at this point.
Local data
You can declare local data for your C block after the declarations generated by the block
generator for the call parameters. Please remember that local data are not retentive, i.e. the
content of local data is undefined every time the block is called. Data which are to retain their
value across multiple block calls (retentive data) must be stored in data blocks.
Headings are inserted in the following listing for the purposes of clarity. The headings are not a
component of the C module body.
/* Type : FX */
/* Number : 000 */
/* Name : TOOLVERW */
/* Lib.number : 9136 */
/* IBI : I BI */
/* IBY : I BY */
/* IW : I W */
/* ID : I D */
/* DKH : D KH */
/* DKM : D KM */
/* DKF : D KF */
/* DKY : D KY */
/* DKS : D KS */
/* DKC : D KC */
/* DKT : D KT */
/* DKG : D KG */
/* T : T */
/* C : C */
/* QBI : Q BI */
/* QBY : Q BY */
/* QW : Q W */
/* QD : Q D */
/******************************/
/* Typedef and Constants */
/******************************/
/*************************/
/* System Functions */
/* and */
/* System Data */
/*************************/
extern far void HLL_ADB (unsigned short int, unsigned short int);
/* Interpreter data */
FUNCTION (IBI,
IBI_MSK,
IBY,
IW,
ID,
DKH,
DKM,
DKF,
DKY,
DKS,
DKC,
DKT,
DKG,
T,
C,
QBI_ADR,
QBI_MSK,
QBY_ADR,
QW_ADR,
QD_ADR)
bit IBI;
mask IBI_MSK;
byte IBY;
word IW;
dword ID;
word DKH;
word DKM;
word DKF;
word DKY;
word DKS;
word DKC;
word DKT;
dword DKG;
word T;
word C;
bit * QBI_ADR;
mask QBI_MSK;
byte * QBY_ADR;
word * QW_ADR;
dword * QD_ADR;
/*************************/
/* Declaration of */
/* Local Data */
/*************************/
/*************************/
/* Statement Part */
/* Main Procedure */
/*************************/
STEP 5 C
IW 5 =ˆ IB5 IB6 IW[5] =ˆ IB[10] IB[11]
ID 5 =ˆ IB5 IB6 ID[5] =ˆ IB[20] IB[21]
IB7 IB8 IB[22] IB[23]
(with corresponding C declaration of IW as an input word and IB as an input byte)
Example 4: Constant as word parameter for function macros
Constants used as call parameters for function macros must always be passed as a word
parameter. Constants are always passed as word parameters in C programs and therefore
problems do not arise in this case. Two methods for calling function macros are shown below.
HLL_MACRO ( TYZI, DWZI, DBZI, ZFPN, WER3, WER2, WER1, DTY3, DTY2,
DTY1, ANZ, NSBY, (M_Byte[200] >> 5), 61);
The names of the STEP 5 application interface enhance the legibility of the program.
:
if (error_flag == 1)
{
HLL_STOP (FEHL_COD_A);
:
}
:
struct {
unsigned int tool_no;
unsigned int tool_tech;
unsigned char tool_name[10];
unsigned int tool_station;
} dat_str[140]; /* Declare global array */
/* with 140 structure elements */
} dat_blk;
:
:
HLL_ADB('DX', 200); /* Open DX 200 */
for (i=0; i<50; i++)
dat_blk.dat_str[i].wz_tech = i; /* Process DX 200 */
:
:
HLL_ADB('DB', 100); /* Open DB 100 */
for (i=0; i<50; i++)
dat_blk[i] = 0xff00; /* Process DB 100 */
:
Notes:
• The user program is responsible for checking the processed data blocks.
• When HL_ADB() is called, the number of the last data word of the opened DB is entered
in system data DB_Laenge. This system cell can be addressed for checking purposes.
• When processing data blocks via pointers, the length can be read from the block header.
• The "access data blocks via pointer" example can only be used in this form for PLC
systems with COP. Bits 0...11 of the segment part of the address must be masked on PLC
systems with ACOP.
default do double
else enum extern
9 Example Programs
This chapter contains examples of function blocks programmed in the high-level languages
PL/M and C. These examples illustrate the use of the system interfaces, but are not intended
for user programs.
/* Type : FB */
/* Number : 001 */
/* Name : DBZUGR */
/* Lib.number : 12345 */
$LARGE (SUBS has DAT_COM; EXPORTS DB_LST, SB_LST, PB_LST, FB_LST, OB_LST, DX_LST,
$ FX_LST, HLL_ADB, XDBLAEN, E_Byte, A_Byte, M_Byte, Zeit, Zaehler)
$COMPACT ROM
$eject
PFB001: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/***********************************************************/
/* Definition of an array for addressing */
/* in in data blocks (max. size: 2043 words); */
/* refers to the currently open DB */
/***********************************************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE (DBNR,
DNR,
DTYP,
INHA,
ERR_ADR,
ERR_MSK) PUBLIC REENTRANT;
/**************************/
/* Declaration */
/* of Local Data */
/**************************/
/***************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/****************************************************/
/* Examples for accessing data block */
/****************************************************/
end;
else do;
/* Set error bit if DTYP not DB or DX */
/* or DB, DX do not exist */
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB001;
/* Type : FB */
/* Number : 002 */
/* Name : EAM */
/* Lib.number : 34343 */
$LARGE (SUBS has DAT_COM; EXPORTS E_Byte, A_Byte, M_Byte, Zeit, Zaehler)
$COMPACT ROM
$eject
PFB002: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE (NR,
NR1) PUBLIC REENTRANT;
DCL NR WORD,
NR1 BYTE;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/*************************************************/
/* Examples of accesses to process image */
/*************************************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB002;
/* Type : FB */
/* Number : 004 */
/* Name : TZMB */
/* Lib.number : 12349 */
$LARGE (SUBS has DAT_COM; EXPORTS E_Byte, A_Byte, M_Byte, Zeit, Zaehler)
$COMPACT ROM
$eject
PFB004: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE (TNR,
ZNR,
MWT,
MWZ) PUBLIC REENTRANT;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
dcl flagword (128) word at(@M_Byte(0)); /* Flag word structure for wordwise */
/* access */
dcl aux_var word; /* Auxiliary variable */
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
if (aux_var = 0) then
do;
A_Byte(0) = (A_Byte(0) and 0feh); /* If time expired, */
/* set Q0.0 = 0 */
end;
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB004;
/* Type : FB */
/* Number : 006 */
/* Name : SUCH */
/* Lib.number : 23456 */
$LARGE ( SUBS has DAT_COM; EXPORTS DB_LST, SB_LST, PB_LST, FB_LST, OB_LST, DX_LST,
$ FX_LST, HLL_ADB, XDBLAEN)
$COMPACT ROM
$eject
PFB006: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE (DBNR,
MUST,
GEF_ADR,
ERR_ADR,
ERR_MSK) PUBLIC REENTRANT;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
if DB_LST(dbnr) = 0 then
do;
err = err or err_msk; /* DB does not exist, set error bit */
end;
else do;
end;
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB006;
/* Type : FB */
/* Number : 008 */
/* Name : PLM-PLM */
/* Lib.number : 32189 */
$LARGE (SUBS has DAT_COM; EXPORTS HLL_HLL, E_Byte, A_Byte, M_Byte, Zeit, Zaehler)
$COMPACT ROM
$eject
PFB008: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE (AUS,
NN,
BYTN,
BITN,
WER1) PUBLIC REENTRANT;
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
/**************************/
/* Local */
/* Functions */
/**************************/
if value = 1 then
A_Byte(abnr) = (A_Byte(abnr) OR SHL(1h, bitnr));
else
A_Byte(abnr) = (A_Byte(abnr) AND ROL(0FEH, bitnr));
end BITMAN;
END PFB008;
/* Type : FB */
/* Number : 010 */
/* Name : SPERR0B5 */
/* Lib.number : 09131 */
$COMPACT ROM
$eject
PFB010: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE PUBLIC REENTRANT;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
disable_id = disable_id or
disable_mask_OB5; /* Set disable identifier for OB 5 */
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB010;
/* Type : FB */
/* Number : 015 */
/* Name : FREIGOB5 */
/* Lib.number : 01936 */
$COMPACT ROM
$eject
PFB015: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE PUBLIC REENTRANT;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB015;
/* Type : FB */
/* Number : 020 */
/* Name : PERI */
/* Lib.number : 20005 */
$LARGE ( SUBS has DAT_COM; EXPORTS DB_LST, SB_LST, PB_LST, FB_LST, OB_LST, DX_LST,
$ FX_LST, HLL_ADB, XDBLAEN, PeE, PeA, E_Byte, A_Byte, M_Byte, Zeit, Zaehler)
$COMPACT ROM
$eject
PFB020: DO;
/**************************/
/* Literallies */
/**************************/
$EJECT
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
/**************************/
/* Constants */
/**************************/
function:
PROCEDURE (STRT,
END) PUBLIC REENTRANT;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
dcl n byte;
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
do n = strt to end;
ptr_adr_inp = buildptr(base_inp,
offset_inp); /* Create pointer */
/* to real address */
/* of the nth input byte */
ptr_adr_out = buildptr(base_out,
offset_out); /* Create pointer */
/* to real address */
/* of the nth output byte */
end;
/**************************/
/* End of */
/* Main Procedure */
/**************************/
END function;
END PFB020;
9.2 Examples in C
9.2.1 FX 1, Access to Data Blocks
/* Type : FX */
/* Number : 001 */
/* Name : DBZUGR */
/* Lib.number : 3491 */
/**************************/
/* Typedef and constants */
/**************************/
extern far void HLL_ADB (unsigned short int, unsigned short int);
/***********************************************************/
/* Definition of an array for addressing */
/* in data blocks (max. size: 2043 words); */
/* refers to the currently open DB */
/***********************************************************/
/**************************/
/* Constants */
/**************************/
#define not_exist 0l
FUNCTION (DBNR,
DNR,
DTYP,
INHA,
ERR_ADR,
ERR_MSK)
word DBNR;
byte DNR;
word DTYP;
byte INHA;
bit * ERR_ADR;
mask ERR_MSK;
{
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/****************************************************/
/* Examples for accessing data block */
/****************************************************/
else
*ERR_ADR ¦= ERR_MSK;
/**************************/
/* End of */
/* Main Procedure */
/**************************/
/* Type : FX */
/* Number : 002 */
/* Name : EAM */
/* Lib.number : 73737 */
/**************************/
/* Typedef and constants */
/**************************/
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION (NR,
NR1)
word NR;
byte NR1;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
int *Inputword;
int *Flagword;
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/* Initialize pointers */
/*************************************************/
/* Examples of accesses to process image */
/*************************************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
/* Type : FX */
/* Number : 004 */
/* Name : TZMB */
/* Lib.number : 85344 */
/**************************/
/* Typedef and constants */
/**************************/
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION (TNR,
ZNR,
MWT,
MWZ)
word TNR;
word ZNR;
word MWT;
word MWZ;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
word aux_var;
word far *flagword; /* Pointer for word access */
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
if (aux_var == 0)
A_Byte[0] &= 0xFE; /* If time expired, */
/* set Q0.0 = 0 */
/**************************/
/* End of */
/* Main Procedure */
/**************************/
/* Type : FX */
/* Number : 006 */
/* Name : SUCH */
/* Lib.number : 23456 */
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION (DBNR,
MUST,
GEF_ADR,
ERR_ADR,
ERR_MSK)
word DBNR;
word MUST;
word * GEF_ADR;
bit * ERR_ADR;
mask ERR_MSK;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
word max_limit; /* Number of last word in DB */
word position; /* Index for search in DB */
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
if (DB_LST[DBNR] == 0)
{
*ERR_ADR ¦= ERR_MSK; /* DB does not exist; set error bit */
}
else
{
*ERR_ADR &= ~ERR_MSK; /* DB exists; clear error bit */
/**************************/
/* End of */
/* Main Procedure */
/**************************/
/* Type : FX */
/* Number : 008 */
/* Name : CC */
/* Lib.number : 32189 */
/**************************/
/* Typedef and Constants */
/**************************/
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION (AUS,
NN,
BYTN,
BITN,
WER1)
byte AUS;
word NN;
word BYTN;
word BITN;
word WER1;
{
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
}
/**************************/
/* Local */
/* Procedures */
/**************************/
void BITMAN(sword abnr, sword bitnr, sword value) /* Standard ANSI declaration */
{
if (value == 1)
else
trickvariable._16_BIT = (word)num;
return(trickvariable._8_BIT[0] ¦ trickvariable._8_BIT[1]);
/* Type : FX */
/* Number : 010 */
/* Name : SPERROB5 */
/* Lib.number : 0911 */
/**************************/
/* Typedef and Constants */
/**************************/
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION ( )
{
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
/* Type : FX */
/* Number : 015 */
/* Name : FREIGOB5 */
/* Lib.number : 0912 */
/**************************/
/* Typedef and Constants */
/**************************/
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION ( )
{
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/**************************/
/* End of */
/* Main Procedure */
/**************************/
/* Type : FX */
/* Number : 020 */
/* Name : PERI */
/* Lib.number : 20005 */
/**************************/
/* Typedef and Constants */
/**************************/
/**************************/
/* System Functions */
/* and */
/* System Data */
/**************************/
FUNCTION (STRT,
END)
word STRT;
word END;
/**************************/
/* Declaration of */
/* Local Data */
/**************************/
/**************************/
/* Statement Part */
/* Main Procedure */
/**************************/
/* Pointer initialization */
}; /* End of for-loop */
/**************************/
/* End of */
/* Main Procedure */
/**************************/
It is therefore recommended
• not to modify the defined system variables, but to process them in read-only accesses to
the largest possible extent
• to call system programs in the described form only
• always to make sure that the destination address (the address of the pointer) is correct in
indirect data accesses or program branches (which use pointers)
• to remember that cross-segment program branches (FAR CALL) may not be performed,
and
• to remember that HLL blocks always run in special mode, irrespective of the setting in the
machine data.
_______
1) GA2, SW 1 and higher (SINUMERIK 880) or SW 2 and higher (SINUMERIK 840)
If non-existent blocks are called up with the functions HLL_HLL and HLL_MACRO, the PLC
always switches to the stop state with an error message. In this case, the program cannot
continue because of the unknown number of passed parameters; OB 19 is not called.
For further information, please refer to the "PLC 135 WB Configuring Guide".
Memory requirements
A large number of tables of the block generator must be processed in the main memory of the
development computer. For this reason, the available memory should be as large as possible.
If the free memory is not sufficient, part of the tables have to be stored on the hard disk. This
reduces the processing speed considerably (especially with large programs).
At least 1 MB free memory must be available on the hard disk for the output files and stored
data.
The following restrictions should be observed when implementing PL/M and C blocks.
Stack requirements
The stack area available to HLL blocks is limited to:
• 2 K words on the cyclic level
• 0.5 K words on the further processing levels
As the user, you must ensure that the stack requirements of your HLL block do not exceed
this limit. If a stack overflow does occur, the PLC branches to a defined stop state, however
the cause of the error cannot be detected or displayed.
Following compilation, you can calculate the stack requirements of an HLL block from the
program listing, according to the following factors:
• All variables declared in the "Declaration of Local Data" section are stored on the stack.
Larger data arrays should therefore be stored in data blocks.
• In system calls, the call parameters are passed to the stack. This also applies to
parameters passed to other blocks (HLL_HLL(), HLL_MACRO()).
Procedures
• Local procedures in PL/M blocks must be declared with the attribute REENTRANT,
otherwise processing errors may occur.
• Procedures in C blocks are always reentrant; the attribute does not have to be specified.
• The implementation of interrupt procedures is not permitted.
• With the exception of system functions, no external procedures may be called; i.e. "FAR
CALLS" are not permitted.
Data declarations
• The declarations created by the block generator may not be modified.
• The declaration of global data in a HLL data block is only allowed for components which
refer to data blocks. This also applies to the declaration of "static" data in C blocks.
Recursion
Recursive calls are not permitted in HLL blocks.
Memory model
HLL blocks may only be compiled in the compact model.
Libraries
You link standard intel libraries or your own libraries (created with intel LIB86) to your HLL
block. Please remember, however, that the functions used may not access the hardware or
the operating system.
Block size
The block generator restricts HLL blocks to a code size of 8 Kbytes.
Further restrictions must be observed for the implementation of C blocks, in addition to the
restrictions described above.
Parameter check
It is not possible to perform a parameter check for C blocks on the block generator.
Definitions ("#define")
"#define" statements may not exceed 255 characters in length. This applies especially to the
definition of macros.
Line length
A line in the source program of a C block may not exceed 255 characters in length.
Both the block generator and the generated block output error messages. The block generator
also issues warnings.
Warning 66, "START ADDRESS NOT SPECIFIED IN OUTPUT MODULE", always appears
when a block is being prepared and does not inhibit correct operation.