s71500 Odk1500s Manual en-UbbbS en-US
s71500 Odk1500s Manual en-UbbbS en-US
0 ___________________
Preface
___________________
Documentation guide 1
SIMATIC
___________________
Product overview 2
___________________
Installation 3
STEP 7 (TIA Portal) Options
Open Development Kit 1500S V2.0 Developing ODK application
___________________
for the Windows environment 4
___________________
Developing ODK application
for the realtime environment 5
Programming and Operating Manual
___________________
Using example projects 6
___________________
Appendix A
09/2016
A5E35253941-AC
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Notes
Please also observe notes labeled as follows:
Note
A note contains important information on the product described in the documentation, on the
handling of the product or on the section of the documentation to which particular attention
should be paid.
Security information
Siemens provides products and solutions with industrial security functions that support the
secure operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is
necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial
security concept. Siemens’ products and solutions only form one element of such a concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines
and networks. Systems, machines and components should only be connected to the
enterprise network or the internet if and to the extent necessary and with appropriate security
measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
(http://www.siemens.com/industrialsecurity).
Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and to
always use the latest product versions. Use of product versions that are no longer supported,
and failure to apply latest updates may increase customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS
Feed under (http://www.siemens.com/industrialsecurity).
Industry Mall
The Industry Mall is the catalog and order system of Siemens AG for automation and drive
solutions on the basis of Totally Integrated Automation (TIA) and Totally Integrated Power
(TIP).
Catalogs for all the products in automation and drives are available on the Internet
(https://mall.industry.siemens.com).
Preface ................................................................................................................................................... 3
1 Documentation guide .............................................................................................................................. 8
2 Product overview .................................................................................................................................... 9
2.1 Introduction to ODK 1500S ...................................................................................................... 9
2.2 Development environments ................................................................................................... 11
2.3 Basic procedure ..................................................................................................................... 12
3 Installation ............................................................................................................................................ 14
3.1 System Requirements ............................................................................................................ 14
3.2 Installing ODK ........................................................................................................................ 15
3.3 Integrating ODK templates in Visual Studio after installation ................................................ 16
3.4 Uninstalling ODK .................................................................................................................... 16
4 Developing ODK application for the Windows environment ................................................................... 17
4.1 Creating an ODK application ................................................................................................. 17
4.1.1 Requirements ......................................................................................................................... 17
4.1.2 Creating a project ................................................................................................................... 17
4.1.2.1 Creating an ODK project with Visual Studio version older than 2015 ................................... 19
4.1.3 Generating an ODK application ............................................................................................. 20
4.1.4 Defining runtime properties of an ODK application................................................................ 21
4.1.5 Environment for loading or running the ODK application ...................................................... 22
4.1.6 Defining functions and structures of an ODK application ...................................................... 23
4.1.6.1 Use of ODK_CLASSIC_DB as parameter ............................................................................. 26
4.1.6.2 Handling strings ..................................................................................................................... 27
4.1.6.3 Definition of the <Project>.odk file ......................................................................................... 28
4.1.6.4 Modifying the <Project>.odk file ............................................................................................. 29
4.1.6.5 Comments .............................................................................................................................. 29
4.1.7 Implementing functions .......................................................................................................... 31
4.1.7.1 General notes......................................................................................................................... 31
4.1.7.2 Callback functions .................................................................................................................. 32
4.1.7.3 Implementing custom functions ............................................................................................. 33
4.2 Transferring an ODK application to the target system ........................................................... 35
4.3 Importing and generating an SCL file in STEP 7 ................................................................... 36
4.4 Executing a function ............................................................................................................... 37
4.4.1 Loading functions ................................................................................................................... 37
4.4.2 Calling functions ..................................................................................................................... 41
4.4.3 Unloading functions ............................................................................................................... 43
4.5 Remote debugging ................................................................................................................. 46
4.5.1 Performing remote debugging ............................................................................................... 47
Overview
ODK is a development kit that allows you to program custom functions and generate files
that STEP 7 can call directly.
ODK provides an interface for:
● Windows environment
– Execution on your Windows PC
– Use of resources of your Windows PC
– Use of operating system functions and system resources with access to external
hardware and software components
● Realtime environment
– Execution on your CPU
– Synchronous function call (algorithmic, controllers)
Calling multiple applications under Windows or in the realtime environment is possible.
The ODK applications must be used in the STEP 7 program .
The program that runs outside of the CPU is created with Microsoft Visual Studio or Eclipse
and is generated as a DLL or SO file. ODK applications can run both under Windows (DLL)
and in the realtime core of the CPU (SO). You call the functions of the DLL or SO file using
instructions in the user program.
The CPU can perform functions in libraries that can be loaded dynamically. There are
several possible functions in an ODK application. There are specific function blocks for an
ODK Application:
● Loading and unloading of the ODK application
● One function block each for calling a certain function
The following illustration provides a schematic overview of how ODK applications run on a
PC. This graphic applies to the S7-1500 Software Controller.
The following illustration provides a schematic overview of how ODK applications run on a
hardware CPU.
Result
Your ODK application is downloaded to the target system and is loaded and executed by the
user program in STEP 7.
Requirements
Your PC must meet the following system requirements in order to use the ODK:
Category Requirements
Operating system • Microsoft Windows 7, 64-bit
• Microsoft Windows 8, 64-bit
• Microsoft Windows 10, 64-bit
Processor and memory PC system:
• At least systems with Intel Core i5 processor
• 1.2 GHz or higher
• At least 4 GB of RAM
Mass storage 1.6 GB of free space on the hard disk C:\ for the full installation.
Note: The setup files are deleted when the installation is complete.
Operator interface Color monitor, keyboard and mouse or another pointing device (optional) supported by
Microsoft Windows
SIMATIC software • SIMATIC STEP 7 Professional (TIA Portal) V14 or higher
Supported PLCs All SIMATIC CPUs supporting ODK (see next table)
Additional software Not included in the product package:
• Java Runtime 32-bit as V1.6 (for Eclipse)
• Microsoft Visual Studio C++ 2010 SP1
• Microsoft Visual Studio C++ 2012
• Microsoft Visual Studio C++ 2013
• Microsoft Visual Studio express C++ 2013
• Microsoft Visual Studio C++ 2015
• Microsoft Visual Studio express C++ 2015
Microsoft Development Tool: Download Center (http://www.microsoft.com/en-
us/download/developer-tools.aspx)
ODK 1500S V2.0 is compatible with the following devices (support of loadable function
libraries is device-dependent):
DLL SO
(Windows) (Real-time)
CPU 1505SP (F) V2.0 Yes Yes
CPU 1507S (F) V2.0 Yes Yes
CPU 1518-4 PN/DP ODK (F) V2.0 No Yes
Requirements
You need administrator rights for this procedure.
It is possible to operate different ODK versions on one PC at the same time. If the ODK
version to be installed is already installed on the PC, you must first uninstall it or perform a
repair installation.
Note
Close applications before a repair installation/uninstall
Close all applications (especially ODK-related applications), before performing the repair
installation/uninstall.
Procedure
If you want to use the Microsoft Visual Studio development environment, we recommend that
you install this before ODK.
To install ODK, follow these steps:
1. Start the "Start.exe" file from the Installation DVD manually with a double-click.
2. Follow the instructions of the installation wizard.
Result
The installation is complete. All product languages are installed by default during the
installation process. The installation creates a shortcut in the Start menu of Windows.
The setup program installs the following components:
● "Eclipse" for the development of ODK applications for the realtime environment
● ODK templates for Visual Studio
● Code generator
● Online help
Result
The ODK template for Visual Studio is installed. You can find this under the corresponding
programming language.
Procedure
To remove ODK from your PC, follow these steps:
1. Close all running programs, especially ODK-related applications.
2. Select the menu "Control Panel > Programs and Features", select the entry "SIMATIC
ODK 1500S" and click "Uninstall".
3. Select the "Uninstall" command in the shortcut menu.
A dialog box for uninstalling appears.
4. Follow the steps for uninstalling.
Result
ODK is removed.
4.1.1 Requirements
The Microsoft Visual Studio development environment is not included in the scope of
delivery of ODK.
You can find the Download Center for Microsoft development tools in the Internet
(http://www.microsoft.com/en-us/download/developer-tools.aspx).
Procedure
To create an ODK project in Microsoft Visual Studio using the ODK template, follow these
steps:
1. Open Microsoft Visual Studio as a development environment.
2. In the "File > New" menu, select the command "Project..."
The "New Project" dialog opens.
3. Select your preferred programming language and the corresponding ODK template.
4. Enter a project name.
5. Click "OK" to confirm.
Result
The ODK project is created using the ODK templates and sets the following project settings:
● Project settings for generating the DLL file
● Automates the generation of the DLL and SCL file
The ODK template sets up the following file structure as standard:
Configuration and platform Visual Studio Version older than 2015 Visual Studio 2015
Debug Win32 Yes Yes
Release Win32 Yes Yes
Debug x64 to be manually created (Page 19) Yes
Release x64 to be manually created (Page 19) Yes
4.1.2.1 Creating an ODK project with Visual Studio version older than 2015
Procedure
To create an ODK template for a x64 platform with a Visual Studio version older than 2015,
follow these steps:
1. Open the "Configuration Manager".
4. Under "Active solution configuration, select "Debug" or "Release" and under "Platform",
select "x64".
Procedure
To generate the project data, follow these steps:
1. Save all edited files.
2. In the "Build" menu, select the command "Build Solution".
Note
The project data is only generated if the files have been changed.
Result
The generation of the project data is started. The automatically generated files are stored in
the file system.
● DLL file: Project directory\<Project>\<BuildConfiguration>\<Project>.dll
● SCL file: Project directory\<Project>\STEP7\<Project>.scl
Procedure
To define the interface description in the <Project>.odk file, follow these steps:
1. Open the <Project>.odk file.
2. Change the elements depending on your requirements.
Comments
You can use comments for explanation purposes.
Parameters
The definition of the parameters must be within a line of code.
<parameter name>=<value> // optional comment
The interfaces file supports the following parameters:
Note
Spaces in the project name
Spaces in the STEP 7 prefix are replaced by an underscore.
"System" context
To use the ODK application in the system context (Session 0), change the following code
line in the <Project>.odk file:
Context=system
In the system context, the ODK application is running without the logon of a Windows user.
This means the ODK application cannot be actively controlled with user interface elements
such as message dialogs.
"User" context
To use the ODK application in the user context, change the following code line in the
<Project>.odk file:
Context=user
When you load the ODK application in the user context, it automatically unloads as soon as
the user logs off in Windows. The ODK application can be actively controlled by Windows
user interface elements such as message dialogs and provides access to additional
resources of the Windows environment.
If multiple users are logged on to Windows, the ODK application loads or unloads for the
user, who has the current screen rights until he logs off in Windows.
Functions
Functions are defined by the following general lines of code:
ODK_RESULT <FunctionName>
([<InOut identifier>] <data type> <tag name>, etc.);
The <Project>.odk file contains an example function description by default. You can change
this description and/or add more function descriptions.
ODK_RESULT MyFunc1([IN] INT param1, [OUT] INT param2);
<FunctionName>
Function names are valid with the syntax and character restrictions of the used programming
language.
<InOut-Identifier>
There are three defined InOut-Identifiers. Use these in the following order: [IN], [OUT],
[INOUT]
● [IN]: Defines an input tag. The tag is copied to the function when it is called. This is
constant and cannot be changed.
● [OUT]: Defines an output tag. The tag is copied back after the function has been
completed.
● [INOUT]: Defines an input and output tag. The tag is copied to the function when it is
called. This is not constant and can be changed. The tag is copied back after the function
has been completed.
<DataType>
The data type defines the type of a tag. The following tables define the possible data types
and their method of representation in C++ or STEP 7:
● Elementary data types:
<DataType> <TagName>;
...
};
<StructName>
Structure names apply with the syntax and character restrictions of the programming
language and as defined for tag definitions in STEP 7.
In STEP 7, the structure name is extended by the STEP 7 prefix.
<TagName>
Tag names are subject to the syntax and character restrictions of the programming
language.
Example
The following code example explains the definitions of functions and structures. Sort the
parameters by: IN, OUT, INOUT.
//INTERFACE
…
ODK_STRUCT MyStruct
{
ODK_DWORD myDword;
ODK_S7STRING myString;
};
ODK_RESULT MyFct([IN] MyStruct myInStruct
,[OUT] MyStruct myOutStruct);
Example
// INTERFACE
...
// OK:
ODK_RESULT MyFunc1([IN] ODK_CLASSIC_DB myDB);
ODK_RESULT MyFunc2([IN] ODK_CLASSIC_DB myDB1, [INOUT] ODK_CLASSIC_DB
myDB2);
//
// NOT OK (Code Generator will throw an error):
// ODK_CLASSIC_DB not permitted for [OUT]
ODK_RESULT MyFunc3([OUT] ODK_CLASSIC_DB myDB);
// if ODK_CLASSIC_DB is used for [IN], no other [IN] parameter may
be
// defined in this function
ODK_RESULT MyFunc4([IN] ODK_CLASSIC_DB myDB, [IN] ODK_INT32 myint);
myReader.ReadS7DINT(0, myInt1);
myReader.ReadS7DINT(4, myInt2);
Example
//INTERFACE
…
ODK_RESULT MyFct(
[IN] ODK_S7STRING myStrHas254Chars
, [OUT] ODK_S7STRING[10] myStrHas10Chars
, [INOUT] ODK_S7STRING[20] myStrArrayHas20Chars5Times[5]);
If you use [INOUT], you can set the string with a length that differs from the [INOUT of the
function block in STEP 7.
Example
//INTERFACE
Context=user
STEP7Prefix=ODK_App
/*
* Elementary data types:
* ODK_DOUBLE LREAL 64-bit floating point, IEEE 754
* ODK_FLOAT REAL 32-bit floating point, IEEE 754
* ODK_INT64 LINT 64-bit signed integer
* ODK_INT32 DINT 32-bit signed integer
* ODK_INT16 INT 16-bit signed integer
* ODK_INT8 SINT 8-bit signed integer
* ODK_UINT64 ULINT 64-bit unsigned integer
* ODK_UINT32 UDINT 32-bit unsigned integer
* ODK_UINT16 UINT 16-bit unsigned integer
* ODK_UINT8 USINT 8-bit unsigned integer
* ODK_LWORD LWORD 64-bit bit string
* ODK_DWORD DWORD 32-bit bit string
* ODK_WORD WORD 16-bit bit string
* ODK_BYTE BYTE 8-bit bit string
* ODK_BOOL BOOL 1-bit bit string
* ODK_LTIME LTIME 64-bit duration in nanoseconds
* ODK_TIME TIME 32-bit duration in milliseconds
* ODK_LDT LDT 64 bit date and time of day
* in nanoseconds
* ODK_LTOD LTOD 64 bit time of day in nanoseconds
* since midnight
4.1.6.5 Comments
Comments are started with a double slash "//" and end automatically at the end of the line.
Alternatively, you can limit comments by /* <comment> */, which enables new lines in a
comment. Characters after the end of the comment identifier "*/" are further processed by
the code generator.
Example
// this comment did not appear in MyStruct, because of the empty
line.
// comment MyStruct
// ...
ODK_STRUCT MyStruct
{
ODK_DWORD myDword;
ODK_S7STRING myString;
};
/*
comment MyFct
...
*/
ODK_RESULT MyFct([IN] MyStruct myInStruct
,[OUT] MyStruct myOutStruct);
Example
ODK_STRUCT MyStruct
{
// comment myDword BEFORE definition
ODK_DWORD myDword;
Current operating state New operating state User action ODK action
RUN RUN ODK_Load 1. OnLoad()
2. OnRun()
STOP RUN ODK_Load in 1. OnLoad()
startup OB (e.g. 2. OnRun()
OB100)
RUN STOP <already loaded> OnStop()
STOP RUN <already loaded> OnRun()
RUN RUN ODK_Unload 1. OnStop()
2. OnUnload()
RUN SHUTDOWN / MRES <already loaded> OnStop()
any any <already loaded> 1. OnStop() (optional, if
Exit ODK host not already execut-
ed)
2. OnUnload()
Procedure
To edit the ODK application functions, follow these steps:
1. Execute the build in order to update the header file <ODK_Functions.h>.
2. Open the <Project>.cpp file or create your own source file if required.
3. Transfer the function prototypes from <ODK_Functions.h> to the source file.
Note
To skip step 3 in the future when function parameters are changed, use the define of the
function prototype.
ODK application
The CCP file contains an schematically represented function description by default. You can
change this description with corresponding changes in the <Project>.odk file and/or add
more function descriptions.
#include "ODK_Functions.h"
Note
ODK application in the debug configuration
When the ODK application has been transferred to the debug configuration, you also need to
transfer the debug DLLs of the development environment to the target system.
Note
Administrator rights
To access this folder, you need administrator rights. This prevents the import of ODK
applications by unauthorized persons.
Please note:
The setup of the SIMATIC S7-1500 Software Controller checks whether the file path already
exists and the required administrator rights are assigned.
If not, the directory is renamed to "ODK1500S_OLD1" or "ODK1500S_OLD2" and a new
directory with the correct access rights is created.
The Windows file system can hide the folder based on your setting. You can view the folder
using the Windows option "Show hidden files, folders, and drives" in the Explorer menu
"Organize > Folder and search options > View".
The registry key for 32-bit systems is:
HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\Automation\ODK1500S\odk_app_path
The registry key for 64-bit systems is:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Siemens\Automation\ODK1500S\od
k_app_path
You can change the default value of the registry key and thus adapt to the expected location
for the DLL file to suit your needs.
Note
Changing the path in the registry key
To protect the DLL file, select a storage location that is secured by access protection.
Requirements
The project data were generated.
Procedure
To import and compile the SCL file, follow these steps:
1. Start STEP 7.
2. Open your project.
3. Select the project view.
4. Select the CPU in the project tree.
5. Select the "External Sources" subfolder.
The "Open" dialog box opens.
6. Navigate in the file system to the SCL file that was created during the generation of the
project data.
7. Confirm your selection with "Open".
The SCL file is imported. After completion of the import process, the SCL file is displayed
in the "External Sources" folder.
8. You need to compile the SCL file before you can use the blocks in your project.
9. To do this, select the SCL file in "External sources" subfolder.
10.Select the "Generate blocks from source" command in the shortcut menu.
Result
STEP 7 creates the S7 blocks based on the selected SCL file.
The created blocks are now automatically displayed in the "Program blocks" folder below the
selected CPU in the project tree. You can load the function blocks during the next download
to the target device.
Introduction
Regardless of the context in which the ODK application is running, the loading procedure
consists of the following steps:
● Call the "<STEP7Prefix>_Load" instruction in the STEP 7 user program.
● In the Windows context, the loading process checks if a 32-bit or 64-bit process is
required and starts the appropriate host. Each ODK application runs in its own Windows
process (ODK_Host).
● The host loads the ODK application and calls the "OnLoad()" function and then the
"OnRun()" functions.
Note
Loading the same ODK applications with a modified <Project>.odk file
When you load an ODK application and subsequently change the <Project>.odk file, we
recommend that you unload your ODK application first before you load the newly generated
ODK application. If the "<STEP7Prefix>_Unload" instruction is not executed, both ODK
applications are in the memory. This can lead to insufficient memory being available for the
CPU.
"<STEP7Prefix>_Load" instruction
An ODK application is loaded by calling the "<STEP7Prefix>_Load" instruction in the STEP 7
user program.
<STEP7Prefix>_Load
REQ DONE
BUSY
ERROR
STATUS
Input parameters
A edge transition (0 to 1) at the "REQ" input parameter starts the function.
Output parameters
The following table shows the information that is returned after loading.
Example
This example describes how the loading and running of a Windows ODK application can be
configured in order to start Windows again after communication disturbances.
When Windows is available again, the ODK application is loaded and the functions can be
executed again.
A communication disturbance can be caused by the following:
● Windows Restart (or Shut down)
● Windows Log off (if application in user area)
● TerminateProcess/ODK_Host crash
A flag is necessary for this (here: ODK_Loaded), which is set after successful loading and is
reset following a faulty execution of the ODK function.
FUNCTION_BLOCK "ODK_AutoLoad"
{ S7_Optimized_Access := 'TRUE' }
VERSION: 0.1
VAR
ODK_Loaded : Bool;
END_VAL
BEGIN
Introduction
Once the ODK application is loaded, you can execute C functions via your STEP 7 user
program. This call is made from the corresponding "<STEP7Prefix>SampleFunction"
instruction.
You can load up to 32 ODK applications at one time.
"<STEP7Prefix>SampleFunction" instruction
An ODK application is called by the "<STEP7Prefix>SampleFunction" instruction.
<STEP7Prefix>SampleFunction
REQ DONE
myInt BUSY
myReal ERROR
STATUS
myBool
Input parameters
A edge transition (0 to 1) at the "REQ" input parameter starts the function.
Output parameters
The following table shows the information for the output parameters returned after execution.
Introduction
The ODK application is unloaded be calling the "<STEP7Prefix>_Unload" instruction. Call is
made from the STEP 7 user program.
In addition to this call, the ODK application is also automatically unloaded for the following
reasons.
● The CPU is switched off
● The CPU is reset
● Windows is restarted
● Logoff off the Windows user (in the context of a Windows user)
Regardless of the context in which the ODK application is running, the unloading procedure
consists of the following steps:
● Call the "<STEP7Prefix>_Unload" instruction in the STEP 7 user program.
● From now on, no new executes can be carried out for these ODK application. Still active
executes are terminated at the CPU end. Windows terminates the execution of the
function normally ("Unload" waits). No return value is sent to the CPU.
● The host calls the "OnStop()" and "OnUnload()" functions.
● The ODK application is unloaded.
"<STEP7Prefix>_Unload" instruction
An ODK application is unloaded by calling the "<STEP7Prefix>_Unload" instruction in the
STEP 7 user program.
<STEP7Prefix>_Unload
REQ DONE
BUSY
ERROR
STATUS
Input parameters
A edge transition (0 to 1) at the "REQ" input parameter starts the function.
Installed Visual Studio version Link to the Download Center for the remote debugger
Microsoft Visual Studio 2010 Microsoft Visual Studio 2010 Remote Debugger
(https://www.microsoft.com/en-
us/download/details.aspx?id=475)
Microsoft Visual Studio 2012 Microsoft Visual Studio 2012 Remote Debugger
(https://www.microsoft.com/en-
us/download/details.aspx?id=38184)
Microsoft Visual Studio 2013 Microsoft Visual Studio 2013 Remote Debugger
(https://www.microsoft.com/en-
us/download/details.aspx?id=44918)
Microsoft Visual Studio 2015 Microsoft Visual Studio 2014 Remote Debugger
(https://www.microsoft.com/en-
us/download/details.aspx?id=48155)
After downloading, you can install the remote debugger on the target system.
Procedure
1. Start the Visual Studio remote debugger on the target system using "Start > All Programs
> Visual Studio 20xx > Remote Debugger".
2. Configure the authentication.
Select the "No authentication" option and select the "Allow any user to debug" check box.
Observe the security information.
3. Copy the Visual Studio C++ debug DLLs from the "<InstallationPath
VS>\VC\redist\Debug_NonRedist\<ApplicationType>\Microsoft.<VS version>.DebugCRT"
folder to the destination folder.
– Destination folder with 32-bit Windows and a 32-bit application:
<windows install path>\System32
– Destination folder with 64-bit Windows and a 64-bit application:
<windows install path>\System32
– Destination folder with 64-bit Windows and a 32-bit application:
<windows install path>\SysWOW64
Note
If you are using Visual Studio 2015, you also need the "ucrtbased.dll".
If this DLL is not present in the target system, copy it from the host in the folder:
With 32-bit Windows under Program Files\...
With 64-bit Windows under Program Files (x86)\...
...\Microsoft SDKs\Windows
Kits\10\ExtensionSDKs\Microsoft.UniversalCRT.Debug\<Highest available version>\
Redist\Debug\<Application type (32/64-bit)>
Note
If the ODK application is loaded, unload (Page 43) it before copying.
Debugging OnLoad/OnRun
To attach the debugger to the OnLoad() or OnRun() function, incorporate a wait loop at the
start of OnLoad().
Example of a wait loop:
EXPORT_API ODK_RESULT OnLoad (void)
{
#if defined _DEBUG // available in debug configuration, only
while (!IsDebuggerPresent()) // wait for debugger
{
Sleep(100);
}
#endif
// your code for OnLoad() ...
Result
The debugger stops the execution of the code after the activated breakpoint.
5.1.1 Requirements
● ODK is installed. The Eclipse development environment is installed.
● You need administrator rights to create and edit an ODK project.
Note
If you have to move the workspace to a different storage location, make sure you copy the
entire workspace.
Procedure
To create an ODK project in Eclipse using an ODK template, follow these steps:
1. Start Eclipse as a development environment.
2. In the "File > New" menu, select the command "Project..."
The "New Project" dialog opens.
3. Select your preferred programming language and the corresponding ODK template.
Result
The ODK project is created using the ODK templates and sets the following project settings:
● Project settings for generating the SO file
● Automates the generation of the SO and SCL file
Note
Spaces in the project name
All spaces in the project name are automatically replaced by an underscore.
In the example, "My first project" becomes "My_first_project".
Procedure
To generate the project data, follow these steps:
1. Save all edited files.
2. In the "Build" menu, select the command "Build Project".
Note
The project data is only generated if the files have been changed.
Result
The generation of the project data is started. The automatically generated files are stored in
the file system.
● SO file: Project directory\<Project>\<BuildConfiguration>\<Project>.so
● SCL file: Project directory\<Project>\STEP7\<Project>.scl
Procedure
To define the interface description in the <Project>.odk file, follow these steps:
1. Open the <Project>.odk file.
2. Change the elements depending on your requirements.
Comments
You can use comments for explanation purposes.
Parameters
The definition of the parameters must be within a line of code.
<parameter name>=<value> // optional comment
The interfaces file supports the following parameters:
Realtime environment
Add the following line of code in your <Projekt>.odk file to use the ODK application in the
context of the realtime environment:
Context=realtime
In this context, the ODK application is running in the realtime environment instead of a host
process at the Windows end. Because the ODK application is loaded synchronously, it
should be loaded in a startup OB (e.g. OB 100).
The number of loadable ODK applications (Page 89) is limited in the context of the realtime
environment.
Functions
Functions are defined by the following general lines of code:
ODK_RESULT <FunctionName>
([<InOut identifier>] <data type> <tag name>, etc.);
The <Project>.odk file contains an example function description by default. You can change
this description and/or add more function descriptions.
ODK_RESULT MyFunc1([IN] INT param1, [OUT] INT param2);
<FunctionName>
Function names are valid with the syntax and character restrictions of the used programming
language.
<InOut-Identifier>
There are three defined InOut-Identifiers. Use these in the following order: [IN], [OUT],
[INOUT]
● [IN]: Defines an input tag. The tag is copied to the function when it is called. This is
constant and cannot be changed.
● [OUT]: Defines an output tag. The tag is copied back after the function has been
completed.
● [INOUT]: Defines an input and output tag. The tag is copied to the function when it is
called. This is not constant and can be changed. The tag is copied back after the function
has been completed.
<DataType>
The data type defines the type of a tag. The following tables define the possible data types
and their method of representation in C++ or STEP 7:
● Elementary data types:
<DataType> <TagName>;
...
};
<StructName>
Structure names apply with the syntax and character restrictions of the programming
language and as defined for tag definitions in STEP 7.
In STEP 7, the structure name is extended by the STEP 7 prefix.
<TagName>
Tag names are subject to the syntax and character restrictions of the programming
language.
Example
The following code example explains the definitions of functions and structures. Sort the
parameters by: IN, OUT, INOUT.
//INTERFACE
…
ODK_STRUCT MyStruct
{
ODK_DWORD myDword;
ODK_S7STRING myString;
};
ODK_RESULT MyFct([IN] MyStruct myInStruct
,[OUT] MyStruct myOutStruct);
See also
Reading the trace buffer (Page 81)
Helper functions (Page 96)
Example
// INTERFACE
...
// OK:
ODK_RESULT MyFunc1([IN] ODK_CLASSIC_DB myDB);
ODK_RESULT MyFunc2([IN] ODK_CLASSIC_DB myDB1, [INOUT] ODK_CLASSIC_DB
myDB2);
//
// NOT OK (Code Generator will throw an error):
// ODK_CLASSIC_DB not permitted for [OUT]
ODK_RESULT MyFunc3([OUT] ODK_CLASSIC_DB myDB);
// if ODK_CLASSIC_DB is used for [IN], no other [IN] parameter may
be
// defined in this function
ODK_RESULT MyFunc4([IN] ODK_CLASSIC_DB myDB, [IN] ODK_INT32 myint);
myReader.ReadS7DINT(0, myInt1);
myReader.ReadS7DINT(4, myInt2);
Example
//INTERFACE
…
ODK_RESULT MyFct(
[IN] ODK_S7STRING myStrHas254Chars
, [OUT] ODK_S7STRING[10] myStrHas10Chars
, [INOUT] ODK_S7STRING[20] myStrArrayHas20Chars5Times[5]);
If you use [INOUT], you can set the string with a length that differs from the [INOUT of the
function block in STEP 7.
Example
//INTERFACE
Context=realtime
Trace=on
HeapSize=4k
HeapMaxBlockSize=1024
STEP7Prefix=ODK_App
/*
* Elementary data types:
*
* ODK_DOUBLE LREAL 64-bit floating point, IEEE 754
* ODK_FLOAT REAL 32-bit floating point, IEEE 754
* ODK_INT64 LINT 64-bit signed integer
* ODK_INT32 DINT 32-bit signed integer
* ODK_INT16 INT 16-bit signed integer
* ODK_INT8 SINT 8-bit signed integer
* ODK_UINT64 ULINT 64-bit unsigned integer
* ODK_UINT32 UDINT 32-bit unsigned integer
* ODK_UINT16 UINT 16-bit unsigned integer
* ODK_UINT8 USINT 8-bit unsigned integer
* ODK_LWORD LWORD 64-bit bit string
* ODK_DWORD DWORD 32-bit bit string
* ODK_WORD WORD 16-bit bit string
* ODK_BYTE BYTE 8-bit bit string
* ODK_BOOL BOOL 1-bit bit string
* ODK_LTIME LTIME 64-bit duration in nanoseconds
* ODK_TIME TIME 32-bit duration in milliseconds
* ODK_LDT LDT 64 bit date and time of day
* in nanoseconds
* ODK_LTOD LTOD 64 bit time of day in nanoseconds
since midnight
* ODK_TOD TOD 32 bit time of day in milliseconds
since midnight
* ODK_DTL DTL structure for date and time
* ODK_CHAR CHAR 8 bit character
* ODK_S7STRING STRING character string with 8-bit characters
* ODK_CLASSIC_DB VARIANT classic DB (global or based on UDT)
* [] ARRAY field of this datatype
* User Defined Datatype:
* ODK_STRUCT UDT user defined structure
* Return data type:
* ODK_RESULT 0x0000 - 0x6FFF function succeeded
* (ODK_SUCCESS = 0x0000)
* 0xF000 - 0xFFFF function failed
* (ODK_USER_ERROR_BASE = 0xF000)
*/
5.1.6.6 Comments
Comments are started with a double slash "//" and end automatically at the end of the line.
Alternatively, you can limit comments by /* <comment> */, which enables new lines in a
comment. Characters after the end of the comment identifier "*/" are further processed by
the code generator.
Example
// this comment did not appear in MyStruct, because of the empty
line.
// comment MyStruct
// ...
ODK_STRUCT MyStruct
{
ODK_DWORD myDword;
ODK_S7STRING myString;
};
/*
comment MyFct
...
*/
ODK_RESULT MyFct([IN] MyStruct myInStruct
,[OUT] MyStruct myOutStruct);
Example
ODK_STRUCT MyStruct
{
// comment myDword BEFORE definition
ODK_DWORD myDword;
Procedure
To edit the ODK application functions, follow these steps:
1. Execute the build in order to update the header file <ODK_Functions.h>.
2. Open the <Project>.cpp file or create your own source file if required.
3. Transfer the function prototypes from <ODK_Functions.h> to the source file.
Note
To skip step 3 in the future when function parameters are changed, use the define of the
function prototype.
ODK application
The CCP file contains an schematically represented function description by default. You can
change this description with corresponding changes in the <Project>.odk file and/or add
more function descriptions.
#include "ODK_Functions.h"
Introduction
ODK objects work with a dynamic memory management (heap). The following instructions
and functionalities are supported by using the dynamic memory management:
● The instructions newdelete or mallocfree
● STL (StandardTemplateLibrary)
● Software exceptions
The default setting for the heap size is 4 KB. The heap size can be from 4 KB up to the
available memory of the CPU (Page 89). You change the heap size in the <Project>.odk file
using the following parameters:
● HeapSize
● HeapMaxBlockSize
Special features
Because the used memory area (heap) has been optimized with regard to realtime and
cyclic processing, it has some special features:
● Blocks can only be allocated up to a specified size during the compiling time of the ODK
object.
Note
You can specify the maximum block size with the HeapMaxBlockSize parameter in
<Project>.odk. However, this has an effect on the global memory use for ODK
applications, because the management information of the following memories is required
in addition to the actual heap:
size_heap_admin_data = HeapMaxBlockSize * 3
Example: Therefore, with a maximum block size of 100 KB, this project needs 300 KB of
global data in addition to the heap. This data is used for heap administration.
You can find additional information under Environment for loading or running the ODK
application (Page 54).
● Blocks can initially be requested in any size. When the blocks are released again, they
are entered in free lists. There is a free list in each case for all possible block sizes (up to
HeapMaxBlockSize) so that later allocations can be performed in constant time.
There is, however, no merging of neighboring released blocks to form a larger block.
This means continuously recurring requests can be met faster than constantly different
requests.
Example: The user allocates only blocks with 8 bytes until the heap is full. The user then
releases everything again so that the heap is completely empty. An allocation of a block
with 16 bytes is then no longer possible, however, because all free blocks are entered in
the free list for 8 bytes and merging is not possible.
Example
#include <assert.h>
#include <exception>
#include <vector>
…
// check parameter
assert (NULL != myPointer);
Requirements
You need an Internet connection for this procedure.
You need administrator rights for this procedure.
Basic procedure
To perform the test, proceed as follows:
1. Open your project in Eclipse.
2. Change the debug environment to "Windows". To do this, select the "debug (win32)"
option in menu "Project > Build Configurations > Set Active".
3. Create the project as debug version. To do so, select the "Build Project" command in the
"Project " menu.
4. If you debug the project for the first time, you must now set the debug configuration.
Otherwise, continue with step 8.
Result
Eclipse suggests a change in the debug perspective.
The test code is executed. The test code for the test is complied only in the debug
environment and is implemented in the "main()" function. This function is located in the
<project>.cpp file.
The "main()" function offers you the following possibilities:
● Test data are provided and results can be reviewed.
● You can monitor tags of the function.
● You can use breakpoints to check the execution.
Test code
The following sample code shows the default contents of the "main()" function.
/*
* main() is defined for windows debugging, only.
* Therefore all automatically invoked functions
* (OnLoad, OnRun, OnStop, OnUnload) have to be called manually.
*/
#ifdef _DEBUG
int main (int argc, char* argv[])
{
ODK_RESULT ret = ODK_SUCCESS;
ret = OnLoad();
// error handling
ret = OnRun();
// error handling
ret = OnStop();
// error handling
ret = OnUnload();
// error handling
return ret;
}
#endif // _DEBUG
Procedure
Manually transfer the SO file to the target system. Use the file explorer of the web server of
the CPU for transferring the ODK application.
To transfer an SO file, follow these steps:
1. Enable the Web server in your STEP 7 project.
2. Open the web server of the CPU in the browser.
3. Open the "Filebrowser" menu.
4. Open the following directory as the storage location for the ODK applications:
\ODK1500S\
Figure 5-3 Transferring the SO file via the file explorer from the web server of the CPU
Result
The SO file is transferred to the load memory of the CPU.
After a successful transfer, the SO file is loaded by calling the "<STEP7Prefix>_Load"
instruction.
Requirements
The project data were generated.
Procedure
To import and compile the SCL file, follow these steps:
1. Start STEP 7.
2. Open your project.
3. Select the project view.
4. Select the CPU in the project tree.
5. Select the "External Sources" subfolder.
The "Open" dialog box opens.
6. Navigate in the file system to the SCL file that was created during generation of the
project data or copy the storage location from the properties of the SCL file to Eclipse.
7. Confirm your selection with "Open".
The SCL file is imported. After completion of the import process, the SCL file is displayed
in the "External Sources" folder.
8. Compile the SCL file before you use the blocks in your project.
9. To do this, select the SCL file in "External sources" subfolder.
10.Select the "Generate blocks from source" command in the shortcut menu.
Result
STEP 7 creates the S7 blocks based on the selected SCL file.
The "GetTrace" function block, which makes it possible to read the trace buffer, is created by
default.
The created blocks are now automatically displayed in the "Program blocks" folder below the
selected CPU in the project tree. You can load the function blocks during the next download
to the target device.
Introduction
Regardless of the context in which the ODK application is running, the loading procedure
consists of the following steps:
● Call the "<STEP7Prefix>_Load" instruction in the STEP 7 user program.
● The loading process takes place synchronously
● As soon as the "<STEP7Prefix>_Load" instruction returns after the first call, the ODK
application is loaded.
Note
Loading the same ODK applications with a modified <Project>.odk file
When you load an ODK application and subsequently change the <Project>.odk file, we
recommend that you unload your ODK application first before you load the newly generated
ODK application. If the "<STEP7Prefix>_Unload" instruction is not executed, both ODK
applications are in the memory. This can lead to insufficient memory being available for the
CPU.
"<STEP7Prefix>_Load" instruction
An ODK application is loaded by calling the "<STEP7Prefix>_Load" instruction in the STEP 7
user program.
<STEP7Prefix>_Load
REQ DONE
BUSY
ERROR
STATUS
Input parameters
A edge transition (0 to 1) at the "REQ" input parameter starts the function.
Output parameters
The following table shows the information that is returned after loading.
Introduction
Once the ODK application is loaded, you can execute C functions via your STEP 7 user
program. This call is made from the corresponding "<STEP7Prefix>SampleFunction"
instruction.
The execution of synchronous ODK functions can be interrupted by higher priority OBs
running in the same CPU:
● Call another ODK function
● Call the same function ODK
Therefore, pay attention when creating your ODK application on implementing the
function calls re-entrant or avoid parallel execution.
Implement a maximum of three parallel calls. If you implement more than three parallel calls,
the ODK function returns following status: 0x80C3
"<STEP7Prefix>SampleFunction" instruction
An ODK application is called by the "<STEP7Prefix>SampleFunction" instruction.
<STEP7Prefix>SampleFunction
myInt STATUS
myReal myBool
Output parameters
The "<STEP7Prefix>SampleFunction" instruction only has the "STATUS" output parameter.
The following table shows the information for the output parameter returned after execution.
STATUS Meaning
0x0000 – Function has been executed and returns a value between 0x0000 and 0x6FFF.
0x6FFF (ODK_SUCCESS = 0x0000)
=0 – 28671
0x80A4 ODK application could not be executed for the following reasons:
=-32604 • A stack overflow was detected after execution of the function. To prevent follow-on errors, unload
the ODK application. The developer of the ODK application is responsible for preventing the stack
overflow.
• The "<STEP7Prefix>_Unload" instruction was executed during a function execution. The execution
of the function was interrupted and terminated immediately. No return value is sent to the CPU.
Wait until the "<STEP7Prefix>_Unload" instruction has ended. Then load the ODK application again.
0x80C3 ODK application could not be run. The CPU currently does not have enough memory.
=-32573 Pay attention to the maximum number of parallel calls (SyncCallParallelCount).
0x8090 ODK application could not be run. An exception occurred during execution.
=-32624 Each unhandled exception reduces the available heap size. An unhandled exception can damage the
ODK application in such a way that it can no longer be used for additional calls. The ODK application
must be unloaded. The developer of the ODK application is responsible for handling the exception and
returning an application-specific error value.
0x8091 ODK application could not be run. A "STOP" occurred during the function call.
=-32623
0x8096 ODK application could not be executed because the ODK application was not loaded or unloading is not
=-32618 yet finished.
0x8098 ODK application could not be executed because the ODK application is different than the ODK instruc-
=-32616 tions (FBs) in STEP 7:
• older
• newer
• different parameters
STATUS Meaning
0x8099 ODK application could not be executed because the maximum amount of input data (32 KB) was ex-
=-32615 ceeded (declarations with "In" and "InOut")
0x809A ODK application could not be executed because the maximum amount of output data (32 KB) was ex-
=-32614 ceeded (declarations with "Out" and "InOut")
0x809B The function returns an invalid value (a value between 0x0000 and 0x6FFF; 0xF000 and 0xFFFF is
=-32613 permitted)
0xF000 – CPU 1500 V2.0 and later:
0xFFFF The function could not be executed and returns a value between 0xF000 and 0xFFFF.
=-4096 – -1 (ODK_USER_ERROR_BASE = 0xF000)
Introduction
The ODK application is unloaded be calling the "<STEP7Prefix>_Unload" instruction. Call is
made from the STEP 7 user program.
In addition to this call, the ODK application is also automatically unloaded for the following
reasons.
● The CPU is switched off
● The CPU is reset
Regardless of the context in which the ODK application is running, the unloading procedure
consists of the following steps:
● Call the "<STEP7Prefix>_Unload" instruction in the STEP 7 user program.
● From now on, no new executes can be carried out for these ODK application. Executions
still running are aborted. The execution of the function is interrupted and terminated
immediately. No return value is sent to the CPU.
● The host calls the "OnStop()" and "OnUnload()" functions.
● The ODK application is unloaded.
"<STEP7Prefix>_Unload" instruction
An ODK application is unloaded by calling the "<STEP7Prefix>_Unload" instruction in the
STEP 7 user program.
<STEP7Prefix>_Unload
REQ DONE
BUSY
ERROR
STATUS
Input parameters
A edge transition (0 to 1) at the "REQ" input parameter starts the function.
"ODK_TRACE" instruction
If you define the "ODK_TRACE" instruction, it is also compiled and executed. When you
define the parameter Trace=on in the <Project>.odk file, the instruction is automatically
defined with the following code:
#define ODK_TRACE(msg, ...);
Example: ODK_TRACE("number=%d", 13);
Calling the instruction creates an entry in the trace buffer.
When you define the parameter Trace=on in the <Project>.odk file, no trace data is written.
Trace data is written automatically when an exception occurs.
GetTrace
TraceCount STATUS
The following table shows the parameters of the "GetTrace" function block:
5.5.1 Introduction
You use the post mortem analysis to evaluate the system after an exception. The post
mortem files map a snapshot at the time of the exception.
You can analyze the dump with the post mortem analysis. It includes, for example:
● Register
● Stack
● Local/global data
● Transfer parameters
An exception can be triggered by one of the following cases:
● Execution of an illegal command
– Division by zero
– Access to protected memory
● An exception triggered by the "throw" instruction but not handled by the "try...catch"
instruction
The objective of the post mortem analysis is to find the error within the ODK application that
caused the exception.
NOTICE
Exception influences the cycle time
When an exception occurs in your application, the complete application memory is
buffered. This may take some milliseconds and influence the cycle time.
The post mortem files for the snapshot of the first exception are not created until the CPU
changes from RUN to STOP. You can use it for the following post mortem analysis. They are
stored in the following directory: <load memory>/ODK1500S
The following files are created or overwritten during this process and can, for example, be
downloaded via the web server:
● <Project>.ed
Binary dump of the shared object in which the exception has occurred
● <Project>.es
Stack at the time of the exception
● <Project>.er
Script for restoring the snapshot at the time of the exception
NOTICE
Insufficient load memory
When there is not enough load memory, the post mortem files are not saved properly.
Make sure that you have enough load memory for your applications.
Procedure
To run a post mortem analysis, follow these steps:
1. Open Eclipse.
2. Load the post mortem files to the engineering PC via the web server. Load these files to
the same directory in which the SO file is stored.
When you start a debug process for the first time, a dialog opens prompting you to select
the required launch environment.
A dialog opens showing you the progress of the loading process for the post mortem
image. The loading process can take several minutes, depending on the size of the post
mortem image.
5. Select the required debug view.
Note
The memory for input and output parameters is allocated dynamically, depending on the
quantity needed. The memory is allocated here in blocks of 8 KB each.
CPU Available memory for loading ODK applications Maximum size of the SO
file
CPU 1505SP (F) 10 MB 3.8 MB
CPU 1507S (F) 20 MB 5.8 MB
CPU 1518-4 PN/DP 20 MB 5.8 MB
ODK (F)
The following restrictions are also in effect in the context of the realtime environment:
● SO file name may not exceed 56 characters.
A.1.2 Compatibility
If you are using ODK version V2.0, note the following:
● An ODK project created with ODK version < V2.0 is not compatible. You must re-create
your ODK project in version V2.0.
● An ODK application created with ODK version < V2.0 is compatible with newer CPUs.
<DataType> <TagName>;
...
};
The ODK_CLASSIC_DB data type may only be used with the InOut-Identifier [IN] and
[INOUT]. If a parameter of the ODK_CLASSIC_DB data type is used with the InOut-Identifier
[IN] or [INOUT], no other parameter, regardless of the data type, may be used with the same
InOut-Identifier.
A.2.2 Parameters
The parameters of the <Project>.odk file are different:
● Developing ODK application for the Windows environment
● Developing ODK application for the realtime environment
Parameter errors:
Syntax errors:
String-helper functions for ODB application for Windows and real-time environment
The following helper functions provide access to S7 strings:
Value Description
CODK_CpuReadData Class constructor: Initializes the input data area and the data size.
ReadS7BYTE Reads a "byte" (1 byte) from the data area.
ReadS7WORD Reads a "word" (2 bytes) from the data area.
ReadS7DWORD Reads a "double word" (4 bytes) from the data area.
ReadS7LWORD Reads a "long word" (8 bytes) from the data area.
ReadS7S5TIME Reads a "16-bit" (2 bytes) time value from the data area.
ReadS7DATE Reads a date value (2 bytes) from the data area.
ReadS7TIME_OF_DAY Reads the time of day (4 bytes) from the data area.
ReadS7SINT Reads a "short integer" (1 byte) from the data area.
ReadS7INT Reads a "integer" (2 bytes) from the data area.
ReadS7DINT Reads a "double integer" (4 bytes) from the data area.
ReadS7USINT Reads a "unsigned short integer" (1 byte) from the data area.
ReadS7UINT Reads a "unsigned integer" (2 bytes) from the data area.
ReadS7UDINT Reads a "unsigned double integer" (4 bytes) from the data area.
Value Description
ReadS7REAL Reads a "real number" (4 bytes) from the data area.
ReadS7LREAL Reads a "long real number" (8 bytes) from the data area.
ReadS7LINT Reads a "long integer" (8 bytes) from the data area.
ReadS7ULINT Reads a "unsigned long integer" (8 bytes) from the data area.
ReadS7TIME Reads a time value (4 bytes) from the data area.
ReadS7CHAR Reads a "char" (1 byte) from the data area.
ReadS7BOOL Reads a "bool" (1 byte) from the data area.
ReadS7STRING_LEN Reads the information of string length from an S7 string in the data
area.
ReadS7STRING Reads an S7 string from the data area and returns it as C++ charac-
ter string.
ReadS7DATE_AND_TIME Reads the general data and time area.
Value Description
CODK_CpuReadWriteData Class constructor: Initializes the output data area and the data size.
WriteS7BYTE Writes a "byte" (1 byte) to the data area.
WriteS7WORD Writes a "word" (2 bytes) to the data area.
WriteS7DWORD Writes a "double word" (4 bytes) to the data area.
WriteS7LWORD Writes a "long word" (8 bytes) to the data area.
WriteS7SINT Writes a "short integer" (1 byte) to the data area.
WriteS7INT Writes a "integer" (2 bytes) to the data area.
WriteS7DINT Writes a "double integer" (4 bytes) to the data area.
WriteS7USINT Writes a "unsigned short integer" (1 byte) to the data area.
WriteS7UINT Writes a "unsigned integer" (2 bytes) to the data area.
WriteS7UDINT Writes a "unsigned double integer" (4 bytes) to the data area.
WriteS7S5TIME Writes a 16-bit (2 bytes) time value to the data area.
WriteS7TIME Writes a time value (4 bytes) to the data area.
WriteS7DATE Writes a date value (2 bytes) to the data area.
WriteS7TIME_OF_DAY Writes a time of day (4 bytes) to the data area.
WriteS7CHAR Writes a "char" (1 byte) to the data area.
WriteS7REAL Writes a "real number" (4 bytes) to the data area.
WriteS7LREAL Writes a "long real number" (8 bytes) to the data area.
WriteS7LINT Writes a "long integer" (8 bytes) to the data area.
WriteS7ULINT Writes a "unsigned long integer" (2 bytes) to the data area.
WriteS7BOOL Writes a "bool" (1 byte) to the data area.
WriteS7STRING Writes a S7 string to the data area.
WriteS7DATE_AND_TIME Write data and time data to the date and time area.
GetTrace
TraceCount STATUS
The following table shows the parameters of the "GetTrace" function block:
C I
Callback functions Implementing functions
Realtime, 64 Custom functions, 33, 65
Windows, 32 Realtime, 64
Calling functions Windows, 31
Realtime, 77 Installation, 15
Windows, 41 Internet Web sites (Siemens), 3
Context Application, 22, 54
Context Realtime, 54
Context System, 22 K
Context User, 22
Knowledge required, 3
Creating a project
Realtime, 49
Windows, 17
L
Customer service, 3
Loading functions
Realtime, 75
D Windows, 37
Debug (Test), 68
Debug (Windows), 46
M
Defining functions, 23, 55
Defining runtime properties Manuals, 3
Realtime, 52
Windows, 21
Definitions, 3 P
Development environments, 11
Post Mortem analysis, 83
Development steps, 13
Product overview, 9
Documentation, 3
Basic procedure, 13
Dynamic memory, 66
How it works, 9
G S
Generating an application
Siemens contact information, 3
Realtime, 52
STEP 7 import
Windows, 20
Realtime, 74
Windows, 36
Support, 3
Syntax rules, 23, 55
System requirements, 14
T
Target group, 3
Technical support, 3
Trace buffer, 81
Transfer to target system
Realtime, 72
Windows, 35
U
Uninstalling, 16
Unloading functions
Realtime, 79
Windows, 43
W
Web sites (Siemens), 3