using the encoder interfaces tm count and tm posinput in ......disclaimer of liability siemens shall...

30
Using the Encoder Interfaces TM Count and TM PosInput in SIMOTION SIMOTION V4.4 or higher TM Count V1.1 / TM PosInput V1.2 https://support.industry.siemens.com/cs/ww/en/view/109750430 Siemens Industry Online Support

Upload: others

Post on 18-Apr-2020

39 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

Using the Encoder Interfaces TM Count and TM PosInput in SIMOTION

SIMOTION V4.4 or higher TM Count V1.1 / TM PosInput V1.2

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

Siemens Industry Online Support

Page 2: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

Legal information

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 2

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Legal information Use of application examples

Application examples illustrate the solution of automation tasks through an interaction of several components in the form of text, graphics and/or software modules. The application examples are a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-binding and make no claim to completeness or functionality regarding configuration and equipment. The application examples merely offer help with typical tasks; they do not constitute customer-specific solutions. You yourself are responsible for the proper and safe operation of the products in accordance with applicable regulations and must also check the function of the respective application example and customize it for your system.

Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the application examples used by technically trained personnel. Any change to the application examples is your responsibility. Sharing the application examples with third parties or copying the application examples or excerpts thereof is permitted only in combination with your own products. The application examples are not required to undergo the customary tests and quality inspections of a chargeable product; they may have functional and performance defects as well as errors. It is your responsibility to use them in such a manner that any malfunctions that may occur do not result in property damage or injury to persons.

Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation, liability for the usability, availability, completeness and freedom from defects of the application examples as well as for related information, configuration and performance data and any damage caused thereby. This shall not apply in cases of mandatory liability, for example under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for damages arising from a breach of material contractual obligations shall however be limited to the foreseeable damage typical of the type of agreement, unless liability arises from intent or gross negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens against existing or future claims of third parties in this connection except where Siemens is mandatorily liable.

By using the application examples you acknowledge that Siemens cannot be held liable for any damage beyond the liability provisions described.

Other information Siemens reserves the right to make changes to the application examples at any time without notice. In case of discrepancies between the suggestions in the application examples and other Siemens publications such as catalogs, the content of the other documentation shall have precedence.

The Siemens terms of use (https://support.industry.siemens.com) shall also apply.

Security information Siemens provides products and solutions with industrial security functions that support the secure operation of plants, systems, machines and networks.

In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept.

Customers are responsible for preventing unauthorized access to their plants, systems, machines and networks. Such systems, machines and components should only be connected to an enterprise network or the internet if and to the extent such a connection is necessary and only when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.

For additional information on industrial security measures that may be implemented, please visit https://www.siemens.com/industrialsecurity.

Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly recommends that product updates are applied as soon as they are available and that the latest product versions are used. Use of product versions that are no longer supported, and failure to apply the latest updates may increase customer’s exposure to cyber threats.

To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed at: http://www.siemens.com/industrialsecurity.

Page 3: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

Table of Contents

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 3

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Table of Contents Legal information ......................................................................................................... 2

1 Introduction ........................................................................................................ 4

1.1 Overview............................................................................................... 4 1.2 Mode of operation ................................................................................ 5 1.2.1 Reading in of encoder values as direct values..................................... 6 1.2.2 Boundary conditions ............................................................................. 6 1.2.3 Capture function ................................................................................... 8 1.3 Components used .............................................................................. 10

2 Hardware .......................................................................................................... 11

2.1 Supported encoder ............................................................................. 11 2.2 Wiring the technology modules .......................................................... 11 2.2.1 TM Count 1x24V technology module for ET 200SP .......................... 11 2.2.2 TM PosInput 1 technology module for ET 200SP .............................. 12 2.3 Hardware configuration in the TIA Portal ........................................... 12 2.4 Configuring the technology modules .................................................. 15 2.4.1 Using the “incremental encoder” encoder type .................................. 16 2.4.2 Use of "SSI Absolute Value Encoder" encoder type .......................... 17

3 Engineering in SIMOTION SCOUT ................................................................. 18

3.1 Creating IO tags in the address list for incremental encoder ............. 18 3.2 Configuration of the technology objects ............................................. 19 3.2.1 TO configuration for incremental encoder .......................................... 19 3.2.2 TO configuration for SSI absolute encoder ........................................ 20 3.3 FBLTmCountCaptureHomePosition ................................................... 21 3.3.1 Interface description ........................................................................... 21 3.3.2 Function description ........................................................................... 22 3.4 Integration into the user project .......................................................... 24 3.4.1 Integrating the library into SIMOTION SCOUT .................................. 24 3.4.2 Integrating the library into the user program ...................................... 25 3.4.3 Instancing and calling the function block ............................................ 25 3.4.4 Including the program in the task system ........................................... 26 3.5 Operating the example program ........................................................ 27 3.5.1 Programs of the example project ....................................................... 27 3.5.2 Operating the "watchTableSyncEncoder" watch table ....................... 28

4 Annex ................................................................................................................ 29

4.1 Service and support ........................................................................... 29 4.2 Links and literature ............................................................................. 30 4.3 Change documentation ...................................................................... 30

Page 4: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 4

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

1 Introduction

1.1 Overview

The TM Count 1x24V and TM PosInput 1 technology modules are used for count value and position acquisition of

Incremental encoders

Pulse encoders and

SSI absolute encoders

This application example describes the interface connection of encoder signals to SIMOTION technology objects using the technology modules TM Count 1x24V and TM PosInput 1. The framework conditions described in chapter 1.2.2 have to be observed.

Figure 1-1 Interface connection of TM Count 1x24V/ TM PosInput 1 to SIMOTION

SIMATIC

ET 200SP

SIMOTION CPU

e.g. D4x5-2TM Count 1x24V /

TM PosInput 1

PROFINET IO

Encoder

Content of the application example

In this application example you get the FBLTmCountCaptureHomePosition function block for the homing of incremental encoders that are switched on via a TM Count/TM PosInput to a SIMOTION.

You get an example project showing the interface connection of an incremental encoder and an SSI absolute value encoder to two "External encoder" technology objects. In the example project the homing of the incremental encoder is implemented with the help of the function block and SIMOTION system commands.

Page 5: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 5

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Possible applications

With the help of technology modules a decentralized actual value acquisition can be performed for the following application cases:

External encoder of third-party axes

Encoder of analog drives

Encoder of hydraulic axes

NOTICE Note the restrictions in chapter 1.2.2.

1.2 Mode of operation

Isochronous switch-on via IM 155-6PN HF

The TM Count 1x24V / TM PosInput 1 technology module is connected to the SIMOTION CPU via IM 155-6PN HF using an isochronous PROFINET connection. The current count value or position value of the connected encoder of the TM to the SIMOTION CPU is transferred via the control and feedback interface of the TM.

Control and feedback interface of the technology modules

Using the FBLTmCountCaptureHomePosition function block, the following functions are performed automatically.

Opening software gate for count value acquisition (for incremental encoder)

Enabling capture function for homing

The following values are read out via the feedback interface:

Current count value/position value

Last capture value detected (for homing of incremental encoders)

Page 6: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 6

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

1.2.1 Reading in of encoder values as direct values

The switching on of the count value or position value of the technology module to the SIMOTION technology object is performed as direct value via the I/O area of the SIMOTION CPU used. Calculating the current count value or position value in the unit-related actual position is done directly in the SIMOTION technology object. The steps required for the configuration of the technology object are described in chapter 3.2.

Figure 1-2 Communication between TM Count 1x24V/ TM PosInput 1 and SIMOTION

4 bytes (current count value)

12 bytes (control bits)

SIMOTION

4 bytes (capture value)

4 bytes (current measured

value)

4 bytes (status bits)

TM Count 1x24V/

TM PosInput 1

1.2.2 Boundary conditions

WARNING

Only technology objects with a limited motion path are supported. Overflows and underflows of count value/position value have to be prevented.

If counter underflow and overflow take place, actual value jumps take place on the technology object that may lead to undefined states on the machine.

If required, perform a mechanical adjustment1 of the encoder for absolute

value encoders in order to prevent underflows and overflows of the position value

2. Use a multi-turn encoder with sufficient resolution for the

work area of the axis.

Technology objects used

The reading in of count values of the TM via direct values is possible for the following technology objects:

Positioning axis/synchronous axis/path axis

External encoder

1 This means that the encoder was set or turned to a suitable position before the installation.

2 A 32 bit integer value is meant here, which is transferred by the technology module to

SIMOTION (" current count value" in Figure 1-2)

Page 7: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 7

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Note The interface connection is not done via a PROFIdrive frame (105, 81, 83), but as direct value via the I/O area. PROFIdrive drives are not supported.

Mechanics supported

The table below lists the supported encoders and mechanics of the technology objects for the connection of direct values.

Table 1-1 Encoders and technology object mechanics supported

Encoder type Mechanics of the TO Supported

Incremental encoder/pulse encoder rotary Yes

linear Yes

SSI absolute encoder rotary No

linear Yes

SIMOTION CPUs supported

The application example supports all SIMOTION Hardware plattforms:

As of SIMOTION kernel/firmware V4.4

With PROFINET interface

Page 8: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 8

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

1.2.3 Capture function

For the homing of incremental encoders, the capture function of the technology modules is used. The capture function saves the count value of the technology module as capture value when the reference signal is reached (measuring input functionality).

For the easy use of the capture function, the "FBTmCountCaptureHomePosition" library function is used. The FB calculates the correct actual position for the reference signal.

Possible reference signals

You can configure the edge of an external reference signal that triggers saving of the current count value as capture value. The following external signals can trigger the capture function:

Rising or falling edge of a digital input

Both edges of a digital input

Rising edge of signal N at the encoder input

Note The axis does not move automatically when the function block is used. Moves the axis up to the reference signal.

Calculation of the correct actual position after reaching the reference signal

The FB calculates the actual position cyclically based on the current count and capture value, using the following formula:

𝐴𝑐𝑡𝑢𝑎𝑙 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛[𝑚𝑚] = 𝐻𝑜𝑚𝑖𝑛𝑔 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛[𝑚𝑚] +

𝑅𝑒𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 [𝑚𝑚

𝐼𝑛𝑘] ∗ (𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝑐𝑜𝑢𝑛𝑡 𝑣𝑎𝑙𝑢𝑒[𝐼𝑛𝑘] − 𝐶𝑎𝑝𝑡𝑢𝑟𝑒 𝑣𝑎𝑙𝑢𝑒[Ink])

The corrected actual value is recalculated cyclically for further traversing motions of the axis.

Usage

You can apply the actual value calculated by the function block via direct homing or resetting of setpoint and actual position in the technology object and thus re-home the axis. You can achieve the highest precision for the homing of the axis if you stop the axis after capture and then do the homing.

Page 9: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 9

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Workflow of the capture function

Figure 1-3 Capture function for referencing

Ha

rdw

are

lim

it s

witch

Min

.

Ha

rdw

are

lim

it s

witch

Ma

x.

position

Software limit switch

Min.

Software limit switch

Max.

Area of operation

position

actual

Position

Homing movement

start position

Capture – Digital input

FB Output

r64ActualPositionHomed

actualPosition technology object

r64homingPosition

Capture

Direct

Homing

Figure 1-4 Flow chart for homing using the capture function

Start

Saving the count

value

Did a capture

event occur?

ye

s

Query capture

eventno

Calculating the

correct actual

position

End

Home TO

directly to

correct actual

position

Move axis in

the direction of

capture signal

1

1

2

3

2 3

4

4

5

5

6

6

Page 10: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

1 Introduction

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 10

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

1.3 Components used

This application example was created with the following hardware and software components:

Table 1-2 Software and hardware components of the application example

Component Number

Article number Note

STEP 7 Professional V14 1 6ES7822-1AA04-0YC5 V14 Upd2

SIMOTION SCOUT TIA 1 6AU1810-1BA45-0XA0 V4.5 HF1

SIMOTION C240 PN 1 6AU1 240-1AB00-0AA0 Firmware 4.5

IM155-6PN HF 1 6ES7155-6AU00-0CN0 Firmware 3.3

TM PosInput 1 1 6ES7138-6BA00-0BA0 Firmware 1.2

TM Count 1x24V 1 6ES7138-6AA00-0BA0 Firmware 1.1

Incremental encoder HTL (10..30V)

1 6FX2001-4SA50

SSI singleturn 13 bit absolute value encoder

1 6FX2001-5FS12

This application example consists of the following components:

Table 1-3 Components of the application example

Component File name Note

Documentation 109750430_LTmCount_DOC_v10_en.pdf

This document

This zip file includes a function block for the homing of incremental encoders and data types for the control and feedback interface of the technology modules.

109750430_LTmCount_LIB_v10.zip This library can be used to home a technology object with an external reference signal in a separate user project.

Program example that shows the use of the blocks from the above library.

109750430_LTmCount_PROJ_v10.zip

Page 11: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 11

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

2 Hardware

2.1 Supported encoder

You can connect the encoder based on the following table to the respective technology modules of the SIMATIC ET 200SP.

Table 2-1 Encoder assignment to technology modules

Module Incremental encoder

HTL

(Voltage: 24V)

Incremental encoder

TTL

(Voltage: 5V)

Absolute value encoder

SSI

TM Count 1x24V Yes No No

TM PosInput 1 No Yes Yes

2.2 Wiring the technology modules

The following chapters explain the wiring of the encoders to the technology modules.

2.2.1 TM Count 1x24V technology module for ET 200SP

Wire the TM Count 1x24V selected by you depending on the selected encoder type, based on the following figures.

Figure 2-1 Wiring of the TM Count 1x24V technology module for ET 200SP

Fahren Minus (DQ1)

Eilgang (ext.DQ)

DI0 (external zero mark signal)

Fahren Plus (DQ0)DI1

DI2

DQ0

DQ1

M

M

M

Encoder signal A

Encoder signal B

Encoder signal N

M

1

3

5

7

9

11

13

15

2

4

6

8

10

12

14

1624V DC

Page 12: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 12

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

2.2.2 TM PosInput 1 technology module for ET 200SP

Wire the TM PosInput selected by you depending on the selected encoder type, based on the following figures.

Figure 2-2 Wiring of an incremental encoder on the TM PosInput 1 for ET 200SP

Fahren Minus (DQ1)

Eilgang (ext.DQ)

DI0 DI0 (external zero mark signal)

Fahren Plus (DQ0)DI1

DQ0

DQ1

MM

Encoder signal A +

Encoder signal A -

1

3

5

7

9

11

13

15

2

4

6

8

10

12

14

16

Encoder signal B +

Encoder signal B -

Encoder signal N +

Encoder signal N -

24V DC

Figure 2-3 Wiring of an absolute value encoder on TM PosInput 1 for ET 200SP

Fahren Minus (DQ1)

Eilgang (ext.DQ)

DI0

Fahren Plus (DQ0)DI1

DQ0

DQ1

MM

Encoder signal DAT +

Encoder signal DAT -

1

3

5

7

9

11

13

15

2

4

6

8

10

12

14

16

Encoder signal CLK +

Encoder signal CLK -

24V DC

2.3 Hardware configuration in the TIA Portal

Perform the following configuration steps in order to connect the technology modules correctly with the SIMOTION CPU.

1. Add a SIMOTION CPU to your project.

2. For a decentralized use of technology modules on a SIMOTION CPU, an IM 155-6 PN interface module has to be connected to the CPU. Add the selected interface module in the network view of the TIA Portal.

Page 13: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 13

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

CAUTION Use an IM 155-6 PN HF or IM 155-6 PN HS so that the actual encoder value can be read out in an isochronous manner (equidistant) in the servo cycle of the technology objects.

When using a non-isochronous interface module, a secure transfer of the count value/position value cannot be guaranteed in servo clock. If no new actual value is transferred, the actual value is extrapolated by the controller. This may lead to unexpected traversing motions of the position control of axes or of synchronization processes.

3. Connect the interface module to the PROFINET interface of the SIMOTION CPU.

Figure 2-4 PROFINET connection between SIMOTION C240 PN and IM155-6 PN HF

4. Enable the "IRT" option on the interface module.

Figure 2-5 Enabling the "IRT" on the interface module

5. Connect the ports in the topology view according to the real PROFINET topology.

Figure 2-6 Port interconnection

Page 14: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 14

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

6. Add the TM PosInput/TM Count technology module from the hardware catalog to the correct slot of the module rack. In the following figure a TM PosInput 1 was used on slot 1 and a TM Count 1x24V on slot 2.

Figure 2-7 Inserting TM PosInput 1 and TM Count 1x24V

7. Configure the manual operation on the selected TM.

Figure 2-8 Configuration of the manual operation

8. Configure "Servo" as process image in the IO addresses.

9. Change the automatically assigned start addresses when they are smaller than 64.

Page 15: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 15

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Figure 2-9 Configuring process image and addresses

10. Enable the isochronous mode when using an IM 155-6 PN HF. In addition, enable the isochronous mode for all TM.

Figure 2-10 Enabling of isochronous mode

2.4 Configuring the technology modules

The configuration of the technology modules is the same for all modules listed in this documentation; however, it depends on the encoder type selected.

Figure 2-11 Opening the parameter view via the context menu of the TM

Page 16: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 16

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

2.4.1 Using the “incremental encoder” encoder type

In the hardware configuration of the technology module, make the following settings.

Table 2-2 Configuring a technology module using an incremental encoder

Parameter Setting

Operating mode Manual operation

Selection of the operating mode

Counting/position detection

Signal type Depends on the encoder used

(e.g.: incremental encoder (A/B/N))

Signal evaluation Depends on the encoder used

(e.g.: fourfold)

Filter frequency Depends on the encoder used and the maximum frequency that occurs

(e.g.: 200kHz)

Sensor type Depends on the encoder used

(e.g.: P switch)

Reaction to signal N No reaction to signal N: If the encoder zero mark should not be used for homing.

Capture to signal N: If the encoder zero mark should be used for homing.

High counting limit 2147483647

Start value 0 (default) Start value for position and homing position.

Low counting limit -2147483648

Reaction to violation of a counting limit

Continue counting

Reset when counting limit is violated

To opposite counting limit

Reaction to gate start Continue with current value

Setting function of DI0 Using external zero mark for homing: Capture

Without external zero mark for homing (when using encoder zero mark) Digital input without function

Edge selection Depending on wired, external zero mark:

At rising edge (make contact)

At falling edge (break contact)

Reaction of count value to capture

Continue counting

Frequency Once

Setting function of DI1 Digital input without function

Setting function of DI2 Digital input without function

Setting function of DQ0 No settings required

Setting function of DQ1 No settings required

Measured variable Frequency

Update time 10 ms

Page 17: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

2 Hardware

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 17

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

2.4.2 Use of "SSI Absolute Value Encoder" encoder type

In the hardware configuration of the technology module, make the following settings.

Table 2-3 Configuring a technology module using SSI absolute value encoder

Parameter Setting

Operating mode Manual operation

Selection of the operating mode

Counting/position detection

Signal type SSI absolute encoder

Telegram length Depends on the encoder used

(e.g.: 12 bit)

Code type Depends on the encoder used

(e.g.: gray)

Transmission speed Depends on the encoder used

(e.g.: 125kHz)

Monoflop time Depends on the encoder used

(e.g.: automatic)

Parity Depends on the encoder used

(e.g.: none)

LSB bit number (position) Depends on the encoder used

(e.g.: 0)

MSB bit number (position) Depends on the encoder used

(e.g.: 11)

Setting function of DI0 Digital input without function

Setting function of DI1 Digital input without function

Setting function of DQ0 No settings required

Setting function of DQ1 No settings required

Measured variable Frequency

Update time 10 ms

Note Other configuration notes for the technology modules can be found in the manuals \5\ and \6\.

Page 18: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 18

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3 Engineering in SIMOTION SCOUT

3.1 Creating IO tags in the address list for incremental encoder

Note For the use of an SSI absolute value encoder you do not have to create IO tags in the address list. You can continue engineering in chapter 0.

The communication between SIMOTION CPU and technology modules takes place via the control and feedback interface of the technology modules.

Create the IO tags in the address list in SIMOTION SCOUT in order to access the interfaces. The IO tag is created on the configured start address of the technology module.

When using an incremental encoder, specify two IO tags for the control and feedback interface, based on the following table.

Table 3-1 IO tags when using an incremental encoder

Interface Data type Array length IP address

Control interface ARRAY OF BYTE 12 PQB “Start address"

Feedback interface ARRAY OF BYTE 16 PIB “Start address"

Figure 3-1 IO tags in the address list of SIMOTION SCOUT

Page 19: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 19

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.2 Configuration of the technology objects

The calculation of the actual position from the count value/position value of the technology module is performed in the technology object. To do this, the count value/position value is read as direct value via the I/O.

For the actual position to be calculated correctly, configure the technology object based on the following instructions.

3.2.1 TO configuration for incremental encoder

Note If you are using an external encoder technology object, configure the TypeOfAxis.Encoder_1 configuration structure in the expert list.

If you are using an axis technology object, configure the TypeOfAxis.NumberOfEncoders.Encoder_1 configuration structure in the expert list.

When using an incremental encoder, configure the technology object in the expert list based on the following table.

Table 3-2 TO configuration for incremental encoder

TO configuration tag in Encoder_1 Configuration value

dataAdaption [91] NO

encoderIdentification [4] DIRECT

encoderMode [1] RECTANGLE_TTL

encoderSystem [0] ROTATORY_SYSTEM: For rotatory encoders

[1] LINEAR_SYSTEM: For linear scales

encoderType [1] SENSOR_INCREMENTAL

encoderValueType [0] POSITION

DriverInfoDirectIncremental.logAddress Start address of the feedback interface e.g.: 1000

DriverInfoDirectIncremental.resolution 32 (bit)

IncEncoder.incResolution Depends on encoder: Encoder resolution for one revolution e.g. 500 (increments/revolution)

IncEncoder.incResolutionMultiplierCyclic Signal evaluation from TM configuration e.g.: 4 (for fourfold evaluation) Configuration as for TM

Further configuration settings for the mechanical installation of the encoder can be done in the “Mechanic" screen on the TO.

Page 20: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 20

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.2.2 TO configuration for SSI absolute encoder

Note If you are using an external encoder technology object, configure the TypeOfAxis.Encoder_1 configuration structure in the expert list.

If you are using an axis technology object, configure the TypeOfAxis.NumberOfEncoders.Encoder_1 configuration structure in the expert list.

When using an SSI absolute encoder, configure the technology object in the expert list based on the following table.

Table 3-3 TO configuration for SSI absolute encoder

TO configuration tag in Encoder_1 Configuration value

dataAdaption [91] NO

encoderIdentification [4] DIRECT

encoderMode [7] SENSOR_ANALOG

encoderSystem [1] LINEAR_SYSTEM

encoderType [1] SENSOR_ABSOLUTE

encoderValueType [0] POSITION

AnalogSensor.logAddress Start address of the feedback interface e.g.: 1000

AnalogSensor.ConversionData.factor The assessment factor specifies the context of path per increment (count value TM). Specify the distance that is travelled per increment of the encoder.

AnalogSensor.ConversionData.offset 0

AnalogSensor.DriverInfo.format [1] VALUE_LEFT_MARGIN

AnalogSensor.DriverInfo.logAdress Start address of the feedback interface e.g.: 200

AnalogSensor.DriverInfo.maxValue High counting limit of TM: You can find these values in the TM configuration. e.g.: 8191

AnalogSensor.DriverInfo.resolution 31 (bit)

AnalogSensor.DriverInfo.minValue 0

Further configuration settings for the mechanical installation of the encoder can be done in the “Mechanic" screen on the TO.

Page 21: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 21

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.3 FBLTmCountCaptureHomePosition

Note The FBLTmCountCaptureHomePosition is only intended for the use with incremental encoders.

If you use an SSI absolute value encoder, perform an absolute value encoder adjustment. The position is saved non-volatile in the technology object.

With the help of the FBLTmCountCaptureHomePosition you can easily perform the following tasks if you are using an incremental encoder:

Open software gate

Start capture function

Save capture value

Calculating actual position once the zero mark has been reached

3.3.1 Interface description

Figure 3-2 FBLTmCountCaptureHomePosition

FBLTmCountCaptureHomePosition

BOOL

execute done

BOOL

LREAL r64HomingPo

sition busy

BOOL

ARRAY [0..15] OF BYTE

ab32FeedbackTmCount

r64ActualPositionCalculate

d

LREAL

_Axis_Ref

toAxis ab32ControlT

mCount

ARRAY [0..11] OF BYTE

Table 3-4: Parameter of FBLTmCountCaptureHomePosition

Name P type Data type Comments

execute IN BOOL Start signal for measuring process

Start via positive edge

r64HomingPosition IN LREAL Homing position of external reference signal.

The unit is configured on the technology object.

ab32FeedbackTmCount IN ARRAY [0..15] OF BYTE

Feedback interface of TM Count

toAxis IN _Axis_Ref Technology object

Positioning axis

Synchronous axis

Path axis

External encoder

done OUT BOOL Measuring process completed

busy OUT BOOL Measuring in process

Page 22: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 22

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Name P type Data type Comments

r64ActualPositionHomed OUT LREAL Shows the current, homed actual position once the capture signal has been reached.

The unit is configured on the technology object.

You can use this value to re-home the axis.

ab32ControlTmCount OUT ARRAY [0..11] OF BYTE

Control interface of TM Count

Note The configuration of the control and feedback interface of the technology module is described in the manuals \5\ and \6\.

3.3.2 Function description

In Figure 3-3 the function of the FB is displayed.

1. Specify the homing position of the zero mark (reference signal) on the "r64HomingPosition" input.

2. Enable the capture function for homing with a positive edge on the "execute" input. The "busy" output is set to "true".

3. Home the axis in the direction of the reference signal. The FB does not move the axis automatically.

Once the reference signal is reached, the "done" output is set to "true" and "busy" is set to "false". The correct actual position is displayed on the r64ActualPositionHomed output, based on the current count, provided the "execute" input is set to "true" (otherwise at least for one cycle).

4. You can stop or continue to move the axis once the zero mark has been reached. You achieve a higher level of precision when you stop the axis.

5. Home the technology object directly and specify the r64ActualPositionHomed output as homing position (syncPosition / homePosition). Use the following system commands:

a. TO external encoder: _synchronizeExternalEncoder()

b. TO axis: _homing()

Afterwards, the technology object is correctly homed.

WARNING

Direct homing leads to a jump of the conductance for synchronization processes.

This may lead to unexpected compensation movements of the slave axis.

Only perform homing when no synchronous operation is active.

6. Set the "execute" input to "false".

Page 23: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 23

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

Figure 3-3 Function diagram for the FBLTmCountCaptureHomePosition FB

execute

Zeit

Zeit

Zeit

Zeit

TO.motionState.

position

Reference signal (capture)

r64Actual

PositionHomed

busy

0

1

0

0

1

Zeit

done

r64Homing

Position

Direct referencing

Moving in direction of the capture signal

1

2

3

4

5

6

Page 24: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 24

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.4 Integration into the user project

This chapter includes instructions on how to integrate the LTmCount into your SIMOTION SCOUT project.

3.4.1 Integrating the library into SIMOTION SCOUT

Below, you can find the steps required to integrate your LTmCount library into your SIMOTION SCOUT project. Subsequently, you can use the blocks of the LHcs4x00 library.

1. Unzip the 109750430_LTmCount_LIB_v10.zip file.

2. Import the library via the context menu in the “LIBRARIES" folder in the SIMOTION SCOUT project navigator. Click on “Import folders/objects".

Figure 3-4 Import the library

3. In the dialog that follows, select the path to the LTmCount.xml file in the unzipped folder.

4. Then click “OK”.

The library is now imported into the project.

5. Compile the library.

Figure 3-5 Compile the library

Page 25: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 25

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.4.2 Integrating the library into the user program

Use the "USELIB" keyword in the interface section of a SIMOTION ST source in order to integrate the library block.

Figure 3-6 Implementing the LTmCount library

3.4.3 Instancing and calling the function block

6. Create a local instance of the FBLTmCountCaptureHomePosition function block in a program.

7. Call the instance of the FB in the program and interconnect the input and output variables:

Figure 3-7 Instancing and calling the function block

The functioning of the FB is described in chapter 3.3.

1

2

Page 26: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 26

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.4.4 Including the program in the task system

1. Navigate up to the ServoSynchronousTask in the runtime system.

2. Mark the program in which the call of the FB takes place.

3. Assign the program the ServoSynchronousTask by clicking the top button (2 arrows to the right). The program is then listed in the right field in the programs used.

Figure 3-8 Including program in the task system

Page 27: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 27

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.5 Operating the example program

Content of the sample project

Unzip the "109750430_LTmCount_PROJ_v10.zip" archive and open the "109750430_LTmCount_PROJ_v10.ap14" TIA Portal project.

You can home the incremental encoder by using the "watchTableSyncEncoder" watch table. The incremental encoder is used on the external encoder technology object.

Note If you use a different encoder than the one in the example, you have to adjust the technology modules and the technology objects based on their selected encoder.

3.5.1 Programs of the example project

"pExternalEncoder" program

In the "pExternalEncoder" program, the following system commands are called for the "ExternalEncoder_Inc" external encoder:

Enable external encoder: _enableExternalEncoder()

Direct homing of external encoder: _synchronizeExternalEncoder()

Disable release of external encoder: _disableExternalEncoder()

"pExecuteCapture" program

The call of the FBLTmCountCaptureHomePosition for using the capture function is done in the "pExecuteCapture" program.

Page 28: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

3 Engineering in SIMOTION SCOUT

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 28

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

3.5.2 Operating the "watchTableSyncEncoder" watch table

Figure 3-9 "watchTableSyncEncoder" watch table

1. Set the "SyncExternalEncoder.gboStart" tag to "TRUE" The "ExternalEncoder_Inc" external encoder is enabled and "ExternalEncoder_Inc.control" = "ACTIVE"

2. Set "CaptureTm.r64ReferencePosition" as reference position.

3. Start the capture function by setting "CaptureTm.gboExecuteMeasuring" to "TRUE". "CaptureTm.gboCaptureActivated" is set to "TRUE" by the function block.

4. Moves the axis up to the reference signal. Once the reference signal has been reached, the following happens:

a. "CaptureTm.gboCaptureFinished" is set to "TRUE" by the function block and "CaptureTm.gboCaptureActivated" is set to "FALSE".

b. The "CaptureTm.r64NewPosition" position is calculated by the FB.

c. "CaptureTm.r64NewPosition" is applied by direct homing as actual position of the "ExternalEncoder_Inc" external enconder.

d. ExternalEncoder_Inc.SyncState receives the "YES" status.

5. Set "SyncExternalEncoder.gboStop" in order to disable the external encoder. As a result "ExternalEncoder_Inc.control" = "INACTIVE".

Page 29: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

4 Annex

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 29

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

4 Annex

4.1 Service and support

Industry Online Support

Do you have any questions or need support?

Siemens Industry Online Support offers access to our entire service and support know-how as well as to our services.

Siemens Industry Online Support is the central address for information on our products, solutions and services.

Product information, manuals, downloads, FAQs and application examples – all information is accessible with just a few mouse clicks at https://support.industry.siemens.com

Technical Support

Siemens Industry's Technical Support offers quick and competent support regarding all technical queries with numerous tailor-made offers – from basic support right up to individual support contracts.

Please address your requests to the Technical Support via the web form: www.siemens.en/industry/supportrequest

Service offer

Our service offer comprises, among other things, the following services:

Product Training

Plant Data Services

Spare Parts Services

Repair Services

On Site and Maintenance Services

Retrofit and Modernization Services

Service Programs and Agreements

Detailed information on our service offer is available in the Service Catalog: https://support.industry.siemens.com/cs/sc

Industry Online Support app

Thanks to the "Siemens Industry Online Support" app, you will get optimum support even when you are on the move. The app is available for Apple iOS, Android and Windows Phone: https://support.industry.siemens.com/cs/ww/en/sc/2067

Page 30: Using the Encoder Interfaces TM Count and TM PosInput in ......Disclaimer of liability Siemens shall not assume any liability, for any legal reason whatsoever, including, without limitation,

4 Annex

TM Count und TM PosInput an SIMOTION Entry ID: 109750430, V1.0, 11/2017 30

S

iem

en

s A

G 2

01

7 A

ll ri

gh

ts r

ese

rve

d

4.2 Links and literature

Table 4-1 Links and literature

No. Topic

\1\ Siemens Industry Online Support

https://support.industry.siemens.com

\2\ Link to the entry page of the application example

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

\3\ SIMOTION documentation overview

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

\4\ Manual

SIMATIC S7-1500, ET 200MP, ET 200SP Counting, measurement and position detection Function Manual Document ID: A5E32009788-AE

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

\5\ Manual

SIMATIC ET 200SP TM Count 1x24V Device Manual Document ID: A5E33002338-AB

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

\6\ Manual

SIMATIC ET 200SP TM PosInput 1 Device Manual Document ID: A5E33015754-AC

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

4.3 Change documentation

Table 4-2 Change documentation

Version Date Modification

V1.0 11/2017 First version