You are on page 1of 81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl.

HMI Configuration (S7-200, EM253, FM-STEPDRIVE,


SIMOSTEP type 1FL3, TD200)
Micro Application Example 10 V1.0 (Edition 03/2003)

Structure of the document


Part A1 Automation Description (incl. Component list/Basic performance data)

Part A2 : Function Mechanisms in Detail

Part B:
Step by Step Commissioning and Setup

Part C: Program Description

Micro Application Examples The Fast Track to an Optimized Solution

Micro Automation

Liability Siemens AG does not accept liability of any kind for damages arising from the use of this application, except where it is obliged to by law, in cases such as damage to items used for personal purposes, personal injury, willful damage or gross negligence. Warranty The program examples given are specific solutions to complex tasks which were worked on by Customer Support. We must also point out that it is not possible in the current state of the technology to exclude all errors in software programs under all conditions of use. The program examples were prepared according to the best of our knowledge. However, we cannot accept any liability beyond the standard guarantee for Class C software in accordance with our General Terms of Sale for Software Products for Automation and Drive Technology". The program examples can be purchased on the Internet as single licenses. They may not be transferred to a third party.

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Table of Contents
Part A1: Application Description................................................................................. 7 1 2 2.1 2.1.1 2.1.2 2.2 3 3.1 3.2 3.3 3.3.1 3.3.2 3.4 The Automation Task................................................................................. 8 The Automation Solution ........................................................................ 10 Required standard hardware and software components and components of the application software ("shopping list") ........................... 12 Hardware components ............................................................................... 12 Software components ................................................................................ 12 Application software components .............................................................. 13 Basic performance data .......................................................................... 14 General ...................................................................................................... 14 Example for using the calculation matrix shown in chapter 3.3 ................. 15 Calculation matrix....................................................................................... 16 Acceleration time [ms]................................................................................ 16 Delay .......................................................................................................... 16 Selected, measured times for verifying the calculated values ................... 18

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Part A2 : Function Mechanisms ................................................................................ 20 4 4.1 4.1.1 4.1.2 4.1.3 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 Function Mechanisms ............................................................................. 21 Description of entire solution structure....................................................... 21 Control unit (S7-CPU 222 and positioning module EM 253) ...................... 22 Control of the FM STEPDRIVE and the SIMOSTEP stepper motor .......... 24 Operator control and monitoring of the application with the TD200 text display unit .......................................................................................... 33 Program and data structure ....................................................................... 34 Organization block " STEP1_MAIN " ......................................................... 35 Subroutine " STEP1_MOTION " ................................................................ 36 Subroutine "STEP1_MSELECT" ................................................................ 38 Subroutine "STEP1_PSELECT" ................................................................ 39 Subroutine "STEP1_FCUT" ....................................................................... 40 Subroutine "STEP1_STATUS"................................................................... 41 Variables used in the program ................................................................... 41

Part B: Installation of the Example Application....................................................... 46 5 5.1 5.1.1 5.1.2 5.1.3 5.2 5.2.1 Installation of Hardware and Software................................................... 47 Hardware configuration .............................................................................. 47 Installation of the S7-200 CPU and the EM253 positioning module .......... 48 Installation of the FM STEPDRIVE ............................................................ 48 Electrical connection of the components.................................................... 49 Software installation ................................................................................... 56 Transfer of the application code to the S7-200 CPU.................................. 56
3/81

Rev. A - Endgltig 04.04.2003

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.2.2 6 6.1 6.2 6.3 6.4

Parameter setting for the FM STEPDRIVE ................................................ 57 Operator Control via Text Display TD200 .............................................. 58 Automatic/jog mode ................................................................................... 58 Selecting and setting profiles ..................................................................... 60 Display of status information ...................................................................... 61 Setting the first cut ..................................................................................... 62

Part C: Program Description ..................................................................................... 63 7 7.1 7.2 8 8.1


Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Explanation of the main parts of the S7-Micro/Win program............... 64 Details on the sub-program STEP1_MOTION ........................................... 65 Details on the sub-program STEP1_PSELECT ......................................... 71 Modifying the S7-Micro/Win Program .................................................... 77 Changing the parameters for motion.......................................................... 77 Increasing the number of profiles............................................................... 79 Changing the feedrate................................................................................ 80 Use of other motor versions ....................................................................... 81

8.2 8.3 8.4

Rev. A - Endgltig 04.04.2003

4/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Preamble
The application described in this document is used for the controlled positioning of an axis with a stepper motor using the example of a cutting-to-length process, including HMI configuration and it belongs to the group of controlled positioning procedures. Basically, these procedures can be broken down into "controlled" and "closed-loop controlled" positioning processes. In contrast to controlled positioning systems, control units used for closed-loop controlled positioning must be continuously provided with in-process information on the current position. The application for controlled positioning described here requires the following component types: S7-222 CPU EM 253 POSITION
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

FM STEPDRIVE SIMOSTEP 2Nm (stepper motor) TD200 text display unit. The SIMOSTEP stepper motor mentioned above is also available in other versions with different ratings; the application described here refers to a type of stepper motor which is quite common on the market. In combination with exactly the components as stated above, the application described in this document offers a Plug&Play solution for linear axes and also includes primary performance data verified under load. But you may also select other products from the specified product types (e.g. SIMOSTEP 4Nm instead of 2Nm) that meet best your specific purpose: our detailed description of the function mechanisms and of the user program will help you to choose functional features that suit your individual requirements (e.g. with regard to the HW components used). Furthermore, we give answers to frequently asked questions which will help you to reach your goal step by step (see chapter 8 "Modifying the S7 Micro/Win Program"), e.g. on "how to proceed, if you wish to use another type of stepper motor with different ratings".

Rev. A - Endgltig 04.04.2003

5/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The basic solution principle of this application can be described as follows: In order to realize a controlled positioning process, the application must be equipped with different standard components (hardware and software. These standard components must be provided by you (see Figure 0-1). The application software delivered relieves you from extensive parameter setting and programming of the standard components and offers you a comfortable solution for your controlled positioning procedures.

SIEMENS SIMATIC components (HW+SW)


Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

SIEMENS Motors & Drives (HW+SW)

Application software (SW)

... provided by you

... part of the delivery of the application

Figure 0-1

Basic solution principle of the application

Possible fields of use for this application include feed units material conveyance systems
paper processing machines

cardboard processing machines

Rev. A - Endgltig 04.04.2003

6/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Part A1: Application Description


Objectives of Part A1 Part A1 of this document provides the reader with information on the following topics: the automation task to be solved a possible solution the performance and capacity of the overall application.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Rev. A - Endgltig 04.04.2003

7/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The Automation Task

A typical industrial case The following example shows one possible case where the provided application is used. The example refers to a material conveyance system used to feed cardboard elements to a cutting unit. The cardboard is moved by means of a feed roll and a press roll, whereby the cardboard is "clamped" between the two rolls. The feed roll is driven by a stepper motor. The cardboard feed rate refers always to a defined length (set length for the cardboard). After the cardboard has been moved forwards by this defined length, it is cut by a knife extending from the cutting block. When cutting is completed, the cut cardboard piece is transported to the next station. The next piece of cardboard can be fed forward and cut.
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

The cardboard is registered by a sensor located directly behind the cutting block. Before starting the first cut, the cardboard is positioned automatically directly beneath the cutting block, so as to avoid unnecessary waste of material. The positioning task relevant for this application is the exact positioning of the uncut cardboard for feed movement.

Figure 2-1

Technical task specification

Rev. A - Endgltig 04.04.2003

8/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

"Abstract" approach to the application requirements The application shall be compatible with the "given" hardware components (S7-CPU 222, EM253, FM STEMDRIVE and SIMOSEP stepper motor, TD200; also refer to the components list of chapter 2.1.1). In combination with the "application software" (see chapter 2.2), the system offers specific performance characteristics which define the range of possible applications that can be realized with this solution. The Plug&Play version of this application (i.e. in combination with the defined hardware components, see above) is suitable for use with systems that meet the following basic data:
Table 1-1
Technical date Motor torque Accuracy Speed
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Basic data of the application


from 0 until 2Nm <1mm 1 rev/sec of the stepper motor shaft 20 rev/sec of the stepper motor shaft

Basically the "application software" is also suitable for use with stepper motors of other capacity classes (of the SIMOSTEP series), which offers an extended range of possible applications with regard to the driving power. The positioning accuracy is normally not affected. Apart from the technical functions, the application is provided with a very comfortable and cost-effective HMI connection. The criteria to be monitored include the current position and speed, as well as the present STATUS of the application. The following functions must be fully operable: automatic ON/OFF, jog mode (forward/backward motion) and individual setting of the feed length.

Note The application software complies with the above stated requirements without requiring any further programming.

Rev. A - Endgltig 04.04.2003

9/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The Automation Solution


This chapter provides you with detailed information on how this application solves the automation task described in chapter 1. It demonstrates what the application can do and how it works. Its functions are deliberately described in universally applicable terms. Part A2 of this documentation includes indepth information, which you will only need, if you are interested in the detailed processes and the interactions between the individual solution components. The hardware components illustrated give an overview of the system layout.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 2-1

Hardware components of the automation solution

An S7-200 CPU controls the stepper motor via the modules EM 253 POSITION and FM STEPDRIVE. The FM STEPPDRIVE is the power unit for the stepper motor. Position and motion of the stepper motor are defined by the CPU. The EM253 "POSITION" module transforms these values into pulses (steps) which are then converted into current values for the stepper motor rotation. The stepper motor is connected to a roll by means of a toothed belt. The cardboard is clamped between this feed roll and a presson roll. The configuration is operated and monitored with the help of a TD200 text display unit (e.g. to define the cardboard length, display of the current position, etc.).
Rev. A - Endgltig 04.04.2003 10/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The sections below include information on each hardware element shown in Figure 2-1 and their specific functions for the overall solution of the automation task:

Table 2-1

Functions of the individual hardware components in the overall solution

No. Classification according to Figure 3-1 1 Visualization

Hardware element Text display unit TD200

(Main) Function, properties

operator control and monitoring (see table 42, "HMI displays and their function"). automatic process for feed movement selection between different profiles in a special setting-up mode, the cardboard can be positioned beneath the cutting block where it is registered by a sensor converts the travel paths received from the S7-Micro/Win program into pulses converts the pulses received from the EM253 into current values for motor movement. converts the electrical energy into mechanical power.

2
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Super-ordinate intelligence with I/O modules Extension module for positioning tasks (connected to a super-ordinate intelligence) Drive

S7-CPU 222

EM 253 "POSITION"

FM STEPDRIVE

Motor

SIMOSTEP stepper motor TYPE 1FL3041-0AC310BK0 (2Nm)

Rev. A - Endgltig 04.04.2003

11/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

2.1

Required standard hardware and software components and components of the application software ("shopping list")
Hardware components

2.1.1 Products
Component

Type

MLFB/Order information

No.

Remarks

Central processing unit Expansion module Text display unit Power unit Stepper motor

S7-CPU 222 (AC) EM 253 "POSITION" TD200 FM-STEPDRIVE SIMOSTEP 2Nm type 1FL3

6ES7212-1BB22-0XB0 6ES7253-1AA22-0XA0 6ES7272-0AA20-0YA0 6SN1227-2ED10-0HA0 1FL3041-0AC31-0BK0

1 1 1 1 1

For CPU connection to mains voltage With cable (2.5m) and installation equipment Shaft diameter 12mm

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Accessories
Component Type MLFB/Order information No. Remarks

Connecting cable PC S7-CPU 222 Connecting cable positioning module power unit Connecting jack on the power unit Connecting cable power unit stepper motor Fixation for FM STEPDRIVE

PC/PPI cable

6ES7901-3BF21-0XA0

1 1 The cable must be prepared individually, see Chapter 5.1.3 Packing unit: 3 pieces 3 x 1.5mm Cu Length: 160mm

15 pin D-SUB female with enclosure Power line 10m SIMATIC S7-300, mounting rail

6FC9348-7HX 6FX5008-5AA00-1CA0 6ES7390-1AB60-0AA0

1 1 1

Note This application has been realized without the use of a sensor which is simulated by means of a digital input for each switch (see chapter 5.1.3.6).

2.1.2

Software components

Configuration software
Component Type MLFB/Order information No. Comment

Configuration software

S7-Micro/Win 32 V3.2; suitable for use under WIN95/98/ME and WIN NT/2000

6ES7810-2BC02-0YX0

With documentation on CD

Rev. A - Endgltig 04.04.2003

12/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

2.2

Application software components


The software required for this application is included in the S7-Micro/Win project. The table below shows the individual elements of the STEP7 -Micro/Win project including a description of their functions and technical data.

Table 2-2
No. Name

Application software components


Function description Technical data

1 2 3 4

STEP1_MAIN (OB1) STEP1_MOTION (SBR0) STEP1_MSELECT (SBR1)

Calls the sub-programs Automatic and manual motion control Selects the TD200 displays Selects the cutting profile and to set the lengths for the different cutting profiles Places the paper beneath the cutting block and to activate the initial start of operation Shows information on the present status in plain text, e.g. "FM STEPDRIVE ready" 1892 bytes Activates and initializes the positioning module Changes to manual operation of the positioning module (jog mode) Transmits a command to the positioning module for absolute or relative movement to a defined position (defined feed action) This command for the positioning module is used to load a new position value for the "current position" (e.g. 0 to reset the counter) Enables or disables the output "DIS" of the positioning module required to enable the FM STEPDRIVE Includes all default values and the reservations for variables, as well as the configuration of the TD200 text display unit

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

STEP1_PSELECT (SBR2)

STEP1_FCUT (SBR3)

6 7 8

STEP1_STATUS (SBR4) POS0_CTRL (SBR5) POS0_MAN (SBR6)

POS0_GOTO (SBR7)

10

POS0_LDPOS (SBR8)

11

POS0_DIS (SBR9)

12

DATA BLOCK (DB)

494 bytes

Note The FM STEPDRIVE power unit does not need to be configured separately; the few parameters required can be set directly with the device buttons, see Part B.

Rev. A - Endgltig 04.04.2003

13/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

3
3.1

Basic performance data


General
Due to the function principle of step motors the mechanical performance data of the application (theoretical) are already known in advance. This means, that when planning a step motor drive, the exact performance data can be calculated. The data results from motor power, the mass to be accelerated and the friction during positioning. On this basis a matrix was calculated in this application taking into account the used components. In this matrix the acceleration time (under various frame conditions) was calculated depending on the load momentum and the maximum reachable speed. (Some values were measured at random for verifying the calculated values) The following formula were used:

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

M Stepprm : Torque of stepper motor [Nm]


M Friction : Friction momentum of test setup [Nm] M Load : Load momentum against position direction [Nm] max : Angular velocity [s-1] (Velocity of round axis) : Angular acceleration [s-2] (Acceleration of round axis) J : Momentum of inertia of test setup [Kgm] (Mass inertia of round axis) t Acceleration : Time for accelerating to maximum velocity [s]

M Stepperm = J + M Friction + M Load

M Stepperm (M Friction + M Load ) J


= max t Acceleration
J =

M Stepperm (M Friction + M Load )

max t Acceleration

J max =t M MStepperm (M Friction + M Load ) Acceleration


Rev. A - Endgltig 04.04.2003 14/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The rearranged formula for the acceleration time to maximum velocity shows, that the values for the momentum of inertia the desired maximum velocity the momentum (depending on velocity) the friction momentum and the load momentum must be known.

!
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Important All values measured and calculated in this chapter refer to the test setup, on which the application was developed. Other mechanical systems have different parameters, which must be included in the calculation.

3.2

Example for using the calculation matrix shown in chapter 3.3

Fig. 3-1

Application example for using the calculation matrix

The value for the moment of inertia is constant for all boundary conditions and in the used test setup it is J=0.005096 kgm.

Rev. A - Endgltig 04.04.2003

15/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

3.3
3.3.1

Calculation matrix
Acceleration time [ms]
acceleration Existing load momentum [Nm] Torque of stepper motor [Nm] 2 2 2 1,9 1,75 1,6 0,7

Maximum velocity [min-1] 0 43 109 268 563 875 2220


Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Friction momentum [Nm] 0 0,3 0,35 0,4 0,45 0,5 0,55

0 0 0,013 0,035 0,095 0,231 0,424 7,898

0,1 0 0,014 0,038 0,102 0,25 0,467 23,69

0,2 0 0,015 0,04 0,11 0,273 0,519

0,3 0 0,016 0,043 0,119 0,3 0,584

0,4 0 0,018 0,047 0,13 0,334 0,667

0,5 0 0,019 0,051 0,143 0,376 0,778

0,6 0 0,021 0,055 0,159 0,429 0,934

0,7 0 0,023 0,061 0,179 0,501 1,167

0,8 0 0,025 0,068 0,204 0,601 1,556

0,9 0 0,029 0,078 0,238 0,751 2,335

1,0 0 0,033 0,089 0,286 1,001 4,669

1,1 0 0,038 0,106 0,358 1,502

1,2 0 0,046 0,129 0,477 3,004

1,3 0 0,057 0,166 0,715

1,4 0 0,076 0,233 1,43

1,5 0 0,115 0,388

1,6 0 0,229 1,163

3.3.2

Delay If delay values are also calculated, the values are very small. This is due to the fact that the friction of the setup and the load memento (against positioning) are useful during deceleration. Therefore, the calculation yields values which are at large smaller than 1/10 of the jerk time. The delay time should be at least twice as large as the jerk time, see figure 3-2. For calculated values this is not the case. For this reason, the ramp for the delay was set to the same time as for the acceleration. (The delay time should be at least 2x the jerk time)

Rev. A - Endgltig 04.04.2003

16/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The relationship between acceleration, delay and jerk time is illustrated in figure 3-2

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Fig. 3-2

Relationship between acceleration, delay and jerk time

If values are entered as described above, defined positioning can be performed. This is illustrated in figure 3-4. For acceleration and deceleration for example the same time was used.

Fig. 3-3

Example for equally parameterized acceleration and delay times

The following figures give an example of where the delay time was approximately 1/10 of the jerk time. It clearly shows, that the duration of the
Rev. A - Endgltig 04.04.2003 17/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

delay corresponds neither to the parameterized delay time nor to the jerk time. If values are entered as described above, defined positioning can be performed.

ca. 1,25s

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Fig. 3-4

Example for parameterized delay time < jerk time (parameterized are: maximum velocity = 148 min-1, startup time 4,67s Delay time 0.15s, jerk time 1.8s)

3.4

Selected, measured times for verifying the calculated values


For checking the calculated values, some random measurements of the acceleration time were performed. Two respective examples are briefly introduced in this chapter. Example measurement 1; load momentum 1 Nm against positioning direction, accelerating to 875 revolution.

Fig. 3-5

Example measurement 1, 1Nm, 875min-1 (Acceleration in 4.67 seconds)

Rev. A - Endgltig 04.04.2003

18/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

At the above depicted positioning process, it was accelerated in 4.67 seconds. The jerk time (for jerk reduction) was set to 40% of the acceleration time. The following example shows a failed acceleration process. The time for accelerating was selected too small. The stepper motor could not overcome the load momentum during acceleration, in the initial phase it was still accelerated, with increasing speed (and decreasing motor momentum) the load could not be held anymore.

Accelerates until the motor chagnes and the load pulls against positioning direction
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Fig. 3-6

Example 2, 1Nm, 875min-1 , failed acceleration process (Acceleration in 1 seconds)

Rev. A - Endgltig 04.04.2003

19/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Part A2 : Function Mechanisms


Objectives of Part A2 : Part A2 of this document provides the reader with information on the following topics: explanation of all integrated function elements description of the components which can be easily integrated in your own application environment.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Rev. A - Endgltig 04.04.2003

20/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Function Mechanisms
The application can really be used immediately without further ado. The installation instructions tell you how to start it without reading this chapter. If you are interested in specific background information and functions of this application or variations thereof, you will require some further information, for example on how to change your program sequences correctly and without too much difficulty into the STEP7-Micro/Win code. This information is provided in the following sections.

4.1

Description of entire solution structure


Figure 4-1 explains the basic structure of the application.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-1

Function principle of the application

From a structural point of view, the individual functions of the application can be broken down into different parts which are treated in the following sections: Control unit (S7-222 CPU with EM253, see chapter 4.1.1) Drive unit (FM STEPDRIVE and SIMOSTEP stepper motor, see chapter 4.1.2) Operator control and monitoring (TD text display, see chapter 4.1.3)
Rev. A - Endgltig 04.04.2003 21/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.1.1

Control unit (S7-CPU 222 and positioning module EM 253) The automation system consists of an S7-CPU 222 and a positioning module EM 253 connected to an expansion bus. The entire automation system is configured with the help of only one software program (S7-Micro/Win).

4.1.1.1

Controlled positioning process The diagram below illustrates the actual controlled positioning process.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-2

Principle of the controlled positioning process

The application program controls operation in automatic mode, i.e. the feed motion of the cardboard pieces by a defined cutting length and the cutting action (simulated in the application via a digital output). During automatic mode, the application program performs the following sequence of steps: 1. The cutting length is received from the HMI interface. 2. The application program of the S7-CPU 222 performs automatic repeat of the procedure. This loop includes the cardboard feed movement and the cutting action. 3. The positioning module converts the set value, which represents the real value of a specific unit of measure, into pulses which are subject to defined acceleration and brake ramps. The pulses are transmitted to the power section immediately.

Rev. A - Endgltig 04.04.2003

22/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4. After positioning, the positioning module transmits an "OK"-bit (positioning completed) to the program of the S7-CPU 222 (from where a new automatic cycle can be started). Depending on the information received from the configuration and on the corresponding control task, the positioning module generates specific pulses (direction, distance and speed) for the power section. The transfer of these pulses to the power section and the stepper motor is effected via two outputs (P0, speed and P1, direction). (Other outputs are available for the transmission of any further enable signals and commands to the power section).

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-3

Illustration of the pulses for motion generated by the positioning module

4.1.1.2

Command interface The command interface is an area in the data block. It comprises several bits which indicate global status information (e.g. automatic mode active) or which are used to control global application functions (jog mode forward/backward motion). For further information and a detailed description of the command interface, please refer to chapter 4.2.12 "Variables used in the program".

Rev. A - Endgltig 04.04.2003

23/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.1.2

Control of the FM STEPDRIVE and the SIMOSTEP stepper motor Stepper motor control is effected with the help of an FM STEPDRIVE power unit; this is necessary, since the stepper motor must not be connected directly to mains power.

4.1.2.1

FM STEPDRIVE power unit The power unit generates the mains voltage for the currents in the stepper motor winding required for motion. These current values are based on the pulses received from the EM253 positioning module (direction and frequency) and on the parameter settings of the power unit (current reduction and steps).

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-4

Basic function principle of the FM STEPDRIVE

Rev. A - Endgltig 04.04.2003

24/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.1.2.2

Stepper motor type SIMOSTEP 1FL3041-0AC31-0BK0 The SIMOSTEP stepper motor is a 3-phase hybrid stepper motor (for further information see chapter 4.1.2.3). It offers a maximum number of 10.000 steps of per revolution; this value may also be reduced by setting the power unit correspondingly. The SIMOSTEP stepper motor can be operated only in combination with a power unit (FM STEPDRIVE) and a control unit for the stepper motor. When combining the SIMOSTEP step motor with the FM STEPDRIVE power unit, the following step rates (per revolution) can be realized:

Table 4-1
Number of steps Step angle
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Possible number of steps of the SIMOSTEP stepper motor


500 0.72 1000 0.36 5000 0.072 10000 0.036

Note Due to the large performance range of the SIMOSTEP motors the application can be easily extended/supplemented so as to meet your specific requirements. Chapter 8.4 includes a detailed description of the criteria to be considered, if you wish to use a different type of motor. Note

The following chapter includes some theoretical background information on the function principle of stepper motors. However, this chapter is not really necessary for understanding the function principle of the application. But if you are interested in some in-depth knowledge about the function principle of stepper motors, you will find some useful information here.

4.1.2.3

General information on stepper motors There are 3 basic types of stepper motors which are explained in detail in the following: permanent-magnet stepper motors (with permanent-field excitation, ordinary version regarding design and function) reluctance stepper motors (extended design and function) hybrid stepper motors (a combination of the two versions stated above, as realized with the SIMOSTEP stepper motor used in this context).

Rev. A - Endgltig 04.04.2003

25/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.1.2.3.1

Permanent-magnet stepper motors The stepper motor consists, like almost any other electric motor, of a stator and a rotor. With classical stepper motor types, the stator consists of a stationary outer winding and the rotor is a shaft with a permanent magnet or a soft iron (or a combination of both). If voltage is applied to the stationary winding1 of the stator, a magnetic field is generated which defines the orientation of the permanent magnet on the rotor shaft.This initiates rotary movement until the magnetic fields of the stator winding and of the permanent magnets match. The stepper motor motion is not a continuous, but stepwise rotation (resulting from the magnetic fields generated in the stator winding). The following illustration shows that the stator windings must be "switched over" for each step.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-5

Principle structure and function of a permanent-magnet stepper motor

This switch-over action must be performed by a stepper motor control unit. The position of the rotor can be re-produced by counting the switch-over operations of the stator windings and by taking account of the angle length passed with each step.

One magnetic pair of poles each, i.e. a winding is also referred to as a phase. 26/81

Rev. A - Endgltig 04.04.2003

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.1.2.3.2

Reluctance stepper motor2 Similar to the permanent-magnet stepper motor type, the reluctance stepper motor consists of a stator with windings and a rotor. The rotor used in this version consists of easily magnetizable soft iron. This results in a magnetization and orientation of the rotor through the magnetic fields of the stator windings.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-6

Principle structure and function of a reluctance stepper motor

4.1.2.3.3

Hybrid stepper motor As already implied by its designation, the hybrid motor is a combination of a permanent-magnet stepper motor and a reluctance stepper motor. As with all types of stepper motors, the windings are located on the stator. The rotor is a shaft with an axial permanent magnet. This shaft is provided with pole shoes which are positioned in such a way that the north and south magnetic poles are in an offset arrangement.

Figure 4-7

Principle structure of a hybrid stepper motor

magnetic resistance 2

Rev. A - Endgltig 04.04.2003

27/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The diagrams below explain the function of the hybrid stepper motor. As the illustrations are drawn in a two-dimensional plane, the perspective of view is in the direction of the rotor shaft.
Illustration: Description

Stator: The winding arrangement generates 2 north and 3 south magnetic poles. Winding phase 1 is energized. Rotor: The south pole is on the rear pole shoe, the north pole on the front pole shoe. The orientation of the rotor can be seen from the illustration on the left.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Stator: Winding 1 is supplemented by winding 2 causing a displacement of the magnetic field by 22.5. Rotor: The rotor follows the position of the magnetic field and turns by 22.5.

Stator: Winding 1 is switched off, winding 2 remains energized. As a result, the magnetic field turns again by 22.5. Rotor: The rotor follows the position of the magnetic field by 22.5.

Stator: Winding 2 is supplemented by winding 1 in the reverse current direction, the magnetic field is displaced by 22.5. Rotor: The rotor follows the position of the magnetic field by 22.5.

Rev. A - Endgltig 04.04.2003

28/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration
Illustration: Description

Stator: Winding 2 is switched off, winding 1 remains energized with reverse current direction. As a result, the magnetic field rotates again by 22.5. Rotor: The rotor follows the position of the magnetic field by 22.5.

Further procedure: From this point, the process is repeated three times until one full revolution is completed (after 16 steps).

Figure 4-8

Function principle of a reluctance stepper motor

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

The required number of steps per revolution (= resolution, = possible accuracy) can be increased by means of the claw-type structure of the magnetic poles of the rotor and the stator. The layout of the claw-type pole principle is shown in the following illustration. The north and south magnetic poles of the windings are always located opposite to each other. This can be seen in the following illustration.

Figure 4-9 Principle of a claw-type pole arrangement

The figure below shows the offset arrangement of the claws (between north and south magnetic pole) on the rotor.

Figure 4-10

Claw-type pole principle on the rotor (sectional view of a stepper motor)

Rev. A - Endgltig 04.04.2003

29/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The figure below shows the offset arrangement of the claws (between north and south magnetic pole) on the stator windings.

Figure 4-11

Claw-type pole principle on the stator (sectional view of a motor without rotor)

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

The table below shows the function principle of the claw-type structure. The function principle is illustrated by a sectional view in the following graphic.

Figure 4-12

Sectional view for the explanation below

In the illustrations the number of claws is reduced to those required for explanation. For better overview, the motor is outlined in "unbent" condition. As already shown in Figure 4-6, the rotor is provided with two pole shoes with north and south magnetic poles; the positions of the pole shoe claws with regard to windings 1 and 2 are illustrated separately. The "active" magnetic field is highlighted. The illustration begins with the start position and shows four successive steps.

Rev. A - Endgltig 04.04.2003

30/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Illustration:

Description

Figure 1 shows the starting position of rotor and stator. Winding L1 is energized and forms a magnetic field. The north magnetic pole is generated in the winding shown, consequently, the part of the winding not illustrated here forms the south magnetic pole. The south pole of the rotor is attracted and the north pole of the rotor is repelled.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

In Figure 2, winding 2 is energized in the reverse current direction, resulting in the formation of a south magnetic pole. This south pole attracts the north pole of the rotor and repels the south pole: the motor rotates by one step.

In Figure 3, winding 1 is energized in the reverse current direction, resulting in the formation of a south magnetic pole. This south pole attracts the north pole of the rotor and repels the south pole: the motor rotates by a further step.

Rev. A - Endgltig 04.04.2003

31/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration
Illustration: Description

In Figure 4, winding 2 is energized, resulting in the formation of a north magnetic pole in the illustrated winding part. This part attracts the south pole of the rotor and repels the north pole; consequently the motor rotates by one step.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

In Figure 5, winding 1 is energized, resulting in the formation of a north magnetic pole. It attracts the south pole of the rotor and repels the north pole; consequently the motor rotates by one step. At this stage the motor has moved by exactly one gap and one claw length. The current flow through the winding is the same as shown in Figure 1. Motor rotation continues by repeating the process.

The number of steps can be increased furthermore by using two windings which are energized at the same time. In this case stepper motor rotation is performed in half-steps. When increasing the number of claws, a higher number of steps can be realized.

Rev. A - Endgltig 04.04.2003

32/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.1.3

Operator control and monitoring of the application with the TD200 text display unit Operator control and monitoring is performed with the help of a simple text display unit type "TD200". The TD200 unit is connected to the (PPI-) interface of the S7-CPU 222 with a PPI cable.
Table 4-2
Display

HMI displays and their functions


Display no. Function description

Automatic/jog mode B1

Shows the current position and the current speed. The automatic mode of the application can be enabled or disabled. Manual feed movement is possible when the automatic mode is disabled. This display is used to define the profile and the length. This display shows the current status of the application.

Selecting and setting profiles Status information on the operational condition Setting the first cut
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

B2 B3

B4

In this display you can start feed motion of the cardboard, until it is registered by a sensor (e.g. a light barrier or a Sonar-BERO) directly behind the cutting unit.

You can jump between all display from any position by pressing the Shiftkey and then the button for the display to be shown.
Table 4-3 Shortcuts for display selection
Shift and button Shift + F1 Shift + F2 Shift + F3 Shift + F4 corresponds to F5 F6 F7 F8 Display Automatic/jog mode Selecting and setting profiles Status display Setting the first cut

Configuration can be performed in the "S7-Micro/Win" development environment of the S7-200 CPUs without requiring an additional software program. Configuration is supported by an assistant program which is located in the data memory of the PLC.

Rev. A - Endgltig 04.04.2003

33/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.2

Program and data structure


This chapter explains the program and data structure of the S7-Micro/Win program which is stored on the S7-CPU 222. The structure of the functions located on the S7-CPU 222 have already been explained in Chapter 4.1.2. The structure of the S7-Micro/Win program is as follows:

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-13

Overview of the S7-Micro/Win program structure

Legend:
Color Meaning

Data block / variables used Subroutines generated by the positioning assistant Activated sub-programs Symbolizes STEP1_MAIN including all sub-programs

The individual program blocks are described in the following sections:

Rev. A - Endgltig 04.04.2003

34/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.2.1

Organization block " STEP1_MAIN "

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Fig. 4-14

Structure of organization block STEP1_MAIN

Organization block STEP1_MAIN is processed in each cycle of the CPU. This block is mainly used to activate sub-programs (which are described in the following). The following steps are successively processed in block STEP1_MAIN: Call of the sub-program " STEP1_MOTION " (network 1) The bit used to enable/disable the automatic mode is reset in the first cycle of the CPU to prevent unintended machine start when the CPU is booted anew (network 2). Call of the sub-program "STEP1_MSELECT" (network 3). Call of the sub-program "STEP1_PSELECT" (network 4).

Rev. A - Endgltig 04.04.2003

35/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Selection of profile 0 in the first CPU cycle, i.e. after restart of the CPU profile 0 shall be active in any case, not the profile selected before "CPU Stop"! (network 5). Call of sub-program "STEP1_FCUT" (network 6). Call of sub-program "STEP1_STATUS" (network 7). The last action during a cycle is always a reset of the button flag of the TD200 text display unit. (For each button operated the TD200 assigns a certain bit which is stored in the TD200-Wizard flag area. This bit is not reset after "release" of the key.)

4.2.2

Subroutine " STEP1_MOTION "

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-15

Structure of the sub-program "STEP1_MOTION"

The sub-program " STEP1_MOTION " realizes the functions required for the automatic and manual operating modes. The length used in the automatic operation mode is received from a separate sub-program named "STEP1_PSELECT".

Rev. A - Endgltig 04.04.2003

36/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Initialization of the positioning module by calling the sub-program "POS0_CTRL" (generated by the positioning assistant) (network 1). Transfer of pulse release for the FM STEPDRIVE power section; the system checks whether an "enabled" status is present at input E0.0 of the CPU (network 2). The automatic operation mode is enabled and disabled by pressing buttons 1 and 2 on the TD200 unit (network 3 and 4). Feed motion is activated by calling the sub-program "POS0_GOTO", if automatic mode has been enabled and after a cutting operation has been completed (network 5). Simulation of the cutting process; this is effected by using a timer with a delay of 1 second to simulate the cutting process (network 6 and 7). If the automatic mode is not active, manual operation can be performed by calling the sub-program "POS0_MAN".

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

4.2.2.1

Subroutine "POS0_CTRL" (generated by the positioning assistant) The sub-program "POS0_CTRL" activates and initializes the positioning module. This is effected by automatically transmitting a command to the positioning module to load the configuration/profile table each time when the S7-200 changes to the operating state RUN.

4.2.2.2

Subroutine "POS0_DIS" (generated by the positioning assistant) The sub-program POS0_DIS is used to enable or to disable the DIS output of the positioning module. This allows to use this output for the pulse release for the FM STEPDRIVE power unit.

4.2.2.3

Subroutine "POS0_GOTO" (generated by the positioning assistant) The operation POSx_GOTO transmits a command to the positioning module to move to the desired position.

4.2.2.4

Subroutine "POS0_MAN" (generated by the positioning assistant) The sub-program POS0_MAN (manual operation) sets the positioning module to manual operation mode. In this mode the motor can be operated at different rotational speeds or in jog mode in positive or negative direction. This sub-program is called from the two sub-programs "STEP1_MOTION" and "STEP1_FCUT".

Rev. A - Endgltig 04.04.2003

37/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.2.3

Subroutine "STEP1_MSELECT"

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-16

Structure of the sub-program "STEP1_MSELECT"

The sub-program "STEP1_MSELECT" is used to process the call commands of the four display messages available in the TD200 text display unit. The bits of the button flags are reset by pressing the Shift button and one of the button 1 4. These are then evaluated by the sub-program "STEP1_MSELECT" and the corresponding displays are loaded. In the first CPU cycle the display "Motion Control" is set as start message. In the first CPU cycle, the message (display on the user interface of the TD200) "Motion Control" is set (network 1). When Shift and button 1 are pressed and if the message bit for "Motion Control" is set, all other message bits are reset (network 2). When Shift and button 2 are pressed and if the message bit for "Select Profile" is set, all other message bits are reset (network 3). When Shift and button 3 are pressed and if the message bit for "Status" is set, all other message bits are reset (network 4). When Shift and button 4 are pressed and if the message bit for "First Cut" is set, all other message bits are reset (network 5). At the end of the sub-program, all 4 button flags of the TD200 unit are reset.
Rev. A - Endgltig 04.04.2003 38/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.2.4

Subroutine "STEP1_PSELECT"

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-17

Structure of the sub-program "STEP1_PSELECT"

The different cutting lengths or profiles are selected via the TD200 by means of a variable which is analyzed in the sub-program "STEP1_PSELECT". Compare the profile variable of the TD200 with the value of the corresponding profile; the profile bit will be set, when the two values are identical (networks 1-3). Check whether the entered values are correct; if a non-existent profile is entered, the next valid profile will be selected (network 4). If a profile is active, the profile length must be transferred to the variable for the cutting length (networks 5-7). The profile length must be shown on the display (network 8). If a new length for a profile has been entered, this length must be copied to the corresponding profile memory location (networks 9-11). Reset of the bit to show on the TD200 text display that the "variable is completed".

Rev. A - Endgltig 04.04.2003

39/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.2.5

Subroutine "STEP1_FCUT"

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-18

Structure of the sub-program "STEP1_FCUT"

Pressing button 1 initiates feed movement to the sensor (network 1). A signal from the sensor stops feed movement (network 2). Feed movement is activated by calling the sub-program "POS0_MAN" (the sub-program gives the command 'RUN' until the sensor signal is active) (network 3). After a short waiting period (brake operation), the sub-program "POS0_LDPOS" is executed and the current position 0 is loaded (network 4). Timer to wait until brake operation is completed (network 5). If the timer period has elapsed, set the command "load 0 for current position" (network 6). Reset of the command "load 0 for current position", after a positive feedback signal has been received from the sub-program "POS0_LDPOS". 4.2.5.1 Subroutine "POS0_MAN" (generated by the positioning assistant) The sub-program POS0_MAN (manual operation) sets the positioning module to manual operation mode. In this mode the motor can be operated at different rotational speeds or in jog mode in positive or negative direction. This sub-program is called from the two sub-programs "STEP1_MCONTROL" and "STEP1_FCUT".

Rev. A - Endgltig 04.04.2003

40/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

4.2.5.2

Subroutine "POS0_LDPOS" (generated by the positioning assistant) The sub-program POS0_LDPOS (load position) sets the current position value in the positioning module to a new value. You may also use this operation to define a new zero position for an absolute travel command.

4.2.6

Subroutine "STEP1_STATUS"

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 4-19

Structure of the sub-program "STEP1_STATUS"

Depending on the present status (analysis of the bits for "automatic mode", "feed movement under sensor", ...) the text strings saved in the data blocks are copied to the data area of the TD200.

4.2.7

Variables used in the program This chapter includes a list of all variables used in the program. The data block includes, among other things, the command interface of the positioning block and the parameters used in the application. The table of variables below is broken down into four categories: parameters internal variables command/status interface memory area in the data block used by the configuration of the positioning module and by the TD200 text display. The designations of the variables are symbolic names and/or are explained in a supplementary comment. Furthermore, the list includes the type and kind of variables, as well as the blocks with read or write access to these variables.

Rev. A - Endgltig 04.04.2003

41/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Description of variables No. Symbolic name Cutting Comment This bit simulates the "duration" of the cutting process This input initiates pulse release for the FM STEPDRIVE The sensor is placed directly behind the cutting block and transmits a signal to this input This input is connected with the ready-for-operation bit (output) of the FM STEPDRIVE Simulates the time required for cutting The delay time required between stop of feed motion and actual machine stop (runout) Bit Bit Bit Bit Bit When this bit is set, the program is in automatic operation mode When this bit is set, the program is in the machine setting mode (feed motion to the cutting block) Bit Type

Type and kind of variable I/Os Q0.0 Flag Timer DB STEP1_ MAIN

Program block with access to the variable (R=read, W=write) STEP1_ MOTION STEP1_ MSELECT STEP1_ PSELECT STEP1_ FCUT STEP1_ STATUS POS0_XXX

1 Ein- und Ausgnge

W R R R R
T33 T37

Enable_STEPPDRIVE Sensor

I0.0 I0.3

STEPDRIVE_ready

I0.4

5 Timer

Time_for_cutting Time_drive_runout

RW RW
V3.0 V3.1 V3.2 V3.3 V3.4 V3.5

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

7 8 Status/Kommandos 9 10 11 12

Set_LDPos_to_0 Done_LDPos Done_Pos_Goto Direction_Pos Done_Pos_CTRL GO

RW R R W W W W RW R R

Status/Ko mmandos

13

search

Bit

V3.6

RW

Rev. A - Endgltig 04.04.2003

42/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Description of variables No. Symbolic name Profile_0_on Profile_1_on Profile_2_on MES_Search MES_Status MES_Profile MES_Motion_CTRL Error_pos Speed_Pos Position_Pos Comment Status: profile 0 is selected Status: profile 1 is selected Status: profile 2 is selected Status: display "move to cutter block sensor" is active Status: display Status is active Status: display "Select profile " is active Status: display "Motion Control is active Status of the positioning blocks Status: current speed of the stepper motor Status: current position of the stepper motor Type Bit Bit Bit Bit Bit Bit Bit Byte Real Real Word INT Real Real

Type and kind of variable I/Os Flag Timer DB V10.0 V10.1 V10.2 V314.4 V314.5 V314.6 V314.7 VB4 VD24 VD28 VW0 VB392 VD340 VD350 STEP1_ MAIN

Program block with access to the variable (R=read, W=write) STEP1_ MOTION STEP1_ MSELECT STEP1_ PSELECT STEP1_ FCUT STEP1_ STATUS POS0_XXX

14 15 16 17 18 19 20 21 22 23 24
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

RW RW RW W W W W W W W

Reference to the configuration block of the TD200 unit B&B, Bedienen und Beobachten Selected_profile TD200_position TD200_Speed HMI: used to select the profile HMI: this variable indicates the position on the TD200 display HMI: this variable indicates the speed on the TD200 display HMI: this variable indicates the length of the current profile on the TD200 display These marker bits represent the buttons of the TD200 unit

25 26 27

R W W W W W W R R R R

B&B, Bedienen und Beobachten

28 29 30 31

TD200_profile_length Button_1 Button_2 Button_3

Real M16.0 M16.1 M16.2

VD408

Rev. A - Endgltig 04.04.2003

43/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Description of variables No. Symbolic name Button_4 Shift+Button_1 Shift+Button_2 Shift+Button_3 Shift+Button_4 Status text for TD200, 20 bytes Status text for TD200, 20 bytes Status text for TD200, 20 bytes Status text for TD200, 20 bytes Status text for TD200, 20 bytes Status text for TD200, 20 bytes P0_length Interne Variablen P1_length Memory location of the length of profile 0 Memory location of the length of profile 1 Memory location of the length of profile 2 String String String String String String Real Real Comment Type

Type and kind of variable I/Os Flag M16.3 M16.4 M16.5 M16.6 M16.7 VB50 VB70 VB90 VB110 VB130 VB150 VD12 VD16 Timer DB STEP1_ MAIN

Program block with access to the variable (R=read, W=write) STEP1_ MOTION STEP1_ MSELECT STEP1_ PSELECT STEP1_ FCUT STEP1_ STATUS POS0_XXX

32 33 34 35 36 37 38 39 40 41 42 43 44
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

R RW RW RW RW

W W W W W W RW RW RW R W RW W W RW RW

45

P2_length

Real

VD20

46 Interne Variablen 47

length

Includes the length actually cut Real

VD40 VB190 bis VB299 VB300 bis VB474

Area of the configuration block for the EM253 positioning module; generated by the positioning wizzard Area of the configuration block for the TD200 text display unit; generated by the TD200 assistant program

48

Rev. A - Endgltig 04.04.2003

44/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Rev. A - Endgltig 04.04.2003

45/81

Part B: Installation of the Example Application


Objectives of Part B: Part B of this document provides the reader with information on the following topics: how to install the example application with all hardware and software components how to use and control the application by using the TD200 unit

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Installation of Hardware and Software


The entire application is based on the components stated in chapter 2.2 (standard and special application components) and is ready for use immediately after installation. The actual commissioning work includes: installation of the hardware components (Chapter 5.1) software installation and parameter setting for the FM STEPDRIVE (chapter 5.2).

5.1

Hardware configuration
For details on the required hardware components, please refer to chapter 2.2.1.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Hardware installation includes mainly the following steps: mechanical installation of the S7-200 CPU with positioning module EM253 (see chapter 5.1.1) mechanical installation of the FM-STEPDRIVE power section (see chapter 5.1.2) electrical cable connection of the components and of the stepper motor (see chapter 5.1.3) All these steps are described in detail in the following sections.

Rev. A - Endgltig 04.04.2003

47/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.1.1

Installation of the S7-200 CPU and the EM253 positioning module The table below describes all measures required for installation step-bystep.

Table 5-1
Step 1 Focus

Step-by-step installation instructions for the CPU and the positioning module
Instruction Open the snap-on hook on the rear side of the S7-200 CPU and place the CPU rear side on the top-hat rail. Swivel down the CPU towards the top-hat rail until it snaps into place and close the hook. Make sure that the hook snaps in and that the CPU is properly seated on the top-hat rail. Open the snap-on hook on the rear side of the positioning module and hang it to the top-hat rail with its rear side. Mounting the S7-200 CPU

Hanging the EM253 positioning module to the top-hat rail

Producing the bus conConnect the flat bus cable of the positioning module to the expansion socket nection between positioning of the S7-CPU (beneath the front door). module and S7-200 CPU Fixing the EM 253 positioning module to the top-hat rail Swivel the module downwards towards the top-hat rail until it clearly snaps in and close the hook. Make sure that the hook also snaps in properly and that the positioning module is correctly seated on the top-hat rail.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

5.1.2

Installation of the FM STEPDRIVE The table below describes all measures required for installation step-bystep.

Table 5-2
Step 1 2 Focus

Step-by-step installation instructions for the FM STEPDRIVE


Action Hang the FM STEPDRIVE to the S7-300 mounting rail and swivel it downwards. See illustration below. Fix the FM STEPDRIVE with the two screws on the bottom of the device. See illustration below. Placing the FM STEPDRIVE Fixing the FM STEPDRIVE with screws

Figure 5-1

Mounting the FM STEPDRIVE

Rev. A - Endgltig 04.04.2003

48/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.1.3

Electrical connection of the components The following steps are to be performed for electrical cable connection: Connect the S7-200 CPU to mains voltage (see chapter 5.1.3.1) Connect the positioning module to the load current supply of the S7-222 CPU (see chapter 5.1.3.2) Connect the TD200 with the S7-222 CPU (see chapter 5.1.3.3) Connect the FM STEPDRIVE power unit with the CPU and the positioning module EM253 (see chapter 5.1.3.4) Connect the FM STEPDRIVE to mains voltage (see chapter 5.1.3.5) Connect the stepper motor to the FM STEPDRIVE (see chapter 5.1.3.6) Connect the sensor to the S7-222 CPU (see chapter 5.1.3.7)

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

5.1.3.1

Connecting the S7-200 CPU to mains voltage

Table 5-3
Step 1 Focus

Step-by-step instructions to connect the S7-222 CPU to voltage


Instruction From the photo below you can see how the CPU is connected to mains voltage supply. Connecting the CPU to mains voltage

Figure 5-2 Connecting the S7-200 CPU to mains voltage

Rev. A - Endgltig 04.04.2003

49/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.1.3.2
Table 5-4
Step 1

Connecting the EM253 positioning module to the load current supply of the CPU
Step-by-step instructions for connecting the positioning module to voltage supply
Focus Connecting the positioning module to load current supply Instruction From the photo below you can see how the positioning module is connected to load current supply. Set the TD200 to transmission rate 19,2kBaud.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 5-3

Connecting the positioning module to load current supply

5.1.3.3
Table 5-5
Step 1

Connecting the TD200 unit with the S7-200 CPU


Step-by-step instructions for connection between the TD200 text display unit and the S7-222 CPU
Focus Connecting the text display unit to the CPU Instruction From the photo below you can see how the TD200 text display unit is connected to the CPU.

Figure 5-4

Connecting the TD200 text display unit to the CPU

Rev. A - Endgltig 04.04.2003

50/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Note The voltage supply for the text display unit is provided directly via the PPI cable of the PLC interface.

5.1.3.4

Connecting the FM STEPDRIVE power unit with the S7-200 CPU and the positioning module At the end of the table below you will find a circuit diagram for better overview of the cable connections to be produced.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Rev. A - Endgltig 04.04.2003

51/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration
Step 1 Focus Laying the data line for the positioning pulses between positioning module and power unit Instruction The cable used for the connection described here needs to be completed as follows: You need a Sub-D connector (see the list of components/accessories). This Sub-D connector is the counterpiece for the connector socket on the upper right side of the FM STEPDRIVE (pulse interface). This connector must be connected to the upper terminal strip of the positioning module; at this location no extra accessories are required, the cables are fixed with screws. Connect the cables as shown in the following table. FM STEPDRIVE POSITIONING MODULE

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

No. 1 2 3 4 5 6 7 2 Connecting the signal interface with the positioning module

Pin no. 1 2 3 8 9 10 11

Designation PULSE DIR ENABLE GND PULSE_N DIR_N ENABLE_N

Designation P0+ P1+ +5V and T1 M P0P1DIS POSITIONING MODULE

FM STEPDRIVE

Designation

Designation L+ (24V) und Gate_N L+ M (24V) M Ready_2 CPU I0.4

Table 5-6

Instructions for the connection of the FM STEPDRIVE with the S7-222 CPU and the positioning module

Rev. A - Endgltig 04.04.2003

52/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 5-5

Overview circuit diagram

Rev. A - Endgltig 04.04.2003

53/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.1.3.5
Table 5-7
Step 1

Connecting the FM STEPDRIVE to mains voltage


Instructions for connecting the FM STEPDRIVE to voltage supply
Focus Connecting the FM STEPDRIVE to mains voltage (230V) Instruction Connect the FM STEPDRIVE to voltage as shown in the illustration below.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 5-6 Connecting the FM STEPDRIVE to mains voltage

5.1.3.6
Table 5-8
Step 1

Connecting the stepper motor to the FM STEPDRIVE power unit


Instructions for connecting the FM STEPDRIVE to the SIMOSTEP stepper motor
Focus Connecting the FM STEPDRIVE with the stepper motor Instruction Connect the stepper motor to the FM STEPDRIVE as illustrated below.

Figure 5-7 Connecting the FM STEPDRIVE to the stepper motor

Rev. A - Endgltig 04.04.2003

54/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.1.3.7

Connecting the sensor for cardboard registration on the cutting block

Important
The sensor used to register the cardboard beneath the cutting block is not part of the application solution; only the digital input is "operated" at 24V.

The sensor is used to register the cardboard directly behind the cutting block. This enables to position the cardboard exactly beneath the cutting block before starting automatic operation. Feed movement is performed automatically and stops as soon as the cardboard is registered by the sensor. See the illustrations below.
No. 1 Description After initial setup of the application, the cardboard position is not yet defined. Illustration

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

For this reason, the cardboard is moved beneath the cutting block for adjustment and the positioning counter is set to 0.

When the sensor detects the cardboard, it must issue a +24V signal and be connected to input I0.3. Connect the sensor to the CPU as shown below:

Figure 5-8

Connecting the sensor

Rev. A - Endgltig 04.04.2003

55/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.2

Software installation
Installation of the S7-Micro/Win software is not part of this documentation. Software installation is a self-explanatory procedure in the usual Windows environment.

5.2.1
Table 5-9
Step 1 2 3

Transfer of the application code to the S7-200 CPU


Instructions for the transfer of the application code to the S7-200 CPU
Focus Installing the S7-Micro/Win software Opening the project Setting the connection for communication Producing the cable connection Compiling and downloading into the CPU Connect TD200 Instruction Install the S7-Micro/Win software as described in the corresponding instruction manual. Open the application code in S7-Micro/Win. Select "File" from the menu bar and select "Open". Select the menu item "communication" from the operation tree. Enter the connection path in the dialog box and set your CPU correspondingly. Connect the S7-CPU 222 and the PU/PC with a cable line; you must remove the connector of the TD200 unit for the period of data transfer (since this port is used for the communications cable). Make sure that the cable connection complies with the parameter settings described in point 3.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

5 6

Click button "Compile all" in the toolbar. Then click the button "Download". After you project downloaded on the CPU connect TD200 to the PC/PPI-interface

Rev. A - Endgltig 04.04.2003

56/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

5.2.2
Table 5-10
Step 1

Parameter setting for the FM STEPDRIVE


Instructions for setting the parameters of the FM STEPDRIVE
Instruction

Focus Position of the setting parameters

Figure 5-9 2 Setting the current limit

Position of the setting parameters

Please set the parameters as shown below.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 5-10 Setting the current limit at the FM STEPDRIVE power unit 3 Setting the number of steps and current reduction for machine stop. Please set the parameters as shown below.

Figure 5-11 Setting the number of steps and current reduction at the FM STEPDRIVE

Note If you use a different motor than recommended for the hardware components, you must adjust the motor correspondingly at this point.

Rev. A - Endgltig 04.04.2003

57/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Operator Control via Text Display TD200


The conditions described in the chapter on "Installation of Hardware and Software" (chapter 5) must fulfilled and all devices must be switched on. This explanation includes all displays available for operator control and monitoring and all values and parameters. The start-up display of the human-machine interface (user interface for operator control and monitoring) is the "Automatic/Jog mode" display. This is the first display that appears after the CPU changes from the operating mode 'Stop" to 'Run'. When you press the "Escape" button during operation, the TD200 will change to the next higher (system) menu. In this menu you can choose between the following items: display of messages AS status display TD200 configuration

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Note This menu is mentioned only in order to provide a complete overview. For a detailed description please refer to the manual of the TD200 unit. (Here you can set the baud rate to 19,2kBaud)

Select the menu item for the display of messages to return to the display for application control. The individual screens are described in detail in the following sections.

6.1

Automatic/jog mode
This display is the user interface for motion control. You navigate into the picture through press the keys SHIFT and F1.

Figure 6-1

"Automatic/jog mode" (symbolic illustration)

Rev. A - Endgltig 04.04.2003

58/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

The top line shows the current position Pos:and the current speed Spd: (for feed motion) The buttons "Strt" and "Stp" are used to enable (Strt, F1) or to disable (Stp, F2) the automatic mode of the application. If the automatic mode is activated, the application starts to perform one cutting action, i.e. the first feed movement and the 2nd cutting operation have a defined length. If the automatic mode is disabled, feed movement can be performed manually using the keys "fwd" and "bwd". Button F3 (fwd) initiates forward feed movement, button F4 (bwd) backward feed movement.
Note If only one cut shall be performed, you can intervene manually by pressing the Stop button immediately after the Start button. The application will perform only one cut and will then stop the automatic operation mode.

DANGER
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

If the function Stp is operated, the application still drives the cycle begun up to the conclusion. The engine will NOT immediately switch off. for this functionality can the release (at I0.0) be taken.

The illustration below shows the technical process of the automatic mode.

Figure 6-2

Technical process of the automatic mode

Rev. A - Endgltig 04.04.2003

59/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

6.2

Selecting and setting profiles


This profile is used to select or change the length to be cut. You navigate into the picture through press the keys SHIFT and F2.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 6-3

"Automatic/jog mode" (symbolic illustration)

The interface is divided up into two parts the first line is used for profile selection, the second line to define the length. When having selected this screen, you will see the message shown in the above illustration. When you press "Enter" you can set the profile ("Select Profile"). As already mentioned in the program description, the application offers selection between three profiles (from 0 to 2). The relevant number is signalled by a flashing box and can be changed by pressing the buttons "" (arrow up) and "" (arrow down). Press "Enter" to confirm the selected value. Now the setting field on the selected length value starts flashing. If you don't wish to change the length, press "Escape". If you wish to change the length, repeat the procedure of the previous paragraph (buttons ""[arrow up] and "" [arrow down]. Use the buttons "Shift+" [arrow up} or "Shift+" [arrow down] to enter the next digit. Press "Enter" to confirm the newly defined length; the display of the TD200 will then show the Reset-display. With the corresponding key shortcuts you can now call the displays for operation (e.g. Shift + F1 for Automatic/jog-mode).

Note If you select another profile or if you change the length while the application is in automatic mode, the new value will immediately be taken over in the process presently performed.

Rev. A - Endgltig 04.04.2003

60/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

6.3

Display of status information

This display shows the current status of the application. You navigate into the picture through press the keys SHIFT and F3.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 6-4

"Status" display (status: motion stopped, FM STEPDRIVE disabled)

The following application states are possible: Stop Automatic, cutting Automatic, feed motion Set first cut In addition, the lower line shows whether the FM STEPRIVE is ready for operation (FM STEPDRIVE ready).

Rev. A - Endgltig 04.04.2003

61/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

6.4

Setting the first cut


Before new start-up of the application (e.g. at the beginning of a work day or after a new delivery) it is necessary to cut the cardboard to a defined start length. This can be set in the following display. You navigate into the picture through press the keys SHIFT and F4.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 6-5

"Automatic/jog mode" (symbolic illustration)

Press "Now!" (F5) to start feed movement of the cardboard until it is registered by a sensor (e.g. a light barrier or a sonar-BERO) directly behind the cutting block. Then feed movement will be stopped and the current position is set to 0. When you start automatic operation now, the first cut will be performed. The cardboard has now a defined start. It may be necessary to set the position manually to 0 (e.g. after manual feed operation) using the button "Set0" (F4).

Rev. A - Endgltig 04.04.2003

62/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Part C: Program Description


Objectives of Part C: The purpose of this section is to explain the code details of some core elements in the program suggest where extensions might be useful Requirements This is not an introduction to the S7 Micro/Win programming languages AWL, KOP or FUP. Readers should be familiar with the basics of these languages. Before reading the code description, it may be useful to study the chapters of Parts A1 and A2.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Rev. A - Endgltig 04.04.2003

63/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Explanation of the main parts of the S7-Micro/Win program


This chapter provides you with some detailed information on the core program parts of this application. The structure of the whole program is discribed in chapter 4.3. The core program elements are the sub-programs: STEP1_MOTION STEP1_PSELECT They are used to realize the basic functions of the application. The functions "STEP_MSELECT", "STEP1_FCUT" and "STEP1_STATUS" are only supporting features which offer additional functions for the actual application solution. In-depth comments on all programs are provided in the application code.

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Note The program blocks generated by the positioning assistant are described in the documentation of the S7-CPU and in the online help information for S7-Micro/Win; for this reason, these topics are not dealt in further detail at this point.

The following sections provide detailed information on the above stated core program elements:

Rev. A - Endgltig 04.04.2003

64/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

7.1

Details on the sub-program STEP1_MOTION


All networks of this sub-program are illustrated and explained. Network 1

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 7-1

STEP1_MOTION network 1

In this network, the sub-program POS0_CTRL is called. It activates and initializes the EM253 positioning module. Its function is to load the configuration table of the positioning module from the data block into the module each time the CPU is started anew. Without this sub-program, the positioning module could not receive commands. In this network, the two output parameters for position (C_Pos) and speed (C-Speed) are written directly to the display variable of the TD200 configuration block. They can be seen on the "Automatic/jog mode" display.

Rev. A - Endgltig 04.04.2003

65/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 2

Figure 7-2
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

STEP1_MOTION network 2

This network is also used to call a sub-program of the positioning assistant. Pulse release of the FM STEPDRIVE (ENABLE) is given with the bit DIS_ON; this initiates a "READY" signal from the power unit (after approx. 500ms) at input I0.3 of the CPU and the stepper motor is energized. See the illustrations below:

or

Figure 7-3

Signal delay

Rev. A - Endgltig 04.04.2003

66/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 3

I0.4

Figure 7-4

STEP1_MOTION network 3

With this bit logic the application is set to automatic mode. When this program block is called the parameter Start# is transmitted in OB 1. It is active, when the display (message) automatic/jog mode has been selected while pressing button 1 simultaneously.
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

The automatic mode can be selected only, if the power unit is ready for operation ("READY").

Network 4

I0.4

Figure 7-5

STEP1_MOTION network 4

This bit logic is used to re-set automatic mode. When this program block is called the parameter STOPP# is transmitted in OB 1. It is active, when the display (message) automatic/jog mode has been selected while pressing button 2 simultaneously. The automatic mode will be re-set, if the power unit is not ready for operation ("READY").

Rev. A - Endgltig 04.04.2003

67/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 5

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 7-6

STEP1_MOTION network 5

The actual automatic feed motion is realized in this network by calling the sub-program "POS0_CTRL" generated by the positioning assistant. Feed operation is started by means of a negative edge (after completion) of the cutting action. The automatic mode must be active and the power unit must be ready for operation. As long as the application is in the "Set-up mode", start of feed motion will be blocked. Network 6

Figure 7-7

STEP1_MOTION network 6

Rev. A - Endgltig 04.04.2003

68/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

After successful feed movement or after the system has been set to automatic mode, the cutting operation will be simulated.

Network 7

Figure 7-8
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

STEP1_MOTION network 7

The simulated cutting process is shown on output Q0.0 (Cutting).

Rev. A - Endgltig 04.04.2003

69/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 8

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 7-9

STEP1_MOTION network 8

Manual feed control is enabled by calling this sub-program generated by the positioning assistant. Manual control of the power unit is only possible when Automatic/jog mode is indicated on the operator display and when the power unit is ready for operation (Ready_2 of FM STEPDRIVE). If the application is in setting mode, manual operation is not possible.

Rev. A - Endgltig 04.04.2003

70/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

7.2

Details on the sub-program STEP1_PSELECT


All networks of this sub-program are illustrated and explained.

Network 1

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Figure 7-10

STEP1_PSELECT network 1

Compares the value of the selected profile (byte) and sets the bit of the selected profile correspondingly.

Network 2

Figure 7-11

STEP1_PSELECT network 2

Compares the value of the selected profile (byte) and sets the bit of the selected profile correspondingly.

Rev. A - Endgltig 04.04.2003

71/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 3

Figure 7-12

STEP1_PSELECT network 3

Compares the value of the selected profile (byte) and sets the bit of the selected profile correspondingly.
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Network 4

Figure 7-13

STEP1_PSELECT network 4

If a profile 3 is selected, the highest profile will be selected automatically.

Rev. A - Endgltig 04.04.2003

72/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 5

Figure 7-14
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

STEP1_PSELECT network 5

If profile 0 has been selected, the length stored in the profile memory area will be copied into the field for the length to be cut.

Network 6

Figure 7-15

STEP1_PSELECT network 6

If profile 1 has been selected, the length stored in the profile memory area will be copied into the field for the length to be cut.

Rev. A - Endgltig 04.04.2003

73/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 7

Figure 7-16

STEP1_PSELECT network 7

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

If profile 2 has been selected, the length stored in the profile memory area will be copied into the field for the length to be cut.

Network 8

Figure 7-17

STEP1_PSELECT network 8

The presently applicable cutting length is copied to the display variable of the TD200 and can be seen on the "Select profile" display.

Rev. A - Endgltig 04.04.2003

74/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 9

Figure 7-18

STEP1_PSELECT network 9

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

If the system detects (through a notification bit) that a new value has been entered for the display variable "length", this value will be copied to the profile memory location 0, if this profile is active.

Network 10

Figure 7-19

STEP1_PSELECT network 10

If the system detects (through a notification bit) that a new value has been entered for the display variable "length", this value will be copied to the profile memory location 1, if this profile is active.

Rev. A - Endgltig 04.04.2003

75/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Network 11

Figure 7-20

STEP1_PSELECT network 11

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

If the system detects (through a notification bit) that a new value has been entered for the display variable "length", this value will be copied to the profile memory location 2, if this profile is active.

Network 12

Figure 7-21

STEP1_PSELECT network 12

The notification bit for changing the display variables will be re-set after the sub-program has been completed.

Rev. A - Endgltig 04.04.2003

76/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

Modifying the S7-Micro/Win Program


This chapter describes four possible scenarios as examples of how the application can be adjusted to your individual requirements: changing the parameters for motion (chapter 8.1) increasing the number of profiles (see chapter 8.2) changing the feedrate of the cardboard (see chapter 8.3) using different types of stepper motors (see chapter 8.4).

8.1

Changing the parameters for motion


In this chapter you will learn how you can adjust the parameters for motion (referring to the present configuration of the positioning module) to your specific requirements. Important parameters for motion are, for example:

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

minimum speed of the stepper motor maximum speed of the stepper motor speed in jog mode acceleration and delay time pulses required for one revolution of the stepper motor desired unit of measure relation of the pulses required for one revolution and the unit of measure used

Note This description refers only to part of the parameters of the positioning module.

Rev. A - Endgltig 04.04.2003

77/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration Table 8-1
Step 1 Focus Opening the project

Procedure to adjust the motion parameters (configuration of the EM253 positioning module ) to customer-specific basic data.
Instruction Open the application code in S7-Micro/Win. Select "File" from the menu bar and select "Open".

Opening the positioning assistant

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Selecting the positioning module

The system will lead you through the corresponding configuration dialog boxes. There you can change the parameters to suit your specific requirements. Please note that you should change only those parameters related to motion and mechanical operations! Setting the connection for communication Producing the cable connection Compiling and downloading into the CPU

Select the menu item "communication" from the operations tree. Enter the connection path in the dialog box and set your CPU correspondingly. Connect the S7-CPU 222 and the PU/PC with a cable line; you must remove the connector of the TD200 unit for the period of data transfer (since this port is used for the communications cable). Make sure that the cable connection complies with the parameter settings described under point 5. Click button "Compile all" in the toolbar. Then click the button "Download" .

Rev. A - Endgltig 04.04.2003

78/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

8.2

Increasing the number of profiles


The application offers three profiles. In this chapter you will learn how you can increase the number of profiles. Selection and changes to profiles is realized in the sub-program STEP1_PSELECT, which is to be modified if more profiles are to be integrated.

Note This chapter does not include information on how program changes can be reprogrammed again; it contains only the principle procedure how a further profile can be added.

For each profile to be added you require the following variables: profile memory location: type Real
Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

profile active: type bit


Step 1 2 Focus Opening the project Change to the sub-program "STEP1_PSELECT" Extending the profile active analysis Description Open the application code in S7-Micro/Win. Select "File" from the menu bar and select "Open". Double-click the sub-program STEP1_PSELECT (SBR2) in the operations tree. The "profile variable" entered in the TD200 unit is analyzed in the networks 1-3. Here you must add a further network used to activate the new profile. If comparison shows that this profile is selected, the "profile active"-bit will be set. In network 4 of this sub-program a comparison is performed to check whether the variable is beyond the area of the defined profiles; in this case the highest profile will be selected. Change the value for the number of profiles in this field. In networks 5, 6 and 7 the length stored in the profile memory area is copied as the variable for the length to be cut. This is also required for your new profile; add one routine for your profile which corresponds to the networks 5, 6 and 7. Networks 9, 10 and 11 copy a newly defined length for the active profile to the corresponding profile memory location. The new profile also requires a network for copying. Select the menu item "Communication" from the operations tree. Enter the connection path in the dialog box and set your CPU correspondingly. Connect the S7-CPU 222 and the PU/PC with a cable line; you must remove the connector of the TD200 unit for the period of data transfer (since this port is used for the communications cable). Make sure that the cable connection complies with the parameter settings described under point 3.
Click button "Compile all" in the toolbar. Then click the button "Download" .

Detection of wrong entries

Using the length stored in the profile memory location as the cutting length Copying the new length to the profile memory location Setting the connection for communication

6 7

Producing the cable connection

Compiling and downloading into the CPU

Rev. A - Endgltig 04.04.2003

79/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

8.3

Changing the feedrate


This chapter explains how you can change the feedrate of the cardboard. The feedrate is set in the sub-program STEP1_MOTION in network 5 and in the sub-program STEP1_FCUT in network 3. The items to be changed are marked in the following illustration.
Subroutine Illustration

STEP1_MOTION network 5

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

STEP1_FCUT network 3

Figure 8-1

Text

Rev. A - Endgltig 04.04.2003

80/81

Controlled Positioning of an Axis with Stepper Motor Using the Example of a "Cutting-to-Length" Process incl. HMI Configuration

8.4

Use of other motor versions


This chapter informs you about the points to be considered when using a different type of motor. If you use a different type of a SIMOSTEP stepper motor, you should adjust the current limit of the power unit to the specific motor. The steps required to set the motor current are described in chapter 5.1.3 which includes details on the parameter setting for the FM STEPDRIVE (Table 5-9).

Table 8-2
Stepper motor type Torque (Nm)

Possible torques of the SIMOSTEP stepper motors


1FL3041 2 1FL3042 4 1FL3043 6 1FL3061 10 1FL3062 15

Copyright Siemens AG 2003 All rights reserved SEC_0352_Gest_Pos_Schritt_DOKU_v00_e.doc

Rev. A - Endgltig 04.04.2003

81/81

You might also like