Sei sulla pagina 1di 22

Application Example 09/2016

SIMATIC IOT2000
Getting Started
SIMATIC IOT2020, SIMATIC IOT2040

Warranty and liability

Warranty and liability


Note

The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The Application
Examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for ensuring that
the described products are used correctly. These Application Examples do not
relieve you of the responsibility to use safe practices in application, installation,
operation and maintenance. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these
Application Examples and other Siemens publications e.g. Catalogs the
contents of the other documents have priority.

Siemens AG 2016 All rights reserved

We do not accept any liability for the information contained in this document.
Any claims against us based on whatever legal reason resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(wesentliche Vertragspflichten). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of the Siemens AG.
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 customers exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial
Security RSS Feed under http://www.siemens.com/industrialsecurity.

IOT2000 Getting Started


Version 1.0, 09/2016

Table of contents

Table of contents
Warranty and liability ................................................................................................... 2
1

Task ..................................................................................................................... 4
1.1

Overview............................................................................................... 4

Required Software ............................................................................................. 5

Application Example ......................................................................................... 6


3.1
3.1.1

Intel System Studio IoT Edition ............................................................ 6


Program the Application Example in Eclipse ....................................... 6

Checklist ........................................................................................................... 21

Related links ..................................................................................................... 22

History............................................................................................................... 22

Siemens AG 2016 All rights reserved

IOT2000 Getting Started


Version 1.0, 09/2016

1 Task

Task

1.1

Overview

Introduction
This Getting Started shows how to create a sample program with the SIMATIC
IOT2000. This sample includes writing and reading a digital signal (USER LED of
the SIMATIC IOT2000)
Goals
After working through this document you know how to

Siemens AG 2016 All rights reserved

NOTICE

Create a new Eclipse project

Initialize a Digital Pin

Write a Digital Pin

Read a Digital Pin

Precondition!
To use this Getting Started it is required that the Initial Operation in the
Document Setting up the SIMATIC IOT2000 has been executed once.

IOT2000 Getting Started


Version 1.0, 09/2016

2 Required Software

Required Software
This chapter contains the software required for this Getting Started.

Java Platform 64-bit (JRE)


To work with the Development Environment Intel System Studio IoT Edition a
Java Runtime Environment is required.
If this JRE is not installed yet the Development Environment is not able to start.
The required JRE can be downloaded here.
Intel System Studio IoT Edition
To create C/C++ projects for the SIMATIC IOT2000 a Development Environment is
required.
In this Getting Started the Intel System Studio IoT Edition is used. The Software
Package contains a preconfigured Eclipse platform with all needed extensions for
C/C++ programming.
Additionally it contains libraries and other important functionality to work with the
SIMATIC IOT2000.
Siemens AG 2016 All rights reserved

The Intel System Studio IoT Edition can be downloaded here.

IOT2000 Getting Started


Version 1.0, 09/2016

3 Application Example

Application Example
This chapter describes how an application can be created with the Intel System
Studio IoT Edition.
For learning purposes, a basic Hello World example will be implemented in
C/C++ with a blinking USER LED.

3.1

Intel System Studio IoT Edition


The Intel System Studio IoT Edition makes it possible to implement projects in
C/C++ Code in Eclipse and transfer them via Ethernet to the SIMATIC IOT2000.

3.1.1

Program the Application Example in Eclipse

Create a new project


The following table describes the procedure for creating a new project in Eclipse.
Table 3-1

Siemens AG 2016 All rights reserved

No.

Action

1.

Download the Intel System Studio IoT Edition

2.

Extract the downloaded ZIP-File containing Intel System Studio IoT Edition
NOTE: The storage path of the extracted folder must not include a blank!

3.

Start the iss-iot-launcher.bat in the extracted folder with a double-click.


This batch-file will start Eclipse with all required extensions

4.

If the program is not able to start, an error dialog that Java JRE is missing
appears.
In this case the installation of the Java JRE is required.

IOT2000 Getting Started


Version 1.0, 09/2016

3 Application Example

No.

Action
The following Eclipse dialog will appear, select a workspace.
If the default folder doesnt exist it will be created automatically.

6.

If there is no Java JDK is installed on the Engineering Station a Warning dialog


appears at the start of Eclipse.

Siemens AG 2016 All rights reserved

5.

In this case it is not possible to create and run Java projects. For this Getting
Started Java is not used.
Press OK

IOT2000 Getting Started


Version 1.0, 09/2016

3 Application Example

Siemens AG 2016 All rights reserved

No.

Action

7.

Create a new project:

File > New > Create a new Intel IoT project

8.

Now choose C/C++ Project in the folder Intel IoT C/C++ Project

IOT2000 Getting Started


Version 1.0, 09/2016

3 Application Example

No.

Configure the Project as follows:


1. Assign a project name and select Empty C++ project type
2. Click Next

Siemens AG 2016 All rights reserved

9.

Action

IOT2000 Getting Started


Version 1.0, 09/2016

3 Application Example

No.

Now a Target Connection has to be created. This connection is used to transfer


the C/C++ script to the SIMATIC IOT2000.
Configure target connection as follows:
1. Set Connection Name (e.g. IOT2000)
2. Type-in the assigned IP Address of the SIMATIC IOT2000
3. Click Finish

Siemens AG 2016 All rights reserved

10.

Action

IOT2000 Getting Started


Version 1.0, 09/2016

10

3 Application Example

Siemens AG 2016 All rights reserved

No.

Action

11.

Check if the connection to the SIMATIC IOT2000 can be established:


1. In the bottom left corner you will find a dialog window called Target
selection
2. Right-click on the previously added connection (i.e. IOT2000)
3. Select Connect

12.

A login prompt appears, configure as follows:


1. User ID: root
2. Password: <assigned password>
3. Click OK

IOT2000 Getting Started


Version 1.0, 09/2016

11

3 Application Example

No.

Action
At the first connection the connection process takes a while before a warning will
pop up.

The correct host key has to be changed

It may be that a few other dialogs will pop up

Confirm all by clicking Yes

14.

The Eclipse wants to synchronize the libraries on the target, if there are different
versions.

This is not required for this Example.

Click No

15.

Now the connection icon in the bottom left corner is green and the connection is
established

Siemens AG 2016 All rights reserved

13.

IOT2000 Getting Started


Version 1.0, 09/2016

12

3 Application Example

No.
16.

Action
Go to the Project tree present in Eclipses left side, open the
HelloWorldCounter.cpp and modify the code as follows:

#include <iostream>
#include <unistd.h>
#include "mraa.hpp"

using namespace std;


int main() //main function
{
//initiales GPIO variable
mraa::Gpio* User_LED = NULL;

//define variable as PIN 13 (User LED)


User_LED = new mraa::Gpio(13, true, false);
//set the pin as output
User_LED->dir(mraa::DIR_OUT);

Siemens AG 2016 All rights reserved

bool LED_Status; //create variable for the status of


the LED
while(true) //endless while loop
{
User_LED->write(1); //write LED on
LED_Status = User_LED->read();//read LED status
cout<<LED_Status<<endl; //display LED value
sleep(1); //wait 1 sec
User_LED->write(0); //write LED off
LED_Status = User_LED->read(); //read LED status
cout<<LED_Status<<endl; //display LED value
sleep(1); //wait 1 sec
}
return 0;
}

IOT2000 Getting Started


Version 1.0, 09/2016

13

3 Application Example

No.

Once the programming is finished, the project can be built:

File > Save (Ctrl + S)

Project > Build All (Ctrl + B)

Siemens AG 2016 All rights reserved

17.

Action

IOT2000 Getting Started


Version 1.0, 09/2016

14

3 Application Example

Change the default storage path


The, Eclipse IDE transfers the script to a temporary directory which will be deleted
by SIMATIC IOT2000s Image settings during a restart or loss of power.
The following table shows how to change the default directory in Eclipse.
Table 3-2
No.

Action
Right-click on the Project tree > Properties

2.

Choose Run/Debug Settings > HelloWorldCounter > Edit

Siemens AG 2016 All rights reserved

1.

IOT2000 Getting Started


Version 1.0, 09/2016

15

3 Application Example

No.

Action
The settings for the file path is tmp per default

4.

Siemens AG 2016 All rights reserved

3.

IOT2000 Getting Started


Version 1.0, 09/2016

Change this tmp to the created ProjectFolder.


Click Apply and then OK

16

3 Application Example

Action

Siemens AG 2016 All rights reserved

No.

IOT2000 Getting Started


Version 1.0, 09/2016

17

3 Application Example

Transfer the project to the SIMATIC IOT2000


Once the default storage path is set to a non-temporary directory and the
Application Example is built without errors, the generated script can be transferred
to the SIMATIC IOT2000.
The following table describes the procedure for transferring the C/C++ script to the
SIMATIC IOT2000.
Table 3-3

Siemens AG 2016 All rights reserved

No.

Action

1.

Click on the green RUN Button in Eclipse

2.

A message will pop up. This can be ignored. Press YES.

3.

The script will be transferred automatically to the set storage path on the
SIMATIC IOT2000

IOT2000 Getting Started


Version 1.0, 09/2016

18

3 Application Example

Siemens AG 2016 All rights reserved

No.

Action

4.

When the transfer is completed, the application example starts to run and the
following operations can be seen:

SIMATIC IOT2000s USER LED starts to blink with a frequency of 1 Hz

Eclipses Console starts to display the value of the LED

5.

With the Terminate button shown in the in Eclipses Console, the program
execution can be stopped.

Debug View
The following table shows how the debug view can be opened.

IOT2000 Getting Started


Version 1.0, 09/2016

19

3 Application Example

Table 3-4

Siemens AG 2016 All rights reserved

No.

Action

1.

Transfer the project to the SIMATIC IOT2000 as described before

2.

Click on the Debug Button in Eclipse

3.

Now the Debug view opens

4.

In this view it is possible to set breakpoints, go through the program step by step
etc.

IOT2000 Getting Started


Version 1.0, 09/2016

20

4 Checklist

Checklist
This chapter contains a Checklist which summarizes all important steps in this
Getting Started.
Table 4-1
No.

Action
Create a new Eclipse project (Empty C++ project)

2.

Set a Target Connection to the assigned IP Address

3.

Check if the Target Connection works

4.

Insert the sample code

5.

Build the sample code

6.

Change default storage path to created directory

7.

Transfer C/C++ script to the SIMATIC IOT2000 (Run Button)

8.

Check the Console of Eclipse and the blinking LED of the SIMATIC IOT2000

Siemens AG 2016 All rights reserved

1.

IOT2000 Getting Started


Version 1.0, 09/2016

21

5 Related links

Related links
Table 5-1
Topic
\1\

SIMATIC IOT2000 forum


www.siemens.com/iot2000-forum

\2\

Download SD-Card Example Image

https://support.industry.siemens.com/cs/ww/en/view/109741799

Siemens AG 2016 All rights reserved

\3\

SIMATIC IOT2000 Setting UP


https://support.industry.siemens.com/tf/ww/en/posts/155642/

\4\

Operating Instructions
https://support.industry.siemens.com/cs/document/109741658/simatic-iot2020simatic-iot2040?dti=0&lc=en-WW

History
Table 6-1
Version

Date

V1.0

09/2016

IOT2000 Getting Started


Version 1.0, 09/2016

Modifications
First version

22

Potrebbero piacerti anche