s7 sd2 service channel - sieb-meyer.de · 5.3.1 examples of the ... sieb & meyer adapter to a...

34
Drive System SD2 S7 SD2 Service Channel Description of Profibus to support the protocol for the service channel P-TD-0000319.1 2012-10-25 SIEB & MEYER W

Upload: vohuong

Post on 04-Jul-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Drive System SD2S7 SD2 Service ChannelDescription of Profibus to support the protocol for the service channel

P-TD-0000319.12012-10-25

SIEB & MEYERW

Page 2: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

CopyrightCopyright © 2012 SIEB & MEYER AG.

All rights reserved.

This manual or extracts thereof may only be copied with the explicit authorization ofSIEB & MEYER AG.

TrademarksAll product, font and company names mentioned in this manual may be trademarks or registeredtrademarks of their respective companies.

SIEB & MEYER worldwideFor questions regarding our products and technical problems please contact us.

SIEB & MEYER AGAuf dem Schmaarkamp 21D 21339 LüneburgGermany

Phone: +49 4131 203 0Fax: +49 4131 203 [email protected]://www.sieb-meyer.com

SIEB & MEYER Shenzhen Trading Co. Ltd.1st floor, B room of D1 block, DongNan GongMaoBuildingDongjiaotou Shekou, Houhai Ave, Nanshan DistrictShenzhen City, 518067P.R. China

Phone: +86 755 2681 1417 / +86 755 2681 2487Fax: +86 755 2681 [email protected]://www.sieb-meyer.com

SIEB & MEYER Asia Co. Ltd.4 Fl, No. 532, Sec. 1Min-Sheng N. RoadKwei-Shan Hsiang333 Tao-Yuan HsienTaiwan

Phone: +886 3 311 5560Fax: +886 3 322 [email protected]://www.sieb-meyer.com

SIEB & MEYER USA, LLC3975 Port Union RoadFairfield, OH 45014USA

Phone: +1 513 563 0860Fax: +1 513 563 [email protected]://www.sieb-meyer.com

W

2 Drive System SD2 - S7 SD2 Service Channel

Page 3: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Description of the Program S7_SD2_Service 1

Program Content 2

Program Control 3

Symbols 4

Application of Data Blocks 5

Programming the SERVOLINK 4 gateway 6

Hardware Description 7

Error Detection 8

SERVOLINK 4 gateway Test Assembly 9

Related Documents 10

W Chapter Overview

Drive System SD2 - S7 SD2 Service Channel 3

Page 4: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Chapter Overview W

4 Drive System SD2 - S7 SD2 Service Channel

Page 5: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

1 Description of the Program S7_SD2_Service ................... 71.1 Installation ................................................................................................... 7

2 Program Content ............................................................... 92.1 Organization block ...................................................................................... 92.2 Function Blocks ........................................................................................... 92.3 Global Data Blocks ..................................................................................... 92.4 Instance Data Blocks .................................................................................. 92.5 User-defined Data Types .......................................................................... 102.6 Inputs ........................................................................................................ 102.7 S7 System Functions and S7 System Function Blocks ............................ 10

3 Program Control .............................................................. 113.1 Organization block OB_MAINPROG ......................................................... 113.2 Function Blocks ......................................................................................... 113.2.1 Function blockFB_SwapINT .................................................................................. 113.2.1.1 General Description .............................................................................................. 113.2.1.2 Calling the Function Block ..................................................................................... 113.2.1.3 Inputs and Outputs ................................................................................................ 113.2.2 Function blockFB_SwapDINT ............................................................................... 113.2.2.1 General Description .............................................................................................. 113.2.2.2 Calling the Function Block ..................................................................................... 123.2.2.3 Inputs and Outputs ................................................................................................ 123.2.3 Function blockFB_InitData .................................................................................... 123.2.3.1 General Description .............................................................................................. 123.2.3.2 Calling the Function Block ..................................................................................... 123.2.3.3 Inputs and Outputs ................................................................................................ 123.2.4 Function blockFB_ReadObject .............................................................................. 123.2.4.1 General Description .............................................................................................. 123.2.4.2 Calling the Function Block ..................................................................................... 123.2.4.3 Inputs and Outputs ................................................................................................ 133.2.5 Function blockFB_SetArrayIndex .......................................................................... 133.2.5.1 General Description .............................................................................................. 133.2.5.2 Calling the Function Block ..................................................................................... 133.2.5.3 Inputs and Outputs ................................................................................................ 133.2.6 Function blockFB_WriteObject .............................................................................. 143.2.6.1 General Description .............................................................................................. 143.2.6.2 Calling the Function Block ..................................................................................... 143.2.6.3 Inputs and Outputs ................................................................................................ 143.3 Global Data Blocks ................................................................................... 143.3.1 Data BlockDB_ERRORCODE ............................................................................... 143.3.2 Data BlockDB_GLOBALDATA .............................................................................. 153.3.3 Data BlockDB_DRIVESTATE ............................................................................... 153.4 Instance Data Blocks ................................................................................ 153.5 User-defined Data Types .......................................................................... 153.5.1 User-defined Data Type TS_DRIVE_DATA_IN ..................................................... 163.5.2 User-defined Data Type TS_DRIVE_DATA_IN ..................................................... 163.5.3 User-defined Data Type TS_DRIVE_DATA_IN ..................................................... 163.5.4 User-defined Data Type TS_DRIVE_DATA_IN ..................................................... 163.5.5 User-defined Data Type TS_DRIVE_DATA_IN ..................................................... 173.6 System Functions and Blocks ................................................................... 17

4 Symbols .......................................................................... 19

W Content

Drive System SD2 - S7 SD2 Service Channel 5

Page 6: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

4.1 Symbol Table ............................................................................................ 19

5 Application of Data Blocks .............................................. 215.1 Hardware Configuration in the PLC .......................................................... 215.1.1 GSD File ................................................................................................................ 215.1.2 Settings in the Hardware Configuration ................................................................ 215.2 Defining the Addresses in the Modules .................................................... 225.3 Programming the Application Program ..................................................... 225.3.1 Examples of the Functions .................................................................................... 23

6 Programming the SERVOLINK 4 gateway ...................... 25

7 Hardware Description ...................................................... 277.1 Connecting the Devices ............................................................................ 27

8 Error Detection ................................................................ 298.1 Errors in S7 PLC ....................................................................................... 298.2 Error in SERVOLINK 4 gateway ............................................................... 298.3 Error in Drive Control SD2/SD2S .............................................................. 29

9 SERVOLINK 4 gateway Test Assembly .......................... 319.1 Front Panel Check of SIMATIC CPU ........................................................ 319.1.1 LED Display .......................................................................................................... 319.2 Drive Check .............................................................................................. 319.3 Object Access ........................................................................................... 31

10 Related Documents ......................................................... 33

Content W

6 Drive System SD2 - S7 SD2 Service Channel

Page 7: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

1 Description of the ProgramS7_SD2_ServiceThe program S7_SD2_Service makes it possible to connect a SD2/SD2S drive bySIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via a ProfibusDP SERVOLINK 4 adapter.

The program S7_SD2_Service has been created using the engineering tool S7-SCL V5.3. All data blocks necessary for the communication are involved in the pro‐gram. In addition the program provides system blocks of the S7, which are used duringthe process.

In order to use the program for the communication between S7 and the SD2/SD2Sdrive by SIEB & MEYER, you need the following hardware and software components:< SIMATIC STEP 7 starting form version 5.5< SIMATIC S7 300(/400) starting from CPU 315-2DP< SIEB & MEYER SERVOLINK 4 gateway< SIEB & MEYER SD2/SD2S

1.1 Installation✦ At first create a directory for the application program.

Example:D:\Data\Siemens\SM_AG\S7Prog\S7_SD2_Service✦ Copy the ZIP file of the program (e.g."S7_SD2_Service_V100.zip") into the created

directory.✦ Unpack the ZIP file.✦ Start the SIMATIC Manager.✦ Select the menu "File ÿ Open".✦ Click the button "Browse" to select the created directory and open the project

"S7_SD2_Service".

W Description of the Program S7_SD2_Service

Drive System SD2 - S7 SD2 Service Channel 7

1

Page 8: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Description of the Program S7_SD2_Service W

8 Drive System SD2 - S7 SD2 Service Channel

1

Page 9: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

2 Program ContentThe program S7_SD2_Service contains the following objects as SCL sources. As SCLsources they can be compiled to function and data blocks with the desired block num‐ber via the symbol table.

2.1 Organization blockSymbolic name Description

OB_MAINPROG Example main program

2.2 Function BlocksSymbolic name Description

FB_SwapINT Changes the byte order in the integer value

FB_SwapDINT Changes the byte order in the long integer value

FB_InitData Initialization of the process data

FB_ReadObject Reads an object from the drive

FB_SetArrayIndex Sets the array index counter in the drive

FB_WriteObject Writes on an object in the drive

2.3 Global Data BlocksSymbolic name Description

DB_ERRORCODE Error codes

DB_GLOBALDATA Global variables for adaptation to the own project

DB_DRIVESTATE List of the drive states

2.4 Instance Data BlocksSymbolic name Description

DB_SwapINT Instance data block for FB_SwapINT

DB_SwapDINT Instance data block for FB_SwapDINT

DB_InitData Instance data block for FB_InitData

DB_ReadObject0 Instance data block for FB_ReadObject

DB_SetArrayIndex0 Instance data block for FB_SetArrayIndex

DB_WriteObject0 Instance data block for FB_WriteObject

For additional drives you must create additional instance data blocks:< DB_ReadObjectX< DB_SetArrayIndexX< DB_WriteObjectX

W Program Content

Drive System SD2 - S7 SD2 Service Channel 9

2

Page 10: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

2.5 User-defined Data TypesSymbolic name Description

TS_DRIVE_DATA_IN Data structure of the received data from Profibus

TS_DRIVE_DATA_IN Data structure of the transmitted data to Profibus

TS_DRIVE_DATA_IN Data structure of the drive data

TS_DRIVE_DATA_IN Data structure of the setpoints

TS_DRIVE_DATA_IN Data structure of the actual values

2.6 InputsVariable Address Meaning

I_ReadObject I 0.4 Start: read object

I_WriteObject I 0.5 Start: write object

I_SetArrayIndex I 0.6 Start: set array index

2.7 S7 System Functions and S7 System FunctionBlocksFunction block Symbolic name Description

SFC14 DPRD_DAT Read DP slaves

SFC15 DPWR_DAT Write DP slave

Program Content W

10 Drive System SD2 - S7 SD2 Service Channel

2

Page 11: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

3 Program ControlThis chapter provides information on the individual blocks and their functions.

3.1 Organization block OB_MAINPROGThe program is controlled via the organization block OB_MAINPROG. The data fromthe bus is read, allocated to the drives, processed and written to the bus again. Theindividual program steps are processed by the function blocks.

Please note: At first the data must be copied from the Profibus module into the busstructure via SFC14 and at last the data must be copied from the bus structure back tothe Profibus module via SFC15.

Before the proper sequential control comes into operation, the data must be initializedones when the program is started or after a fault.

3.2 Function Blocks

3.2.1 Function blockFB_SwapINT

3.2.1.1 General DescriptionUsing the function block FB_SwapINT the byte order of an Integer value is swapped.

Byte order before: Byte0, Byte1

Byte order after: Byte1, Byte0

3.2.1.2 Calling the Function BlockFB_SwapINT.DB_FB_SwapINT

(value := DB_GLOBALDATA.SD2_Data[DrNo].OutData.ServiceIndex);

3.2.1.3 Inputs and Outputs

Parameter In / Out Type Description

value in_out INT Variable for swapping

3.2.2 Function blockFB_SwapDINT

3.2.2.1 General DescriptionUsing the function block FB_SwapDINT the byte order of a LongInteger value is swap‐ped.

W Program Control

Drive System SD2 - S7 SD2 Service Channel 11

3

Page 12: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Byte order before: Byte0, Byte1, Byte2, Byte3

Byte order after: Byte3, Byte2, Byte1, Byte0

3.2.2.2 Calling the Function BlockFB_SwapDINT.DB_FB_SwapDINT

(value := DB_GLOBALDATA.SD2_Data[DrNo].OutData.ServiceValue);

3.2.2.3 Inputs and Outputs

Parameter In / Out Type Description

value in_out DINT Variable for swapping

3.2.3 Function blockFB_InitData

3.2.3.1 General DescriptionBefore calling this block, the bus data must have been read once. Using the functionblock FB_InitData, the command bits are initialized and deposited in the drive structurevia the status bits of the drive. The reference values are initialized with the value zero.Afterwards the initializing data should be transmitted once.

3.2.3.2 Calling the Function BlockFB_InitData.DB_InitData (Drive := DB_GLOBALDATA.SD_Data[DrNo]);

3.2.3.3 Inputs and Outputs

Parameter In / Out Type Description

Drive in_out TS_DRIVE_DA‐TA_IN

Data structure of the drive

3.2.4 Function blockFB_ReadObject

3.2.4.1 General DescriptionThe function block FB_ReadObject allows read access to the object data of the drive.The document "Acyclic_Servolink_ServiceChannel.doc" provides information on thefunctional process of the access.

3.2.4.2 Calling the Function BlockFB_ReadObject.DB_ReadObject0

(Execute := TRUE, Drive := DB_GLOBALDATA.SD_Drive[DrNo], ObjectIndex := 69,ObjectSubindex := 0);

Program Control W

12 Drive System SD2 - S7 SD2 Service Channel

3

Page 13: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

3.2.4.3 Inputs and Outputs

Parameter In / Out Type Description

Drive in_out TS_DRIVE_DA‐TA_IN

Data structure of the drive

Execute in BOOL TRUE: Start of the function block

ObjectIndex in INT Index of the object

ObjectSubindex in DINT Subindex of the object

Busy out BOOL Function block is active

Done out BOOL Function block is ready

Error out BOOL Function block stopped due to error

ErrorID out WORD Error number

ReturnValue out DINT Return value of the reading process

3.2.5 Function blockFB_SetArrayIndex

3.2.5.1 General DescriptionThe function block FB_SetArrayIndex is used to set the subindex of an array object. Af‐terwards, during writing of the object, the subindex is increased automatically. Thedocument "Acyclic_Servolink_ServiceChannel.doc" provides information on the func‐tional process of the access. In order to set the array index to the first element, the call‐ing parameter must have the value 4.

3.2.5.2 Calling the Function BlockFB_SetArrayIndex.DB_SetArrayIndex0

(Execute := TRUE, Drive := DB_GLOBALDATA.SD_Drive[DrNo], ArrayIndex := 4);

3.2.5.3 Inputs and Outputs

Parameter In / Out Type Description

Drive in_out TS_DRIVE_DA‐TA_IN

Data structure of the drive

Execute in BOOL TRUE: Start of the function block

ArrayIndex in DINT Index

Busy out BOOL Function block is active

Done out BOOL Function block is ready

Error out BOOL Function block stopped due to error

ErrorID out WORD Error number

W Program Control

Drive System SD2 - S7 SD2 Service Channel 13

3

Page 14: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

3.2.6 Function blockFB_WriteObject

3.2.6.1 General DescriptionThe function block FB_WriteObject allows write access to the object data of the drive.The document "Acyclic_Servolink_ServiceChannel.doc" provides information on thefunctional process of the access.

3.2.6.2 Calling the Function BlockFB_WriteObject.DB_WriteObject0

(Execute := TRUE, Drive := DB_GLOBALDATA.SD_Drive[DrNo], ObjectIndex := 186,ObjectValue := 10000, ObjectNoOfBytes := 4);

3.2.6.3 Inputs and Outputs

Parameter In / Out Type Description

Drive in_out TS_DRIVE_DA‐TA_IN

Data structure of the drive

Execute in BOOL TRUE: Start of the function block

ObjectIndex in INT Index of the object

objectValue in DINT Value to be written

ObjectNoOfBytes in INT Number of valid bytes (1…4)

Busy out BOOL Function block is active

Done out BOOL Function block is ready

Error out BOOL Function block stopped due to error

ErrorID out WORD Error number

3.3 Global Data Blocks

3.3.1 Data BlockDB_ERRORCODEThe global data block DB_ERRORCODE contains the structure of the error codes thatare returned by the function block.

The error codes have the following meanings:Error code Value Meaning

ERR_None 0 No error

ERR_WrongState 1 The drive is in the wrong device status for the up‐coming command.

ERR_Parameter 2 Parameter error

ERR_SERVOLINK_Fault 6 SERVOLINK error

ERR_SERVOLINK_Slot 7 SERVOLINK slot error

Program Control W

14 Drive System SD2 - S7 SD2 Service Channel

3

Page 15: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

3.3.2 Data BlockDB_GLOBALDATAThe global data block DB_GLOBALDATA contains the structure of the program-rele‐vant data that must be adapted to the particular project.

The following variables are used:Variable Type Meaning

ReadValue DINT Array of the return values of the reading processes

SD_Drive TS_DRIVE_DA‐TA_IN

Array of the data structures of the projected drives

3.3.3 Data BlockDB_DRIVESTATEThe global data block DB_DRIVESTATE contains a list of the drive states according tothe drive protocol DS402.

State Value Meaning

STATE_Start 0 Start, initialization

State_NotReadyToSwitchOn 1 Not ready to be switched on

STATE_SwitchOnDisabled 2 Switch on disabled

STATE_ReadyToSwitchOn 3 Ready to be switched on

State_SwitchedOn 4 Switched on

State_OperationEnabled 5 Operation enabled

STATE_QuickStopActive 6 Quick stop

State_FaultReactActive 7 Fault reaction

State_Fault 8 Fault occurred

3.4 Instance Data BlocksOne instance data block is required for each function block. Each instance data blockcontains the input parameters, the output parameters, the in-out parameters and thestatic variables of the respective function block.

For several function blocks a set of instance data blocks is required per drive:< DB_ReadObjectX< DB_SetArrayIndexX< DB_WriteObjectX

3.5 User-defined Data TypesThe user-defined data types describe the data structure of each drive. These are theinput and output values of the Profibus data and the prepared setpoints and actual va‐lues.

The data can be accessed via the global variables.

The structures of the bus parameters are based on the CANopen protocol. The struc‐tures of the bus parameters are based on the CANopen protocol. A description of thetelegram structure is part of the documents "SD2_CAN-Connection.pdf" and "SD2_De‐viceControl.pdf".

W Program Control

Drive System SD2 - S7 SD2 Service Channel 15

3

Page 16: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

3.5.1 User-defined Data Type TS_DRIVE_DATA_INThe user-defined data type TS_DRIVE_DATA_IN contains the data structure of the re‐ceived data of a drive from Profibus.

Only the Bytes 10 to 15 matter for the acyclic service channel:Name Type Meaning

Process data byte 0..9 Cyclic process data

Service data byte 10..15

ServiceReturn DINT Return value / Error state

res14 BYTE Reserved

ServiceDoneToggle BOOL Return toggle bit

ServiceFault BOOL Error bit

smres152 to smres157 6 * BOOL Reserved

3.5.2 User-defined Data Type TS_DRIVE_DATA_INThe user-defined data type TS_DRIVE_DATA_IN contains the data structure of thetransmission data of a drive to Profibus.

Only the Bytes 10 to 15 matter for the acyclic service channel:Name Type Meaning

Process data byte 0..8 Cyclic process data

Service data byte 9..15

ServiceValidToggle BOOL Service toggle bit

ServiceFunction0 BOOL Function bit 0: read, write, array index

ServiceFunction1 BOOL Function bit 1: read, write, array index

ServiceByteIndex0 BOOL Byte number 0: 0..3

ServiceByteIndex1 BOOL Byte number 1: 0..3

smres095 to smres097 3 * BOOL Reserved

ServiceIndex INT Index of the object

ServiceValue DINT Object value / array index

3.5.3 User-defined Data Type TS_DRIVE_DATA_INThe user-defined data type TS_DRIVE_DATA_IN contains the data structure of thedrive data.

Name Type Meaning

init_ok BOOL TRUE: all parameters are initialized

ActValues TS_DRIVE_DATA_IN Actual values of the drive

Setpoints TS_DRIVE_DATA_IN Setpoints of the drive

InData TS_DRIVE_DATA_IN Data block (PB-DP->PLC)

OutData TS_DRIVE_DATA_IN Data block (PLC->PB-DP)

3.5.4 User-defined Data Type TS_DRIVE_DATA_INThe user-defined data type TS_DRIVE_DATA_IN contains the data structure of the set‐points of the drive.

Program Control W

16 Drive System SD2 - S7 SD2 Service Channel

3

Page 17: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Name Type Meaning

FaultReset BOOL TRUE = reset error

SwitchOn BOOL TRUE = switch on output stage

EnableOperation BOOL TRUE = enable operation

EnableVoltage BOOL TRUE = enable voltage

QuickStop BOOL FALSE = trigger quick stop

Velocity INT Setpoint velocity, max. 0x3FFF

Current INT Setpoint current, max. 0x3FFF

3.5.5 User-defined Data Type TS_DRIVE_DATA_INThe user-defined data type TS_DRIVE_DATA_IN contains the data structure of theprepared actual values of the drive.

Name Type Meaning

Status WORD Device status of the drive

Act_Position DINT Actual position

Act_Velocity INT Actual velocity

Act_Current INT actual current

3.6 System Functions and BlocksThe system functions SFC14 and SFC15 are used in the function blocks FB_ReadOb‐ject and FB_WriteObject to read and write data from and to Profibus.

The blocks of the S7 system functions are described in the according manuals by SIE‐MENS.

W Program Control

Drive System SD2 - S7 SD2 Service Channel 17

3

Page 18: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Program Control W

18 Drive System SD2 - S7 SD2 Service Channel

3

Page 19: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

4 SymbolsAll function and data blocks receive a block number during compiling. These blocknumbers can be assigned in the symbol table.

Then the blocks can be called using their numbers (DB10 or FB10) or their symbolnames (DB_InitData, FB_InitData).

4.1 Symbol TableAs an example in the following you see an extract of the symbol table including the as‐signment of the block numbers. Individual instance blocks are assigned to each drive.

Symbol Address Data type Comment

DB_ERRORCODE DB1 DB1 List of the error codes

DB_GLOBALDATA DB2 DB2 Global data

DB_DRIVESTATE DB3 DB3 List of the drive states

DB_InitData DB10 FB10 Instance data block

DB_SwapINT DB11 FB11 Instance data block

DB_SwapDINT DB12 FB12 Instance data block

DB_ReadObject0 DB30 FB30 Instance data block

DB_SetArrayIndex0 DB31 FB31 Instance data block

DB_WriteObject0 DB32 FB32 Instance data block

FB_InitData FB10 FB10 Initialization of process data

FB_SwapINT FB11 FB11 Swapping of an integer value (2 byte)

FB_SwapDINT FB12 FB12 Swapping of a long integer value (4 byte)

FB_ReadObject FB30 FB30 For request telegram: read object

FB_SetArrayIndex FB31 FB31 For request telegram: set array index

FB_WriteObject FB32 FB32 For request telegram: write object

OB_MAINPROG OB1 OB1 Main program

DPRD_DAT SFC14 SFC14 Read consistent data from a standard DPslave

DPWR_DAT SFC15 SFC15 Write consistent data to a standard DP slave

TS_DRIVE_DATA_IN UDT1 UDT1 Structure of the input data

TS_DRIVE_DATA_IN UDT2 UDT2 Structure of the output data

TS_DRIVE_DATA_IN UDT3 UDT3 Structure of the drive data

TS_DRIVE_DATA_IN UDT4 UDT4 Structure of the setpoints

TS_DRIVE_DATA_IN UDT5 UDT5 Structure of the actual values

W Symbols

Drive System SD2 - S7 SD2 Service Channel 19

4

Page 20: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Symbols W

20 Drive System SD2 - S7 SD2 Service Channel

4

Page 21: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

5 Application of Data Blocks

5.1 Hardware Configuration in the PLCThe SIEB & MEYER drives are addressed by the SERVOLINK 4 interface of the SER‐VOLINK 4 gateway. This converter is projected via the Profibus DP as DP slave in thesoftware SIEMENS Step 7 with inputs and outputs of 16 byte each according to thenumber of SD2/SD2S drives. For this purpose the appropriate GSD file bySIEB & MEYER is required. Please refer to the SIMATIC documentation on how to in‐tegrate new GSD files into the programming environment.

5.1.1 GSD FileIn order to project the device on the PLC the GSD file SM_SLGW.GSD is required.

5.1.2 Settings in the Hardware ConfigurationAt first the object "SERVOLINK 4 gateway" is dragged to the Profibus DP master sys‐tem in the station window of the "HW Config".

Fig. 1: SIMATIC software "HW Config"

The inserted module is highlighted. By double-click the properties window is opened.There you can enter a module name and assign the Profibus address.

W Application of Data Blocks

Drive System SD2 - S7 SD2 Service Channel 21

5

Page 22: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Fig. 2: Dialog window "Properties - DP slave"

In the lower part of the station window the detailed view of the converter is indicated intable form.

According to the used drives the objects "DS402 Single Axis" or "DS402 Double Axis"are dragged into the detailed view of the "HW Config". By double-click you can open aproperties window again and define the addresses of the input and the output area.

Fig. 3: Dialog window "Properties - DP slave"

5.2 Defining the Addresses in the ModulesBeside defining the addresses in the PLC, also the SD2/SD2S drives and the gatewaymust be set to the right addresses. Refer to the device documentation for additional in‐formation.

5.3 Programming the Application ProgramAt the beginning of the program cycle the data area of Profibus must be read using thesystem function SFC14, DPRD_DAT,.

Then the different functions can be executed. These functions must be called once foreach drive.

Application of Data Blocks W

22 Drive System SD2 - S7 SD2 Service Channel

5

Page 23: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

In order to align the data between the drive status and the PLC status, the functionblock FB_InitData should be called once for each SD2/SD2S drive when starting thePLC and after a fault.

Then the data is written into the data area of the Profibus via the system functionSFC15, DPWR_DAT,.

The cycle starts again: load → process → output.

5.3.1 Examples of the FunctionsThe sample program provides the following functions:< reading the current error form object 69, DEV_CTRL_ERROR_CODE_ACTUAL< writing the value 10000 for the velocity ramp in object 186, SPG_VELOCITY_AC‐

CELERATION_TIME_VL with 4 bytes< setting the array index to the first element via the value 4

W Application of Data Blocks

Drive System SD2 - S7 SD2 Service Channel 23

5

Page 24: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Application of Data Blocks W

24 Drive System SD2 - S7 SD2 Service Channel

5

Page 25: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

6 Programming the SERVOLINK 4gatewayCustomized programming is not required. The converter automatically detects thenumber of drives connected to it.

You must only set the Profibus address by means of the address selection switches atthe gateway.

W Programming the SERVOLINK 4 gateway

Drive System SD2 - S7 SD2 Service Channel 25

6

Page 26: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Programming the SERVOLINK 4 gateway W

26 Drive System SD2 - S7 SD2 Service Channel

6

Page 27: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

7 Hardware DescriptionFor initial operation and use of the mentioned devices the according regulations, direc‐tives and standards must be taken into account. For further information refer to the ac‐cording product manuals.

A SERVOLINK 4 gateway is used to connect drives providing a SERVOLINK 4 inter‐face to Profibus. This converter is a master for SERVOLINK 4 and a slave for ProfibusDP.

Further information on this and the connector pin assignment is to be found in the man‐uals.

7.1 Connecting the DevicesThe following figures indicates the connection establishment between PLC, SERVO‐LINK 4 gateway and the drives.

Fig. 4: Device connection

W Hardware Description

Drive System SD2 - S7 SD2 Service Channel 27

7

Page 28: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Hardware Description W

28 Drive System SD2 - S7 SD2 Service Channel

7

Page 29: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

8 Error DetectionIn the following several errors regarding the conversion from Profibus to SERVOLINK 4and their detection are described.

8.1 Errors in S7 PLCPLC failure

The converter detects a bus error and sets the output data to SERVOLINK 4 to zero.The drive SD2/SD2S switches off because the control word has the value zero.

PLC stops

S7 PLC sets the output data to zero. The converter forwards this data to SERVO‐LINK 4. The drive SD2/SD2S switches off because the control word has the valuezero.

System Function Block SFC 15

When the system function block SFC 15 is not called, the present data pattern is keptand sent again and again. The converter forwards this data to SERVOLINK 4. Thedrive is not able to distinguish whether the same data shall be sent repeatedly or theblock can not be called.

8.2 Error in SERVOLINK 4 gatewayConverter failure

S7 detects that the participant is not existent. It signal a bus error and stops the pro‐gram. The drive SD2/SD2S does not receive any telegrams and stops via time moni‐toring.

Error Detection Field Bus

If the converter detects a field bus error, it sets the output data to SERVOLINK 4 tozero. The drive SD2/SD2S switches off because the control word has the value zero.

Error DetectionSERVOLINK 4

If the converter detects an error in SERVOLINK 4, it sets the output data to the fieldbus to zero (general error) or to 0FFh (slot error).

8.3 Error in Drive Control SD2/SD2SDue to a failure of the drive SD2/SD2S the SERVOLINK 4 telegram is replied faulty ornot at all.

Thus the converter detects an error. The device distinguishes between a general errorin SERVOLINK 4 and a slot error of an individual participant. If a general error is detec‐ted, the output data to the field bus are set to zero. If a slot error is detected, the output

W Error Detection

Drive System SD2 - S7 SD2 Service Channel 29

8

Page 30: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

data are set to 0FFh. The status in the PLC program can be set correspondingly andthe PLC program can be set to switch to an error routine.

Error Detection W

30 Drive System SD2 - S7 SD2 Service Channel

8

Page 31: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

9 SERVOLINK 4 gateway TestAssemblyThe test assembly is done as shown in the hardware description. When the system isconnected and ready for operation you can start checking.

9.1 Front Panel Check of SIMATIC CPUThe front panel provides several LEDs that indicate the status of the CPU. The LEDindicating the power supply "DC5V" and the LED "RUN" must be on permanently. Thismakes sure that the PLC program is running.

In the event of an error the PLC switches to the stop mode. In order to fix the error youmust check that the converter is connected correctly. Check also whether the rightnumber of drives is connected.

9.1.1 LED DisplayThe meaning of each LED on the front panel of the SIMATIC CPU is described in thefollowing table.LED State Meaning

SF LED on Error in PLC

BATF LED on Battery error

BUSF LED on Bus error

DC5V LED on Power supply of 5 V present

FRCE LED on Output data of PLC is frozen.

RUN LED on PLC program is running.

STOP LED on PLC program has been stopped.

9.2 Drive CheckYou can check the received SERVOLINK 4 data using the bus monitor in the softwaredrivemaster2.

9.3 Object AccessYou can test the different functions via the inputs of the PLC:< input i4: reading< input i5: writing< input i6: setting the array index

W SERVOLINK 4 gateway Test Assembly

Drive System SD2 - S7 SD2 Service Channel 31

9

Page 32: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

SERVOLINK 4 gateway Test Assembly W

32 Drive System SD2 - S7 SD2 Service Channel

9

Page 33: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

10 Related DocumentsThe following documents provide more information on this topic:Supplier Document name

SIEMENS Manuals regarding Step 7 programming

SIEB & MEYERAG Gateway_0362151.pdf

SIEB & MEYERAG SD2_DeviceControl.pdf

SIEB & MEYERAG SD2_CAN-Connection.pdf

SIEB & MEYERAG drivemaster2_UserManual.pdf

W Related Documents

Drive System SD2 - S7 SD2 Service Channel 33

10

Page 34: S7 SD2 Service Channel - sieb-meyer.de · 5.3.1 Examples of the ... SIEB & MEYER adapter to a SIMATIC S7 CPU with Profibus interface via ... < SIMATIC STEP 7 starting form version

Related Documents W

34 Drive System SD2 - S7 SD2 Service Channel

10