drivees simatic v5.0 driver program drvuss2

48
DriveES SIMATIC V5.0 Driver Program DRVUSS2 Function Description Edition 10/99

Upload: others

Post on 08-Feb-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

DriveES SIMATIC V5.0Driver Program DRVUSS2

Function Description Edition 10/99

Safety InstructionsThis Manual contains information which you should carefully observe to ensure your ownpersonal safety and the prevention of damage to the system. This information ishighlighted by a warning triangle and presented in one of the following ways dependingon the degree of risk involved:

DANGERindicates that death, severe personal injury or substantial property damage will result ifproper precautions are not taken.

WARNINGindicates that death, severe personal injury or substantial property damage can result ifproper precautions are not taken.

CAUTIONindicates that minor personal injury or property damage can result if proper precautionsare not taken.

NOTEcontains important information about the product, its operation or a part of the documentto which special attention is drawn.

Qualified personThe unit may only be started up and operated by a qualified person or persons.Qualified persons as referred to in the safety guidelines in this manual are those who areauthorized to start up, earth and label units, systems and circuits in accordance withrelevant safety standards.

Rules for proper usePlease note the following:

WARNINGThe unit may be used only for the applications described in the catalog or the technicaldescription, and only in combination with the equipment, components and devices ofother manufacturers as far as this is recommended or permitted by Siemens.The successful and safe operation of this equipment is dependent on propertransportation, storage, erection and installation and on careful operation andmaintenance.

Trademarks

SIMATIC, SIMATIC HMI, SIMATIC NET, SIROTEC, SINUMERIK and USS areregistered trademarks of Siemens AG. Other names in this publication might betrademarks whose use by a third party for his own purposes may violate the rights of theregistered holder.

Siemens Aktiengesellschaft

Subject to change without prior notice.

Copyright Siemens AG 1999 All rights reserved

The reproduction, transmission or use of this document or its contents arenot permitted without express written authority. Offenders will be liable fordamages. All rights, including rights created by patent grant or registrationof a utility model or design, are reserved.

Siemens AGBereich Automatisierungs- und Antriebstechnik (A&D)Geschäftsgebiet Motion Control Systems (MC)Postfach 3180, D-91050 Erlangen

Exclusion of liability

We have checked that the contents of this document correspond to thehardware and software described. Nonetheless, differences might existand therefore we cannot guarantee that they are completely identical. Theinformation given in this publication is reviewed at regular intervals andany corrections that might be necessary are made in subsequent editions.We welcome suggestions for improvement.

Edition 10/99 General

Siemens AG - DriveES SIMATIC V5.0 3DRVUSS2 - Function Description

Contents

1 General........................................................................................................................... 4

1.1 General information........................................................................................................ 4

1.2 Requirements ................................................................................................................. 5

1.3 Installation ...................................................................................................................... 5

1.4 Driver function ................................................................................................................ 5

1.5 Net data structure........................................................................................................... 6

1.6 Protocol frame................................................................................................................ 6

1.7 Configuration of communication..................................................................................... 6

2 Hardware platform.......................................................................................................... 7

2.1 S7-200 PLC.................................................................................................................... 7

2.2 The serial interface......................................................................................................... 7

3 Software platform ........................................................................................................... 8

3.1 Program memory............................................................................................................ 8

3.2 User data memory.......................................................................................................... 83.2.1 Driver parameter range .................................................................................................. 93.2.2 User data memory........................................................................................................ 103.2.3 System data area ......................................................................................................... 13

4 How the driver works.................................................................................................... 15

4.1 Initialization................................................................................................................... 15

4.2 Cyclic transmission mode ............................................................................................ 15

4.3 Broadcast mode ........................................................................................................... 16

4.4 Status flags for the user ............................................................................................... 17

4.5 Performance data......................................................................................................... 17

5 Example program......................................................................................................... 18

5.1 Bus configuration and bus interface............................................................................. 18

5.2 Driver parameters......................................................................................................... 25

5.3 Transmit data ............................................................................................................... 255.3.1 Extract from the example program............................................................................... 275.3.2 Cyclic program execution............................................................................................. 285.4 Program listing with example user program (subroutine 2) ......................................... 29

5.5 Parameterization of the drives ..................................................................................... 415.5.1 Parameterization of the USS interfaces for MASTERDRIVES FC or VC with CU2 .... 415.5.2 Parameterization of the USS interfaces for MASTERDRIVES MC or VC with CUVC 425.5.3 Parameterization of the USS interfaces for the MICRO-/MIDIMASTER...................... 425.5.4 Parameterization of the USS interfaces for the SIMOREG K 6RA24 .......................... 43

6 Versions ....................................................................................................................... 44

7 Literature ...................................................................................................................... 45

8 Abbreviations................................................................................................................ 46

General Edition 10/99

4 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

1 General

1.1 General information

"DriveES SIMATIC" supports communications links between SIMOREG,SIMOVERT and SIMODRIVE variable-speed drives and a higher-level SIMATICS7 control system. The link is implemented using the standardized PROFIBUS-DPcommunications system in accordance with the "PROFIBUS profile variable-speeddrives, PROFIDRIVE" /6/ or alternatively via the Universal Serial Interface Protocolin the case of SIMOVERT and SIMOREG

This manual describes the USS protocol driver required for net data transfer usingthe USS protocol between a SIMATIC S7-200 PLC as the master and SIMOREGor SIMOVERT drives as slaves.

The USSprotocol driver is part of the DriveES SIMATIC and is available as aMicroDos program including an example application.

The USS protocol characteristics described here are limited to the scope ofservices supported by the USS driver for the S7-200 PLC. Please refer to /1/ for acomplete description of the characteristics of the protocol.

The USS protocol defines an access method according to the master-slaveprinciple for communication via a serial bus. The point-to-point connection isincluded in it as a subset.

The main features of the USS protocol are:

½ Support for a multipoint-capable link, eg, EIA RS 485 hardware

½ Master-slave access method

½ Single master system

½ Up to 32 nodes (up to 31 slaves)

½ Character coding with UART characters

½ Simple, reliable frame structure

½ Easy to implement

The individual slaves are addressed by the master with an address character in thetelegram. A slave can never take the initiative to transmit. Direct messageexchange between the individual slaves is not possible. Communication isconducted in half-duplex mode.

Edition 10/99 General

Siemens AG - DriveES SIMATIC V5.0 5DRVUSS2 - Function Description

1.2 Requirements

Hardware

½ PC/PG with a Pentium 133MHz and at least 16MB RAM

½ S7-CPU 214/215/216

Interfaces that can be used with the USSprotocol:

½ CPU214: Port 0

½ CPU215: Port 0

½ CPU216: Port 0 oder Port 1

Software

½ Windows95 / Windows NT (V4.0 or higher)

½ Configuration tool MicroDos or MicroWin for S7-200

½ Library DRVUSS2

1.3 InstallationTo start the installation, please insert the DriveES SIMATIC CD in the CD-ROMdrive of your PG/PC and start the SETUP.EXE program. You will receive all furtherinformation during installation.

The following folders are located in the installation path STEP7\s7libs\Drvuss2:

½ Example: Contains the source files of the USS driver including an exampleprogram

½ Usscom: Contains the source files of the USS driver

½ You will find the function description for the USS driver in the Windows startmenu under the item SIMATIC > S7 Manuals

1.4 Driver functionThe driver handles net data transfer cyclically with up to 31 drive slaves inaccordance with the sequence specified in the polling list (see "Driver parameterrange VB0 to VB39"). Only one request to a slave is active at any one time. Thenet data (transmit/receive buffers) for the individual slaves are stored starting atVB2000.

In addition to cyclic transmission and receiving, the driver also supports thebroadcast function (transmission to all nodes) as defined in the USS specification.

IMPORTANT:The user is responsible for observance of the net data structures describedbelow. The driver only provides the protocol framework.

Also refer to further information in Chapter 4 "How the driver works"

General Edition 10/99

6 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

1.5 Net data structureVarious net data structures can be used to transmit net data.Depending on the selected structure, the net data have a PZD area for the processdata and a PKW area for parameter processing.

The PKW area allows the master to read and write parameter values and the slaveto signal parameter changes in the form of parameter change reports.

The PZD area contains signals necessary for process control, such as controlwords and setpoints from the master to the slave and status words and actualvalues from the slave to the master.

The net data structure is described in detail in /1/ and /5/.

1.6 Protocol frameEvery frame begins with the starting character STX (= 02 hex), followed by thelength (LAE) and the address byte (ADR). This is followed by the net data. Theframe is completed with the error detection character "block check character"(BCC).

STX 16. BCC

Net data max. 16 bytes

LAE ADR 1. 2.

SLAE Total length of the frame = LAE + 2

STX (start of text ) ASCII character: 02 hex

LAE (frame length) 1 byte, contains the frame length as a binary number and iscalculated

from ADR + net data + BCC. The USS driver supports a frame lengthof up to 18 bytes (ADR+16 bytes of net data + BCC).

ADR (address byte) 1 byte, contains the slave address as a binary number and can containthe value 1 to 31

Net data Process data (PZD) and/or parameter request (PKW). Up to16 bytes of net data with the USS driver for the S7-200 PLC.

BCC 1 byte, error detection character (block check character). The rule for calculating it is described in /1/.

1.7 Configuration of communicationBefore starting up USS communication, it is necessary to work through thefollowing configuration steps:

½ Configure the USS interface in the S7-200 (port setting)

½ Parameterize the driver parameter range (VB0 to VB39) for the intended task

½ Parameterize the drives (USS interface).

Edition 10/99 Hardware platform

Siemens AG - DriveES SIMATIC V5.0 7DRVUSS2 - Function Description

2 Hardware platform

2.1 S7-200 PLCThe driver is executable on a SIMATIC S7-200 with CPU 214, 215, 216. TheCPU 212 is not supported.

2.2 The serial interfaceThe programmable interfaces of the S7-200 PLC are used as the serial businterface. If a CPU215 or CPU216 is used as the USS master, make sure the portis set accordingly (control register of programmable communication: Special flagsSMB30 for port 0 and SMB130 for port 1)!

The interface settings for the USS protocol must be made as follows:

½ Character frame: 1 start bit, 8 data bits, even parity, 1 stop bit

½ Baud rate: 9600 baud

The mode selector switch has three positions: STOP-TERM-RUN.

The programming interface functions as a PG interface in "TERM" mode and as aUSSinterface in the "RUN" position, if it has been parameterized as acommunication interface.

Software platform Edition 10/99

8 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

3 Software platform

The memory of the S7-200 PLC is divided into two areas with the followingcapacities:

S7-200 CPU 214 CPU 215 CPU 216

Program memory [bytes] 4096 8192 8192

Use data memory [bytes] 4096 5120 5120

3.1 Program memory1430 bytes of the program memory of the S7-200 PLC are used when theUSS driver is running.

The following system resources are used and can therefore not be assigned by theuser:

SBR 0 : Initialization

SBR 1 : Block communication interrupts/events (in "TERM" mode only)

INT 0 : Time interrupt for transmit cycle

INT 2 : Transmit frame complete

INT 3 : Receive 1st character STX (02)

INT 4 : Receive 2nd character LAE (2 <= LAE <= 18)

INT 5 : Receive 3rd character ADR (1 <= ADR <= 31)

INT 6 : Receive 4th to nth characters

INT 7 : Receive characters that arrive after frame timeout (receive buffer clearance)

3.2 User data memoryThe following diagram shows the allocation of the user memory when theUSS driver is used:

Driver parameters:

VB0 to VB39 = 40 bytes

Transmit/receive buffers starting at VB40

(length depends on the number of slaves)

Free user data area

System data area:

VB4022 to VB4095 = 74 bytes

Edition 10/99 Software platform

Siemens AG - DriveES SIMATIC V5.0 9DRVUSS2 - Function Description

3.2.1 Driver parameter rangeThe driver parameter range contains the data required for the USSdriver tofunction correctly. It must be pre-assigned by the user.

Byte Meaning Value

VB0 Number of slaves 0 ... 31

VB1 (SLAE) total frame length [bytes] slave 1 with ADR=1 4 ... 20

VB2 (SLAE) total frame length [bytes] slave 2 with ADR=2 4 ... 20

VB3 (SLAE) total frame length [bytes] slave 3 with ADR=3 4 ... 20

VB4 (SLAE) total frame length [bytes] slave 4 with ADR=4 4 ... 20

VB5 (SLAE) total frame length [bytes] slave 5 with ADR=5 4 ... 20

VB6 (SLAE) total frame length [bytes] slave 6 with ADR=6 4 ... 20

VB7 (SLAE) total frame length [bytes] slave 7 with ADR=7 4 ... 20

VB8 (SLAE) total frame length [bytes] slave 8 with ADR=8 4 ... 20

VB9 (SLAE) total frame length [bytes] slave 9 with ADR=9 4 ... 20

VB10 (SLAE) total frame length [bytes] slave 10 with ADR=10 4 ... 20

VB11 (SLAE) total frame length [bytes] slave 11 with ADR=11 4 ... 20

VB12 (SLAE) total frame length [bytes] slave 12 with ADR=12 4 ... 20

VB13 (SLAE) total frame length [bytes] slave 13 with ADR=13 4 ... 20

VB14 (SLAE) total frame length [bytes] slave 14 with ADR=14 4 ... 20

VB15 (SLAE) total frame length [bytes] slave 15 with ADR=15 4 ... 20

VB16 (SLAE) total frame length [bytes] slave 16 with ADR=16 4 ... 20

VB17 (SLAE) total frame length [bytes] slave 17 with ADR=17 4 ... 20

VB18 (SLAE) total frame length [bytes] slave 18 with ADR=18 4 ... 20

VB19 (SLAE) total frame length [bytes] slave 19 with ADR=19 4 ... 20

VB20 (SLAE) total frame length [bytes] slave 20 with ADR=20 4 ... 20

VB21 (SLAE) total frame length [bytes] slave 21 with ADR=21 4 ... 20

VB22 (SLAE) total frame length [bytes] slave 22 with ADR=22 4 ... 20

VB23 (SLAE) total frame length [bytes] slave 23 with ADR=23 4 ... 20

VB24 (SLAE) total frame length [bytes] slave 24 with ADR=24 4 ... 20

VB25 (SLAE) total frame length [bytes] slave 25 with ADR=25 4 ... 20

VB26 (SLAE) total frame length [bytes] slave 26 with ADR=26 4 ... 20

VB27 (SLAE) total frame length [bytes] slave 27 with ADR=27 4 ... 20

VB28 (SLAE) total frame length [bytes] slave 28 with ADR=28 4 ... 20

VB29 (SLAE) total frame length [bytes] slave 29 with ADR=29 4 ... 20

VB30 (SLAE) total frame length [bytes] slave 30 with ADR=30 4 ... 20

VB31 (SLAE) total frame length [bytes] slave 31 with ADR=31 4 ... 20

VB32 (SLAE) total frame length [bytes] Broadcast 4 ... 20

VB33 Not used –––

VW34 Transmission cycle* 5 ms 0 ... 65535recommended:20)

VD36 Initial address of send/receive buffers 40 ... 4021- no. of slaves*44 + 22

The slave addresses cannot be selected freely, they are assigned by the programaccording to the above scheme.

Software platform Edition 10/99

10 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

3.2.2 User data memoryThe user data area contains the transmit and receive buffers of the USSdriver andother user-specific data.

Byte Meaning Value

VB40 User data User assignment

.. .. ..

.. .. ..

.. .. ..

VB4021 User data User assignment

With CPU 215 and 216, more user data can be stored starting at VB4096.

Transmit/receive buffer assignment

44 bytes are required per slave, whatever net data structure is selected. Thetransmit buffer for broadcasting requires another 22 bytes.

The following assignment is the transmit/receive buffer assignment of the exampleprogram provided. The initial address for transmit/receive buffers is VB2000.

Initial address VB2000 SLAE

VB2001 STX

VB2002 LAE

VB2003 ADR

VB2004

0 to 16 bytes of net data Transmit buffer for slave 1

VB2020 BCC

VB2021 STX

VB2022 LAE

VB2023 ADR

VB2024

0 to 16 bytes of net data Receive buffer for slave 1

VB2040 BCC

VB2041 Status byte 1 Status bytes for slave 1

VB2042 Status byte 2

VB2043 Not used

Edition 10/99 Software platform

Siemens AG - DriveES SIMATIC V5.0 11DRVUSS2 - Function Description

VB2044 SLAE

VB2045 STX

VB2046 LAE

VB2047 ADR

VB2048

0 to 16 bytes of net data Transmit buffer for slave 2

VB2064 BCC

VB2065 STX

VB2066 LAE

VB2067 ADR

VB2068

0 to 16 bytes of net data Receive buffer for slave 2

VB2084 BCC

VB2085 Status byte 1 Status bytes for slave 2

VB2086 Status byte 2

VB2087 Not used

VB2088 SLAE

VB2089 STX

VB2090 LAE

VB2091 ADR

VB2092

0 bis 16 bytes of net data Transmit buffer for slave 3

VB2108 BCC

VB2109 STX

VB2110 LAE

VB2111 ADR

VB2112

0 bis 16 bytes of net data Receive buffer for slave 3

VB2128 BCC

Software platform Edition 10/99

12 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

VB2129 Status byte 1 Status bytes for slave 3

VB2130 Status byte 2

VB2131 Not used

VB2132 SLAE

VB2133 STX

VB2134 LAE

VB2135 ADR

VB2136

0 to16 bytes of net data Transmit buffer for slave 4

VB2152 BCC

VB2153 STX

VB2154 LAE

VB2155 ADR

VB2156

0 to 16 bytes of net data Receive buffer for slave 4

VB2172 BCC

VB2173 Statusbyte 1 Receive buffer for slave 4

VB2174 Statusbyte 2

VB2175 Not used

VB2176 SLAE

VB2177 STX

VB2178 LAE

VB2179 ADR

VB2180

0 bis 16 bytes of net data Transmit buffer forbroadcasting

VB2196 BCC

VB2197 Status byte 1 Status bytes forbroadcasting

VB2198 Status byte 2

Edition 10/99 Software platform

Siemens AG - DriveES SIMATIC V5.0 13DRVUSS2 - Function Description

Entry of the communication status in status byte 1:

½ Bit 0 - Transmission in progress

½ Bit 1 - Transmission error

½ Bit 2-7 Not used

Entry of the error number in status byte 2:

½ 0 - No error

½ 1 - Frame timeout

½ 2 - Acknowledgment timeout

½ 3 - Error on receiving STX (parity error, buffer overflow, no STX)

½ 4 - Error on receiving LAE (parity error, buffer overflow, wrong frame length)

½ 5 - Error on receiving ADR (parity error, buffer overflow, wrong slave address)

½ 6 - Error on receiving net data (parity error, buffer overflow, wrong BCC)

3.2.3 System data areaThe system data area is reserved for the USS driver and must not be written to bythe user.

Byte Meaning Value

VD4022 Address of writing pointer of the base receive buffer Variable

VW4026 Character counter for receiving net data in INT 6 Variable

VB4028 Buffer for LAE for checking on receiving Variable

VB4029 Buffer for ADR for checking on receiving Variable

VD4030 Address of VB0 Set in system

VD4034 Address of the transmit buffer of 1st slave Set in system

VD4038 Address of the receive buffer of 1st slave Set in system

VD4042 Address of the broadcast transmit buffer Variable

VD4046 Current transmit buffer address Variable

VD4050 Current receive buffer address Variable

VD4054 Transmit address for S7 system Variable

VW4058 Loop counter Variable

VW4060 Number of slaves (value copied from VB0) 0 to 31

VW4062 Interrupt 0 - counter for transmission initiation 0 to 65535

VW4064 Acknowledgment delay time counter 0 to 4

VW4066 Frame monitoring time Value from VB34 minus 2

VW4068 Node counter 1 to 31

VW4070 Result of BCC calculation Variable

VW4072 Frame monitoring time counter 0 to VW4066

VB4074 Not used -----

VB4075 Status bits *) Variable

VB4076 Base receive buffer: STX 2

VB4077 Base receive buffer: LAE 2 to 18

VB4078 Base receive buffer: ADR 1 to 31

Software platform Edition 10/99

14 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

Byte Meaning Value

VB4079 Base receive buffer: Net data byte 1 Variable

VB4080 Base receive buffer: Net data byte 2 Variable

VB4081 Base receive buffer: Net data byte 3 Variable

VB4082 Base receive buffer: Net data byte 4 Variable

VB4083 Base receive buffer: Net data byte 5 Variable

VB4084 Base receive buffer: Net data byte 6 Variable

VB4085 Base receive buffer: Net data byte 7 Variable

VB4086 Base receive buffer: Net data byte 8 Variable

VB4087 Base receive buffer: Net data byte 9 Variable

VB4088 Base receive buffer: Net data byte 10 Variable

VB4089 Base receive buffer: Net data byte 11 Variable

VB4090 Base receive buffer: Net data byte 12 Variable

VB4091 Base receive buffer: Net data byte 13 Variable

VB4092 Base receive buffer: Net data byte 14 Variable

VB4093 Base receive buffer: Net data byte 15 Variable

VB4094 Base receive buffer: Net data byte 16 Variable

VB4095 Base receive buffer: BCC Variable

*) Status bits:

½ Bit 0 - Transmission in progress; includes transmit and receive(evaluation by user)

½ Bit 1 - Transmit telegram complete

½ Bit 2 - Broadcast in progress (evaluation by user)

½ Bit 3 - Error from interrupt 3, 4, 5 (auxiliary flag for internal use)

Edition 10/99 How the driver works

Siemens AG - DriveES SIMATIC V5.0 15DRVUSS2 - Function Description

4 How the driver worksEach drive is given its own transmit and receive buffer for data exchange with themaster. The transmit and receive buffers for all the drives configured arecontiguous.

The user must enter the following basic driver parameters in the driver parameterrange (VB0 to VB39):

½ Number of slaves

½ Transmit buffer length (SLAE) of each slave

½ Transmit buffer length (SLAE) of the broadcast frame

½ Transmission cycle

½ Initial address of the transmit/receive range (eg: 2000 for VB2000)

The driver does not affect the content of the transmit/receive buffers and does notrespond to its content either. That is the responsibility of the user program. Theslave addresses cannot be assigned randomly by the user. The driverautomatically assigns address 1 to slave 1, address 2 to slave 2, etc..

4.1 InitializationIn the initialization phase, the data areas (transmit/receive buffers) are set up asdefined by the driver parameters. The first three bytes of the transmit buffer (STX,LAE, ADR) are pre-assigned the parameterized values from the parameterizationrange. The user then only has to assign the net data to the transmit buffers.

If the number of slaves is set as "0", only the broadcast transmit buffer is created..

IMPORTANT:Every time one or more parameters are changed in the parameter range, the PLCmust be restarted to cause re-initialization.

4.2 Cyclic transmission modeIt is a precondition that the cyclic transmission function has been enabled bysetting flag M1.0 and resetting flag M1.1 (enable broadcast). The number of slavesmust also be >0.

Cyclic frame exchange is ensured by the master. The master addresses all theslave nodes one after the other with a request frame. The nodes addressed eachsend back a response frame. The slaves are not processed using a polling list butin chronological sequence starting with the slave with address 1. When the masterhas processed the last drive, it automatically starts with the 1st slave again.

The response frame from the slave must arrive complete in the master beforeframe timeout (VW4066). Otherwise, the master enters an error in the status bytesof the corresponding slave and addresses the next node.

To ensure reliable frame exchange, the transmission cycle must be >=100ms.

At the start of transmission, the bit "transmission in progress" (V4075.0) is set. Withinterrupt 2 "transmission frame complete" (V4075.1), the acknowledgment delayand the frame monitoring time are started. Transition to the next drive is onlyperformed when a response frame has been received or one of the two times haselapsed.

How the driver works Edition 10/99

16 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

The transmit data must be transferred by the user program to the driver separatelyfor each drive by entry in the associated transmit buffer. These data are thentransmitted to the drive cyclically. During data transfer to a drive, bit V4075.0(transmission in progress) is set. While this bit is set, the user program must notwrite to the transmit buffers, otherwise the transmit data could be corrupted.

The receive data are first collected by the driver in the base receive buffer until theframe received is complete. If the driver has found the frame to be without error,the receive data are transferred from the base receive buffer to the receive bufferof the slave being processed. They must be transferred from there by the userprogram.

4.3 Broadcast modeIt is a precondition that the "broadcast" function has been enabled by setting flagM1.1.

If the driver is in broadcast mode, the cyclic transmission mode is not active. If theenable flag for cyclic transmission is still set, this has no effect on broadcastingbecause broadcasting has priority. However, a cyclic transmission that has alreadystarted is completed before switchover to broadcast mode..

In broadcast mode the data in the broadcast transmit buffer are transmittedcyclically at set time intervals (value in VW34). However, unlike in cyclictransmission mode, no response frame is expected from the drive.

While a broadcast is in progress, the status bits V4075.0 (transmission in progress)and V4075.2 (broadcast in progress) are set. At the end of the broadcast frame,both status bits are reset again.

If it is necessary to switch to cyclic transmission again, the user must blockbroadcasting (M1.1 = 0), and enable cyclic transmission again (M1.0 = 1). Abroadcast that is in progress is first completed.

NOTE:

In a broadcast frame to MASTERDRIVES, supplementary interpretation rules arerequired in the net data area of the frame in addition to the broadcast identifier (bit5 in the address byte) (see /1/).

Edition 10/99 How the driver works

Siemens AG - DriveES SIMATIC V5.0 17DRVUSS2 - Function Description

4.4 Status flags for the userThe following communication status flags are available for evaluation by the user:

Status bits in VB4075:

V4075.0 - Transmission in progress:

Indicates whether communication with a drive is active (applies to cyclictransmission and broadcasting). If this bit is set, the user must not write to thetransmit buffers.

V4075.2 - Broadcast in progress:

Indicates that a broadcast is active.

During and after receipt, two status bytes are assigned values to permit diagnosisof transmission errors. These status bytes are located directly after each receivebuffer and can contain the following values:

Communication status (status byte 1):

Bit 0 - Transmission in progress:

Communication with the drive assigned to this receive buffer is active.

Bit 1 - Transfer error:

Indicates that a communication error has occurred. If this bit is set, the errornumber is in status byte 2.

Error number (status byte 2):

½ 0 - No error

½ 1 - Frame timeout

½ 2 - Acknowledgment timeout

½ 3 - Error on receiving STX (parity error, buffer overflow, no STX)

½ 4 - Error on receiving LAE (parity error, buffer overflow, wrong frame length)

½ 5 - Error on receiving ADR (parity error, buffer overflow, wrong slave address)

½ 6 - Error on receiving net data (parity error, buffer overflow, wrong BCC)

4.5 Performance data½ Maximum number of slaves/drives : 31

(Variable VB0)

½ Baud rate (not variable) : 9600 baud

½ Transmission cycle (variable VW34) : >= 20 (equivalent to >= 100ms)

½ Bus cycle time : Transmission cycle * number of slaves;

½ Runtime of the driver

q No "broadcast" or "cyclic transmission" : 1ms

q "Broadcast" or "cyclic transmission" : 8ms

Example of calculating the bus cycle time:

Transmission cycle = 20 (100ms), number of slaves = 10 ---> Bus cycle time =100ms * 10 slaves = 1s.

Example program Edition 10/99

18 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

5 Example programThe example program can be loaded directly into the CPU memory.

5.1 Bus configuration and bus interfaceThe following diagram shows the bus configuration in the example program.

If a CPU215 or CPU216 is used as the USS master, observe the port setting(control register of freely programmable communication: special flags SMB30 forport 0 and SMB130 for port 1)!

SIMOREG SIMOREG

S7-200

Slave 1

Slave 2 Slave 3

SIMOVERTMICRO

MASTER

Slave 4

Master

SIMOVERTMASTERDRIVES

Port 0

Bus cable

½ The bus is implemented in RS485 technology with a shielded twisted-paircable. The SIEMENS PROFIBUS cable (order no.: 6XV1830-0AH10) can beused as the bus cable.

½ The bus cable must be laid in such a way that it is as free as possible frominterference.

Bus termination

The first and last nodes must be fitted with a terminating resistor.

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 19DRVUSS2 - Function Description

Equipotential bonding

An equipotential bonding conductor must be laid between the nodes (16 mm2

copper cable for lengths up to 200 m, 25 mm2 copper cable for lengths above200 m).

Bus connector on the S7-200

For connection to the S7-200 master, a 9-way subminiature D connector isrequired (e.g. PROFIBUS connector SIEMENS 6ES7972-0BA10-0XA0).

The cable shield (12mm) mustbe bare and contact the metalguide

Switch position = OffTerminating resistor disconnected

B = RS 485P = pin 3A = RS 485N = pin 8

Bus cabel fromone node

Bus cabel to the next node

Bus interface on MASTERDRIVES FC or VC with CU2

Screw/plug-in terminal X100 or 9-way subminiature D socket X300 on the PMU

X100 Assignment

1 RS485 P, USS bus interface SST2

2 RS485 N, USS bus interface SST2

3

4

5

X300 Assignment

1

2

3 RS485 P, USS bus interface SST1

4

5

6

7

8 RS485 N, USS bus interface SST1

9

Example program Edition 10/99

20 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

Terminate the bus (only necessary if the drive is the first or last node):

Interface Jumpers

SST1 Connect jumpers S1.1 and S1.2 of DIP-FIX S1 on the CU

SST2 Connect jumpers S2.1 and S2.2 of DIP-FIX S2 on the CU

Bus interface on MASTERDRIVES Motion Control Compact PLUS

4-way terminal block X100

X100 Assignment

33

34

35 RS485 P, USS bus interface

36 RS485 N, USS bus interface

9-way subminiature D socket X103 on the PMU

X103 Assignment

1

2

3 RS485 P, USS bus interface

4

5

6

7

8 RS485 N, USS bus interface

9

Terminate the bus (only necessary if the drive is the first or last node):

Switch S1 in position "ON"

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 21DRVUSS2 - Function Description

Bus interface on MASTERDRIVES Motion Control Compact or Vector Controlwith CUVC

Control terminal block X101 (CUVC), X103 (CUMC) or 9-way subminiature Dsocket X300 on the PMU

X101 (CUVC) Assignment

1

10 RS485 P, USS bus interface SST2

11 RS485 N, USS bus interface SST2

12

X103 (CUMC) Assignment

23

24

25 RS485 P, USS bus interface SST2

26 RS485 N, USS bus interface SST2

27 RS485 P, USS bus interface SST1

28 RS485 N, USS bus interface SST1

X300(CUVC,CUMC)

Assignment

1

2

3 RS485 P, USS bus interface SST1

4

5

6

7

8 RS485 N, USS bus interface SST1

9

Terminate the bus (only necessary if the drive is the first or last node):

SST1: Switch S1 in position "ON"

SST2: Switch S2 in position "ON"

Example program Edition 10/99

22 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

Bus interface on the MICRO-/MIDIMASTER (6SE31)

Control terminal block X501 or 9-way subminiature D socket X502 on the operatorpanel

X501 Assignment

1

13 RS485 P, USS bus interface

14 RS485 N, USS bus interface

20

X502 Assignment

1

2

3 RS485 P, USS bus interface

4

5

6

7

8 RS485 N, USS bus interface

9

Terminate the bus (only necessary if the drive is the first or last node):

On the MICRO-/MIDIMASTER, bus termination is achieved using a resistor(approx. 150 ohm) in the subminiature D connector or on the terminal block. If thefront subminiature D connector is used, a connector with an integrated switchablebus terminator can also be used (eg, PROFIBUS-DP connector).

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 23DRVUSS2 - Function Description

Bus interface on the MICRO-/MIDIMASTER (6SE32)

Control terminal block or 9-way subminiature D socket on the operator panel

Control terminals Assignment

1

24 RS485 P, USS bus interface

25 RS485 N, USS bus interface

26

27

Subminiature Dsocket

Assignment

1

2

3 RS485 P, USS bus interface

4

5

6

7

8 RS485 N, USS bus interface

9

Terminate the bus (only necessary if the drive is the first or last node):

On the MICRO-/MIDIMASTER, bus termination is achieved using a resistor(approx. 150 ohm) in the subminiature D connector or on the terminal block. If thefront subminiature D connector is used, a connector with an integrated switchablebus terminator can also be used (eg, PROFIBUS-DP connector).

Example program Edition 10/99

24 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

Bus interface on the SIMOREG K 6RA24

G-SST0 Assignment

X500.1

X500.2

X500.3 RS485 P, USS bus interface G-SST0

X500.4

X500.5

X500.6

X500.7

X500.8 RS485 N, USS bus interface G-SST0

X500.9

Terminate the bus (only necessary if the drive is the first or last node):

Jumper Position

XJ3 Position 1-2: No bus termination (state as supplied)

Position 2-3: Bus terminated

XJ4 Position 1-2: Bus terminated

Position 2-3: No bus termination (state as supplied)

XJ5 Position 1-2: Bus terminated

Position 2-3: No bus termination (state as supplied)

G-SST1 mitOption A1618

Assignment

X502.1

X502.2

X502.3 RS485 P, USS bus interface G-SST1

X502.4

X502.5

X502.6

X502.7

X502.8 RS485 N, USS bus interface G-SST1

X502.9

Terminate the bus (only necessary if the drive is the first or last node):

Jumper Position

XJ200 Position 1-2: Bus terminated

Position 2-3: No bus termination (state as supplied)

XJ201 Position 1-2: No bus termination (state as supplied)

Position 2-3: Bus terminated

XJ202 Position 1-2: Bus terminated

Position 2-3: No bus termination (state as supplied)

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 25DRVUSS2 - Function Description

5.2 Driver parametersNumber of nodes: 4

Telegram lengths:

Nodes: Address: Total frame length:Slave 1 - 1 14 byte

Slave 2 - 2 14 byte

Slave 3 - 3 14 byte

Slave 4 - 4 14 byte

Broadcast 32 14 byte

Transmission cycle: 20 (equivalent to 100ms)

Initial address of send/receive buffers: 2000 (equivalent to VB2000)

5.3 Transmit dataOperation by setting inputs of the S7-200. The following meanings are assigned tothe input bits:

Mode selection:I1.0 - Cyclic transmission modeI1.1 - Broadcast mode (drives 1 to 4 receive an "OFF" frame which

MASTERDRIVES (slave 1) does not evaluate.)

Control word setting:I1.2.- Drive 1 (slave 1) on/offI1.3 - Drive 2 (slave 2) on/offI1.4 - Drive 3 (slave 3) on/offI1.5 - Drive 4 (slave 4) on/off

Setpoint setting in IB0:I0.0 - 1.5625%I0.1 - 3.125%I0.2 - 6.25%I0.3 - 12.5%I0.4 - 25%I0.5 - 50%I0.6 - 100%I0.7 - Reverse

Description of the net data in the transmit buffer of the 1st slave. (The PKWrequests for slave 1 only apply to one MASTERDRIVES FC or VC with CU2.):VW2004 - PKW1 : contains the PKE for reading parameter 952 or 51.

PKE = 13B8H or 1033H.VW2006 - PKW2 : contains the value 0VW2008 - PKW3 : contains the value 0VW2010 - PZD1 : contains the control word for the 1st slaveVW2012 - PZD2 : contains the setpoint for the 1st slave

Example program Edition 10/99

26 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

Description of the net data in the receive buffer of the 1st slave:VW2024 - PKW1 : contains the PKE received from the 1st slave with the

value 13B8H for parameter 952 or 1033H forparameter 51.

VW2026 - PKW2 : contains the value 0VW2028 - PKW3 : contains the value of parameter 952 or 51 readVW2030 - PZD1 : contains the 1st process data word of the 1st slaveVW2032 - PZD2 : contains the 2nd process data word of the 1st slave

Description of the net data in the transmit buffer of the 2nd slave:VW2048 - PKW1 : contains the value 0 because no PKW request has been

executedVW2050 - PKW2 : contains the value 0VW2052 - PKW3 : contains the value 0VW2054 - PZD1 : contains the control word for the 2nd slave

VW2056 - PZD2 : contains the setpoint for the 2nd slave

Description of the net data in the receive buffer of the 2nd slave:W2068 - PKW1 : contains the value 0 because no PKW request has been

executedVW2070 - PKW2 : contains the value 0VW2072 - PKW3 : contains the value 0VW2074 - PZD1 : contains the 1st process data word of the 2nd slaveVW2076 - PZD2 : contains the 2nd process data word of the 2nd slave

Description of the net data in the transmit buffer of the 3rd slave:VW2092 - PKW1 : contains the value 0 because no PKW request has been

executedVW2094 - PKW2 : contains the value 0VW2096 - PKW3 : contains the value 0VW2098 - PZD1 : contains the control word for the 3rd slaveVW2100 - PZD2 : contains the setpoint for the 3rd slave

Description of the net data in the receive buffer of the 3rd slave:VW2112 - PKW1 : contains the value 0 because no PKW request has been

executedVW2114 - PKW2 : contains the value 0VW2116 - PKW3 : contains the value 0VW2118 - PZD1 : contains the 1st process data word of the 3rd slaveVW2120 - PZD2 : contains the 2nd process data word of the 3rd slave

Description of the net data in the transmit buffer of the 4th slave:VW2136 - PKW1 : contains the value 0 because no PKW request has been

executedVW2138 - PKW2 : contains the value 0VW2140 - PKW3 : contains the value 0VW2142 - PZD1 : contains the control word for the 4th slaveVW2144 - PZD2 : contains the setpoint for the 4th slave

Description of the net data in the receive buffer of the 4th slave:VW2156 - PKW1 : contains the value 0 because no PKW request has been

executedVW2158 - PKW2 : contains the value 0VW2160 - PKW3 : contains the value 0VW2162 - PZD1 : contains the 1st process data word of the 4th slaveVW2164 - PZD2 : contains the 2nd process data word of the 4th slave

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 27DRVUSS2 - Function Description

The driver parameters and the static transmit data only have to be assigned dataonce during start-up of the CPU.

All dynamic transmit data such as changes to control words (PZD), or changingPKW requests (see application example in Section "Cyclic program processing"),must be processed cyclically.

The example program includes the alternate reading of parameters 952 (number offaults) and 51 (access level) from slave 1. The parameter values received arewritten to the two selectable variables VW1002 and VW1004 .In the process data part of the transmit frames, the control word is transmitted withan ON/OFF command and the speed setpoint to all the slaves involved. Receipt ofthe process data is not evaluated in this example program. It must be implementedby the user for the application in question.

IMPORTANT:When transmitting PKW requests, make sure that a new PKW request (new PKE)is not written to the transmit buffer until the old PKW request has been completed!!(see extract of example program). A PKW request is considered completed if thecorresponding response identifier or error has been received from the slave.

5.3.1 Extract from the example programIn this program extract, the part of the example program is described that handlesPKW requests to the 1st slave.

Mutual inhibiting of parameters 952 and 51 during transmitting and receiving isensured in this example program with flags -M10.0 and M10.1.

Meaning of the auxiliary flags and their states:

M10.0 - This flag has state "0" if the read request for parameter 51 is beingprocessed and state "1" if the read request for parameter 952 is beingprocessed. This flag is responsible for automatic changeover of thetwo PKW requests during transmission and receiving in this example.

M10.1 - Indicates whether a read request has been started and that arrival of aparameter value is awaited. If this flag is set, only receipt of theparameter being processed is awaited. No new PKW request must beinitiated.

The parameter values received are written to the two selected variables VW1002and VW1004.

Example program Edition 10/99

28 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

5.3.2 Cyclic program execution// === Cyclic program execution ============================================

// === PKW request: alternate reading of parameters 952 and 51 from slave 1with address 1 ==============

// Receive evaluation of PKW request for ADR = 1LDW= 16#13B8, VW2024; // PKE of parameter 952 has been receivedA M10.1; // Wait for receiptA M10.0; // Parameter 952 is expectedMOVW VW2028, VW1002; // Storage of parameter 952 in a variable (here

VW1002))R M10.1, 1; // Receive terminated --> a new read request

can now be initiated again

LDW= 16#1033, VW2024; // PKE of parameter 51 has been receivedA M10.1; // Wait for receiptAN M10.0; // Parameter 51 is expectedMOVW VW2028, VW1004; // Storage of parameter 51 in a variable (here

VW1004)R M10.1, 1; // Receive terminated --> a new read request

can now be initiated again

// No new entries in transmit buffer if a request is in progressLD SM0.0; // RLO “1“A V4075.0; // "Transmission in progress"JMP 1; // ==> End --> wait until no request is being

processed

// Changing data transfer to PKW transmit buffer for ADR = 1LD SM0.0; // RLO “1“, positive result of logic operation

so that following statements can beprocessed

AN M10.1; // Receive terminated so that a new readrequest can be initiated

AN M10.0; // Last read request was parameter 51 -->change parameter number

S M10.0, 1; // Read request for parameter 952 is enteredS M10.1, 1; // Wait for receipt and do not start a new read

requestMOVW 16#13B8, VW2004; // Wait for receipt and do not start a new read

requestMOVW 16#0000, VW2006; // PKW 2 No indexMOVW 16#0000, VW2008; // PKW 3 No value on read initiation

LD SM0.0; // RLO“1“, positive result of logic operationso that following statements can beprocessed

AN M10.1; // Receive terminated so that a new readrequest can be initiated

A M10.0; // Last read request was parameter 952 -->change parameter number

R M10.0, 1; // Read request for parameter 51 is enteredS M10.1, 1; // Wait for receipt and do not start a new read

requestMOVW 16#1033, VW2004; // PKW 1 PKW request: read parameter 51

(access level)MOVW 16#0000, VW2006; // PKW 2 No indexMOVW 16#0000, VW2008; // PKW 3 No value on read initiation

. .

. .

. .LBL 1; // >>> L A B E L 1 <<< End. .. .

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 29DRVUSS2 - Function Description

5.4 Program listing with example user program (subroutine 2)// *************************************************************************// *** USS_Driver software with example application ******************// *************************************************************************//// Programs included:// OB 1 : Main program (cycle)// SBR 0 : Initialization// SBR 1 : Block communication interrupts/events (in "TERM" mode

only)// SBR 2 : Example application// INT 0 : Timebase// INT 2 : Transmit frame complete// INT 3 : Receive 1st character STX (02)// INT 4 : Receive 2nd character LAE (2 <= LAE <= 18)// INT 5 : Receive 3rd character ADR (1 <= ADR <= 31)// INT 6 : Receive 4th to nth character// INT 7 : Receive characters that arrive outside the frame delay

(receive buffer clearance)// Written by : Spanke, ANL A451-SY// Date : 29.08.1995// Driver version : 1.0// Changes : Example application revised, 12.03.1996////*****************************************************************************

// **************************************************************************// ******************* M A I N P R O G R A M *****************************// **************************************************************************

ORGANIZATION_BLOCK OB 1TITLE = COMMUNICATIONBEGIN

// === Set interface for PG or a free port and initialize communication ===LD SM0.7; // "RUN" modeA SM0.1; // 1st program cycleCALL 0; // ---> Call up initialization / set a free portLD SM0.7; // "RUN" modeEU; // Rising edgeCALL 0; // ---> Call up initialization / set a free port

// === In "TERM" mode, block communication interrupts/events ===LDN SM0.7; // "TERM" modeCALL 1; // ---> Block communication interrupts/events

// === User program ===LD SM0.0; // RLO “1“CALL 2;

MEND; // ***** End of main program****// ********************************************************************

Example program Edition 10/99

30 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

// *************************************************************// **************** S U B R O U T I N E 0 *******************// *************************************************************//// Standard software : Initialize communication / interface// With this sub, the following tasks are handled:// - Initialization of the serial interface// - Clearance of the driver system data area// - Initialization of the driver - system data area// - Clearance of the transmit and receive buffers// - Initialization of the transmit buffers with SLAE, STX, LAE, ADR// - Initialization of the transmit buffer for broadcast// - Other initializations// - Parameterization of time interrupt T0 for transmission cycle//// *************************************************************

SBR 0; // *** SUBROUTINE 0 ***

// === Initialization of the serial interface ===LD SM0.0; // RLO "1"MOVB 16#49, SMB30; // 9600 baud, even parity, 8 bits/ char.

// === Clearance of the driver system data area ===FILL 0, VW4022, 37; // Delete VB4022 - VB4095

// === Initialization of the driver system data area ===LDB<= VB0, 0; // Number of slaves <= 0MOVB 0, VB0; // ==> Limit number of slaves to 0LDB>= VB0, 31; // Number of slaves >= 31MOVB 31, VB0; // ==> Limit number of slaves to 31LD SM0.0; // RLO "1"MOVD &VB0, VD4030; // Initial address VB0MOVD VD4030, VD4034; // Intermediate step calculation of transmit

address+D VD36, VD4034; // Initial address transmit buffer node 1MOVD VD4034, VD4038; // Intermediate step calculation of receive

address+D 21, VD4038; // Initial address receive buffer node 1MOVD VD4034, VD4046; // Current pointer for transmit buffer

calculation node 1- XMOVB *VD4030, VB4061; // Number of nodesMOVD 0, AC1; // Reset ACCU 1MOVB VB4061, AC1; // Buffer number of nodesMUL 44, AC1; // Distance broadcast+D VD4034, AC1; // BufferMOVD AC1, VD4042; // Initial address broadcast frame

// === Clear the transmit and receive buffers including status and error byte===

FOR VW4058, 1, VW4060; // Beginning of loopFILL 0, *VD4046, 22; // ----- Clear+D 44, VD4046; // ----- Increment transmit/receive bufferNEXT; // End of loopMOVD VD4034, VD4046; // Enter initial value for current transmit

buffer pointer

// === Clear the broadcast transmit buffer ===FILL 0, *VD4042, 11; // Clear the broadcast transmit buffer; 22

words

// === Initialization of the transmit buffers with SLAE, STX, LAE, ADR ===MOVD VD4030, AC1; // Auxiliary pointer for parameter transferMOVD 0, AC2; // Reset ACCU 2INCD AC1; // Set pointer to 1st frame length

FOR VW4058, 1, VW4060; // Beginning of loopLDB<= *AC1, 4; // Frame length slave <= 4MOVB 4, *AC1; // ==> Limit frame length slave to 4LDB>= *AC1, 20; // Frame length slave >= 20

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 31DRVUSS2 - Function Description

MOVB 20, *AC1; // ==> Limit frame length slave to 20LD SM0.0; // RLO "1"MOVB *AC1, AC2; // ----- Auxiliary storage for frame lengthMOVB AC2, *VD4046; // ----- Entry SLAEINCD VD4046; // ----- Pointer transmit buffer +1MOVB 16#02, *VD4046; // ----- Entry STX

INCD VD4046; // ----- Pointer transmit buffer +1-I 2, AC2; // ----- SLAE - 2MOVB AC2, *VD4046; // ----- Entry LAEINCD VD4046; // ----- Pointer transmit buffer +1MOVB VB4059, *VD4046; // ----- Entry ADRINCD AC1; // ----- Set pointer to next frame length+D 41, VD4046; // ----- Set next transmit bufferNEXT; // End of loop

MOVD VD4034, VD4046; // Initial value for current transmit bufferpointer

// === Initialization of the transmit buffer for broadcast ===MOVD VD4042, AC1; // Auxiliary pointer for broadcastLDB<= VB32, 4; // Frame length broadcast <= 4MOVB 4, VB32; // ==> Limit frame length broadcast to 4LDB>= VB32, 20; // Frame length broadcast >= 20MOVB 20, VB32; // ==> Limit frame length broadcast to 20LD SM0.0; // RLO "1"MOVB VB32, *AC1; // Entry SLAEINCD AC1; // Auxiliary pointer for broadcast + 1MOVB 16#02, *AC1; // Entry STXINCD AC1; // Auxiliary pointer for broadcast + 1MOVB VB32, AC2; // Auxiliary calculation step-I 2, AC2; // Content of AC2 - 2MOVB AC2, *AC1; // Entry LAEINCD AC1; // Auxiliary pointer for broadcast + 1MOVB 16#20, *AC1; // Entry broadcast ADR = 32

// === Other initializations ===MOVW VW34, VW4066; // Auxiliary storage for transmission cycle

(cycle = VW34 * 5ms)-I 2, VW4066; // Adaptation of the monitoring time

(monitoring time = (VW34 - 2) * 5ms)

// === Parameterization of the time interrupt T0 for transmission cycle ===MOVB 5, SMB34; // Time interrupt every 5 msATCH +0, 10; // Time interrupt for driver processingATCH +7, 8; // Retriggering on receiptENI; // Enable all interruptsRET; // *** End of subroutine 0 ***

// ***********************************************************************// ************************ S U B R O U T I N E 1 **********************// ***********************************************************************//// This subroutine is called up if "TERM" mode has been selected.// The interface is therefore enabled for communication with the PG/PC and the// communication interrupts for the USS driver are blocked.//// ***********************************************************************

SBR 1; // SUBROUTINE 1

LD SM0.0; // RLO "1"MOVB 16#C0, SMB30; // Enable interface for PG/PCDTCH +8; // Block receive eventDTCH +9; // Block transmit eventDTCH +10; // Block time eventRET; // *** End of subroutine 1 ***

Example program Edition 10/99

32 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

//**********************************************************************//***************************** I N T E R R U P T 0 *******************// *********************************************************************//// Standard software : Timebase// Program INT0 is called up cyclically in the parameterized time intervals.// The following tasks are performed:// - Preparation and initiation of the transmit/broadcast frames// - Monitoring of the entire frame transmission time// - Monitoring of the acknowledgment delay// - Frame transition on an error//// *******************************************************************

INT 0; // *** INTERRUPT 0 ***

LD SM0.0; // RLO "1"INCW VW4062; // Interrupt counterLDW<= VW4062, VW34; // Comparison of the transmission cycle:

Acknowledgment delay <= transmission cycleJMP 1; // ---> Start monitoring routineLD SM0.0; // RLO "1"MOVW 1, VW4062; // Set interrupt counter to initial valueLD V4075.0; // Transmission in progressJMP 1; // ---> Start monitoring routineO M1.1; // Enable broadcast frameJMP 3; // ---> Broadcast processingLDB<= VB4061, 0; // Number of slaves <= 0 orON M1.0; // No enable of cyclic transmissionJMP 2; // ---> Terminate INT 0

// ======================================================================// === Preparation and initiation of transmit frame ===LD SM0.0; // RLO "1"MOVB 0, VB4075; // Reset "Transmission in progress", "Transmit

frame completed", "Broadcast in progress","Error"

S V4075.0, 1; // Set "Transmission in progress"MOVD 0, AC1; // Reset ACCU 1MOVW VW4068, AC1; // Current node numberMUL 44, AC1; // Calculate offset+D VD4034, AC1; // Initial node addressMOVD AC1, VD4054; // Transmission initiation address for S7

systemMOVD AC1, VD4046; // Current transmit buffer addressMOVD AC1, VD4050;+D 21, VD4050; // Current receive buffer address

// === BBC calculation ===MOVD 0, AC2; // Reset ACCU 2MOVB *VD4046, AC2; // SLAE-D 2, AC2; // Length for BCC calculationINCD VD4046; // Address on STXMOVD VD4046, AC1; // Store pointer in AC1MOVW 0, VW4058; // Set loop counter to initial valueMOVD 0, AC3; // Reset ACCU 3MOVW 0, VW4070; // Clear auxiliary wordLBL 5; // >>> L A B E L 5 <<< Beginning of loopMOVB *AC1, AC3; // -----XORW AC3, VW4070; // -----INCD AC1; // -----INCW VW4058; // -----LDW<= VW4058, AC2; // BCC calculation not yet completeJMP 5; // ----> Next valueLD SM0.0; // RLO "1"MOVB VB4071, *AC1; // Entry of BCC in transmit bufferINCD VD4046; // Increment pointer to current transmit

addressMOVB *VD4046, VB4028; // Entry of LAE for receive comparisonINCD VD4046; // Increment pointer to current transmit

address

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 33DRVUSS2 - Function Description

MOVB *VD4046, VB4029; // Entry of ADR for receive comparison+D 38, VD4046; // Set pointer to status byteINCW VW4068; // Increment nodeLDW>= VW4068, VW4060; // Compare highest nodeMOVW 0, VW4068; // 1st nodeLD SM0.0; // RLO "1"MOVD VD4046, AC1; // Address of 1st status byte in accu 1MOVB 16#01, *AC1; // Entry of "Transmission in progress" in

status byteINCD AC1; // Pointer to 2nd status byteMOVB 0, *AC1; // Clear error byteDTCH +8; // Block receiptATCH +2, 9; // Enable INT 2 for transmit eventXMT *VD4054, 0; // TransmitJMP 2; // ---> Terminate INT 0

// =====================================================================// === Preparation and initiation of broadcast frame ===LBL 3; // >>> L A B E L 3 <<<LD SM0.0; // RLO "1"MOVB 0, VB4075; // Reset "Transmission in progress", "Transmit

frame completed", "Broadcast in progress","Error"

S V4075.0, 1; // Set "Transmission in progress"S V4075.2, 1; // Set "Broadcast in progress"MOVD VD4042, AC1; // Broadcast addressMOVD AC1, VD4054; // Transmission initiation address for S7

systemMOVD AC1, VD4046; // Current transmit buffer address

// === BBC calculation ===MOVD 0, AC2; // Reset ACCU 2MOVB *VD4046, AC2; // SLAE-D 2, AC2; // Length for BCC calculationINCD VD4046; // Set pointer to STXMOVD VD4046, AC1; // Store pointer in AC1MOVW 0, VW4058; // Set loop counter to initial valueMOVD 0, AC3; // Reset ACCU 3MOVW 0, VW4070; // Clear auxiliary wordLBL 6; // >>> L A B E L 6 <<< Beginning of loopMOVB *AC1, AC3; // -----XORW AC3, VW4070; // -----INCD AC1; // -----INCW VW4058; // -----LDW<= VW4058, AC2; // BCC calculation not yet completeJMP 6; // ----> Next valueLD SM0.0; // RLO "1"MOVB VB4071, *AC1; // Entry of BCC in transmit buffer

+D 20, VD4046; // Set pointer to status byteMOVD VD4046, AC1; // Address of 1st status byte in accu 1MOVB 16#01, *AC1; // Entry of "Transmission in progress" in

status byteINCD AC1; // Pointer to 2nd status byteMOVB 0, *AC1; // Clear error byteDTCH +8; // Block receiptATCH +2, 9; // Enable INT 2 for transmit eventXMT *VD4054, 0; // TransmitJMP 2; // ---> Terminate INT 0

// === Monitoring of the entire frame transmission time ===LBL 1; // >>> L A B E L 1 <<<LDN V4075.0; // Not "Transmission in progress"MOVW 0, VW4072; // Reset total monitoring time counterJMP 2; // ---> Terminate INT 0LD SM0.0; // RLO "1"INCW VW4072; // Increment total monitoring time counterLDW<= VW4072, VW4066; // Total monitoring time not yet elapsedJMP 4; // ---> Monitoring of the acknowledgment delayLD SM0.0; // RLO "1"

Example program Edition 10/99

34 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

MOVB 0, VB4075; // Reset "Transmission in progress", "Transmitframe completed", "Broadcast in progress","Error"

MOVW 0, VW4064; // Reset acknowledgment delayMOVW 0, VW4072; // Reset total monitoring time counterMOVD VD4046, AC1; // Address of 1st status byte in accu 1MOVB 16#02, *AC1; // Entry of "Transmission error" in status byteINCD AC1; // Pointer to 2nd status byteMOVB 1, *AC1; // Entry of error message "Frame timeout"ATCH 7, 8; // Receive event on INT 7 (retriggering)JMP 2; // ---> Terminate INT 0

// === Monitoring of the acknowledgment delay ===LBL 4; // >>> L A B E L 4 <<<LDN V4075.1; // Transmit frame not yet transmitted

completelyMOVW 0, VW4064; // Reset acknowledgment delayJMP 2; // ---> Terminate INT 0LD V4075.1; // Transmit frame completeINCW VW4064; // Start acknowledgment delayLDW>= VW4064, 4; // Acknowledgment delay elapsed (acknowledgment

delay = 4 * 5ms)MOVB 0, VB4075; // Reset "Transmission in progress", "Transmit

frame completed", "Broadcast in progress","Error"

MOVW 0, VW4064; // Reset acknowledgment delayMOVW 0, VW4072; // Reset total monitoring time counterMOVD VD4046, AC1; // Address of 1st status byte in accu 1MOVB 16#02, *AC1; // Entry of "Transmission error" in status byteINCD AC1; // Pointer to 2nd status byteMOVB 2, *AC1; // Entry of error message "Acknowledgment

timeout"ATCH 7, 8; // Receive event on INT 7 (retriggering)LBL 2; // >>> L A B E L 2 <<<LD SM0.0; // RLO "1"RETI; // *** End of interrupt 0 ***

// *********************************************************************// ********************* I N T E R R U P T 2 **************************// *********************************************************************

// Standard software : Transmit frame complete// Program INT 2 is called up when transmission has been completed.// The following tasks are performed:// For cyclic transmission:// - Activate INT 3 to receive the 1st character STX// - Start the acknowledgment delay// - Reset INT 2 / event transmission// For broadcasting:// - Reset "Transmission in progress" for broadcast transmission and enable INT 7// - Reset INT 2 / event transmission

// **********************************************************************

INT 2; // *** INTERRUPT 2 ***LD V4075.2; // Broadcast in progressJMP 1; // ---> Broadcast processingLD SM0.0; // RLO "1"FILL 0, VW4076, 10; // Clear base receive bufferATCH 3, 8; // Activate receipt of 1st character STX (INT3)JMP 2; // ---> Terminate INT 2LBL 1; // >>> L A B E L 1 <<<MOVB 0, VB4075; // Reset "Transmission in progress", "Transmit

frame completed", "Broadcast in progress","Error"

ATCH 7, 8; // Start receive buffer clearanceLBL 2; // >>> L A B E L 2 <<<S V4075.1, 1; // Set "Transmit frame complete"DTCH 9; // Block INT 2RETI; // *** End of interrupt 2 ***

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 35DRVUSS2 - Function Description

// ***********************************************************************// ************************** I N T E R R U P T 3 ************************// ***********************************************************************//// Standard software : Receive 1st character STX// Program INT 3 is called up when the 1st character STX is received.// The following tasks are performed://- Reset the acknowledgment delay// - Check for parity// - Check for STX// - Transfer to base receive buffer// - Activate INT 4 for 2nd character// - Error handling//// ***********************************************************************

INT 3; // *** INTERRUPT 3 ***

LD SM0.0; // RLO "1"DTCH 8; // Block receiptMOVW 0, VW4064; // Reset acknowledgment delay counterMOVW 0, VW4026; // Set character counter to 0 for error

handling in INT 6LD SM3.0; // Parity errorO SM4.0; // Communication interrupt queue overflowO SM4.1; // Input interrupt queue overflowO SM4.2; // Timed interrupt queue overflowJMP 1; // ---> Error handlingLDB= 16#2, SMB2; // Not STXNOT;JMP 1; // ---> Error handlingLD SM0.0; // RLO "1"MOVB SMB2, VB4076; // Transfer STX to base receive bufferATCH 4, 8; // Activate receipt of 2nd character LAE (INT 4)JMP 2; // ---> Terminate INT 3LBL 1; // >>> L A B E L 1 <<< Error handlingMOVD VD4046, AC1; // Current status byte address to accu 1MOVB 16#02, *AC1; // Entry of "Transmission error" in status byteINCD AC1; // Pointer to 2nd status byteMOVB 3, *AC1; // Entry of error message "Error on receiving

STX"S V4075.3, 1; // Set error code for INT 7ATCH 7, 8; // Activate receive buffer clearance for

rejecting obsolete charactersLBL 2; // >>> L A B E L 2 <<<RETI; // *** End of interrupt 3 ***

// ***********************************************************************// ************************* I N T E R R U P T 4 ************************// ***********************************************************************//// Standard software : Receive 2nd character LAE// Program INT 4 is called up when the 2nd character LAE is received.// The following tasks are performed:// - Check for parity// - Check for LAE// - Reset character counter for net data// - Transfer to base receive buffer// - Activate INT 5 for 3rd character// - Error handling//// **********************************************************************

INT 4; // *** INTERRUPT 4 ***

LD SM0.0; // RLO "1"DTCH 8; // Block receiptMOVW 0, VW4064; // Reset acknowledgment delay counterMOVW 1, VW4026; // Character counter for net data to initial

value

Example program Edition 10/99

36 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

LD SM3.0; // Parity errorO SM4.0; // Communication interrupt queue overflowO SM4.1; // Input interrupt queue overflowO SM4.2; // Timed interrupt queue overflowJMP 1; // ---> Error handlingLDB= VB4028, SMB2; // LAE receipt != LAE transmit frameNOT;JMP 1; // ---> Error handlingLD SM0.0; // RLO "1"MOVB SMB2, VB4077; // Transfer LAE to base receive bufferATCH 5, 8; // Activate receipt of 3rd character ADR (INT5)JMP 2; // ---> Terminate INT 4LBL 1; // >>> L A B E L 1 <<< Error handlingMOVD VD4046, AC1; // Current status byte address to accu 1MOVB 16#02, *AC1; // Entry of "Transmission error" in status byteINCD AC1; // Pointer to 2nd status byteMOVB 4, *AC1; // Entry of error message "Error on receiving

LAE"S V4075.3, 1; // Set error code for INT 7ATCH 7, 8; // Activate receive buffer clearance for

rejecting obsolete charactersLBL 2; // >>> L A B E L 2 <<<RETI; // *** End of interrupt 4 ***

// ***********************************************************************// ******************** I N T E R R U P T 5 *****************************// ***********************************************************************//// Standard software : Receive 3rd character ADR// Program INT 5 is called up when the 3rd character ADR is received.// The following tasks are performed:// - Check for parity// - Check for ADR// - Transfer to base receive buffer// - Write pointer base receive buffer for transmission of net data to initial value// - Activate INT 6 for 4th to nth character// - Error handling//// ************************************************************************

INT 5; // *** INTERRUPT 5 ***

LD SM0.0; // RLO "1"DTCH 8; // Block receiptMOVW 0, VW4064; // Reset acknowledgment delay counterLD SM3.0; // Parity errorO SM4.0; // Communication interrupt queue overflowO SM4.1; // Input interrupt queue overflowO SM4.2; // Timed interrupt queue overflowJMP 1; // ---> Error handlingLDB= VB4029, SMB2; // ADR receipt != ADR transmit frameNOT;JMP 1; // ---> Error handlingLD SM0.0; // RLO "1"MOVB SMB2, VB4078; // Transfer ADR to base receive bufferINCW VW4026; // Increment character counterMOVD &VB4079, VD4022; // Write pointer base receive buffer for

transmission of net data to initial valueATCH 6, 8; // Activate receipt of 4th to nth character (INT6)JMP 2; // ---> Terminate INT 5LBL 1; // >>> L A B E L 1 <<< Error handlingMOVD VD4046, AC1; // Current status byte address to accu 1MOVB 16#02, *AC1; // Entry of "Transmission error" in status byteINCD AC1; // Pointer to 2nd status byteMOVB 5, *AC1; // Entry of error message "Error on receiving ADR"S V4075.3, 1; // Set error code for INT 7ATCH 7, 8; // Activate buffer clearance for rejecting

obsolete charactersLBL 2; // >>> L A B E L 2 <<<RETI; // *** End of interrupt 5 ***

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 37DRVUSS2 - Function Description

// ************************************************************************// ********************* I N T E R R U P T 6 ******************************// ************************************************************************//// Standard software : Receive 4th to nth character// Program INT 6 is called up when the 4th to nth character are received.// The following tasks are performed:// - Check for parity// - Transfer to base receive buffer// - Increment write pointer base receive buffer// - End of detection// - BCC check// - Reset "Transmission in progress"// - Transfer from base receive buffer to current receive buffer// - Activate INT 7 for detection of unassigned receive characters// - Error handling//// ***********************************************************************

INT 6; // *** INTERRUPT 6 ***

LD SM0.0; // RLO "1"DTCH 8; // Block receiptMOVW 0, VW4064; // Reset acknowledgment delay counterLD SM3.0; // Parity errorO SM4.0; // Communication interrupt queue overflowO SM4.1; // Input interrupt queue overflowO SM4.2; // Timed interrupt queue overflowJMP 1; // ---> Error handlingLD SM0.0; // RLO "1"MOVB SMB2, *VD4022; // Transfer character to base receive bufferINCD VD4022; // Increment write pointer of base receive

bufferINCW VW4026; // Increment character counterLDB<= VB4027, VB4077; // Not all characters received yetATCH 6, 8; // Activate receipt of 4th to nth character

(INT 6)JMP 7; // ---> Terminate INT 6 and wait for next

character

// === BBC calculation ===LD SM0.0; // RLO "1"MOVD &VB4076, AC1; // Address of STX of base receive bufferMOVW 0, VW4058; // Set loop counter to initial valueMOVD 0, AC2; // Reset ACCU 2MOVW 0, VW4070; // Clear auxiliary wordLBL 4; // >>> L A B E L 4 <<< Beginning of loopMOVB *AC1, AC2; // -----XORW AC2, VW4070; // -----INCD AC1; // -----INCW VW4058; // -----LDB<= VB4059, VB4077; // BCC calculation not yet completeJMP 4; // ----> Next value// === BCC check ===LDB= *AC1, VB4071; // BCC received = BCC expectedJMP 5; // ---> Transfer data to receive buffer

LBL 1; // >>> L A B E L 1 <<<LD SM0.0; // RLO "1"MOVD VD4046, AC1; // Current status byte address to accu 1MOVB 16#02, *AC1; // Entry of "Transmission error" in status byteINCD AC1; // Pointer to 2nd status byteMOVB 6, *AC1; // Entry of error message "Error on receiving

net data"JMP 6; // ---> Terminate INT 6

LBL 5; // >>> L A B E L 5 <<< Transfer data to receivebuffer

MOVD VD4046, AC1; // Current status byte address to accu 1MOVB 16#00, *AC1; // Reset entry of "Transmission in progress"

Example program Edition 10/99

38 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

INCD AC1; // Pointer to 2nd status byteMOVB 0, *AC1; // Clear error byteBMB VB4076, *VD4050, 20; // Block transfer of base receive buffer to

node receive bufferLBL 6; // >>> L A B E L 6 <<<MOVB 0, VB4075; // Reset "Transmission in progress", "Transmit

frame completed", "Broadcast in progress","Error"

ATCH 7, 8; // Activate buffer clearance for rejectingobsolete characters

LBL 7; // >>> L A B E L 7 <<<RETI; // *** End of interrupt 6 ***

// ***********************************************************************// ******************** I N T E R R U P T 7 *****************************// ***********************************************************************//// Standard software : Receive characters// Program INT 7 is called up whenever a character is received// outside the frame transmission time. Interrupt 6 is activated by a// frame error or by the end of frame.// The following tasks are performed:// In all cases:// - Retriggering of the acknowledgment delay// If an error occurred while receiving STX, LAE, ADR :// - Receipt of all characters to be expected without any other

activities//// ************************************************************************

INT 7; // *** INTERRUPT 7 ***

LD SM0.0; // RLO "1"MOVW 0, VW4064; // Reset acknowledgment delayLD V4075.3; // Error from INT 3 or INT 4 or INT 5INCW VW4026; // Increment character counterLDB>= VB4027, VB4028; // All expected characters receivedMOVB 0, VB4075; // Reset "Transmission in progress", "Transmit

frame completed", "Broadcast in progress","Error"

LD SM0.0; // RLO "1"RETI; // *** End of interrupt 7 ***

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 39DRVUSS2 - Function Description

// ************************************************************************// ******************** S U B R O U T I N E 2 ****************************// ************************************************************************//// Example user program:// 1. selection of the transmission mode// - M1.0 = identifier: Cyclic transmission// - M1.1 = identifier: Broadcasting// 2. USS driver parameterization// - Pre-assignment of the number of nodes// - Pre-assignment of the frame length of each node// - Pre-assignment transmission cycle, initial address of the

transmit/receive data areas// - Read two parameters from slave 1// - Assignment of PZD transmit data to each node//// **************************************************************************

SBR 2; // SUBROUTINE 2

// === USS driver parameterization ==========================================LD SM0.7; // "RUN" modeA SM0.1; // 1st program cycleS M0.1, 1; // Cold restart flagLD SM0.7; // "RUN" modeEU; // Positive edgeS M0.1, 1; // Cold restart flag

// === Processing on cold restart ===========================================LD M0.1; // Cold restart of PLC

(STOP --> RUN or TERM --> RUN)R M0.1, 1; // Reset cold restart flagMOVB 0, MB10; // Reset auxiliary flag

// Pre-assignment of the number of nodes (only once on cold restart)MOVB 1, VB0; // Number of nodes, max = 31

// Pre-assignment of the frame length of each node (once only on cold restart)MOVB 14, VB1; // Frame LAE node 1, max = 20 (16 bytes net

data + STX,LAE,ADR,BCC)MOVB 14, VB2; // Frame LAE node 2, max = 20 (16 bytes net

data + STX,LAE,ADR,BCC)MOVB 14, VB3; // Frame LAE node 3, max = 20 (16 bytes net

data + STX,LAE,ADR,BCC)MOVB 14, VB4; // Frame LAE node 4, max = 20 (16 bytes net

data + STX,LAE,ADR,BCC)MOVB 14, VB32; // Frame LAE broadcast, max = 20 (16 bytes net

data + STX,LAE,ADR,BCC)

// Pre-assignment of transmission cycle, initial address of transmit/receivedata areas (once only on cold restart)

MOVW 20, VW34; // Transmission cycle = 20 * 5msMOVD 2000, VD36; // Initial address transmit/receive data areas,

eg, 2000 = VB2000

// Assignment of PZD transmit buffer for broadcast (once only on cold restart)MOVW 16#047E, VW2186; // PZD 1 "OFF" (does not apply to MasterDrive)MOVW 16#0000, VW2188; // PZD 2 set speed = 0

// === Cyclic program execution ========================================

// === PKW request: alternate reading of parameters 952 and 51 from slave 1with address 1 ===

// Receive evaluation of PKW request for ADR = 1LDW= 16#13B8, VW2024; // Parameter 952 receivedA M10.1; // Wait for receiptA M10.0; // Parameter 952 is expectedMOVW VW2028, VW1002; // Storage of parameter 952R M10.1, 1; // Receiving terminated

Example program Edition 10/99

40 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

LDW= 16#1033, VW2024; // Parameter 51 receivedA M10.1; // Wait for receiptAN M10.0; // Parameter 51 is expectedMOVW VW2028, VW1004; // Storage of parameter 51R M10.1, 1; // Receiving terminated

// No new entries in transmit buffer if a request is in progressLD SM0.0; // RLO "1"A V4075.0; // "Transmission in progress"JMP 1; // ==> End

// Changing data transfer to PKW transmit buffer for ADR = 1LD SM0.0; // RLO "1"AN M10.1; // Receiving terminatedAN M10.0; // Last read request was parameter 51S M10.0, 1; // Read request for parameter 952 is enteredS M10.1, 1; // Wait for receiptMOVW 16#13B8, VW2004; // PKW 1 PKW request: read parameter 952

(number of faults)MOVW 16#0000, VW2006; // PKW 2MOVW 16#0000, VW2008; // PKW 3

LD SM0.0; // RLO "1"AN M10.1; // Receiving terminatedA M10.0; // Last read request was parameter 952R M10.0, 1; // Read request for parameter 51 is enteredS M10.1, 1; // Wait for receiptMOVW 16#1033, VW2004; // PKW 1 PKW request: read parameter 51

(access level)MOVW 16#0000, VW2006; // PKW 2MOVW 16#0000, VW2008; // PKW 3

// === PZD requests to slaves 1, 2, 3, 4 ===// Assignment of transmit buffer for ADR = 1 (slave 1: "MasterDrive" - 6SE70)LD SM0.0; // RLO "1" --> cyclic processingAN I1.2; // Input 1.2 not setMOVW 16#9C7E, VW2010; // PZD 1 "OFF"LD SM0.0; // RLO "1" --> cyclic processingA I1.2; // Input 1.2 setMOVW 16#9C7F, VW2010; // PZD 1 "ON"LD SM0.0; // RLO "1" --> cyclic processingMOVB IB0, VB2012; // PZD 2 set speedMOVB 0, VB2013;// Cyclic assignment transmit buffer for ADR = 2 (slave 2: "SIMOREG" - 6RA24)LD SM0.0; // RLO "1" --> cyclic processingAN I1.3; // Input 1.3 not setMOVW 16#047E, VW2054; // PZD 1 "OFF"LD SM0.0; // RLO "1" --> cyclic processingA I1.3; // Input 1.3 setMOVW 16#047F, VW2054; // PZD 1 "ON"

LD SM0.0; // RLO "1" --> cyclic processingMOVB IB0, VB2056; // PZD 2 set speedMOVB 0, VB2057;

// Cyclic assignment transmit buffer for ADR = 3 (slave 3: "SIMOREG" - 6RA24)LD SM0.0; // RLO "1" --> cyclic processingAN I1.4; // Input 1.4 not setMOVW 16#047E, VW2098; // PZD 1 "OFF"LD SM0.0; // RLO "1" --> cyclic processingA I1.4; // Input 1.4 setMOVW 16#047F, VW2098; // PZD 1 "ON"LD SM0.0; // RLO "1" --> cyclic processingMOVB IB0, VB2100; // PZD 2 set speedMOVB 0, VB2101;

// Cyclic assignment transmit buffer for ADR = 4 (slave 4: "MicroMaster" - 6SE30)LD SM0.0; // RLO "1" --> cyclic processingAN I1.5; // Input 1.5 not set

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 41DRVUSS2 - Function Description

MOVW 16#047E, VW2142; // PZD 1 "OFF"LD SM0.0; // RLO "1" --> cyclic processingA I1.5; // Input 1.5 setMOVW 16#047F, VW2142; // PZD 1 "ON"LD SM0.0; // RLO "1" --> cyclic processingMOVB IB0, VB2144; // PZD 2 set speedMOVB 0, VB2145;

LBL 1; // >>> L A B E L 1 <<< End

// === Selection of the transmission mode ===LD I1.0;= M1.0; // Identifier: Cyclic transmissionLD I1.1;= M1.1; // Identifier: Broadcasting

RET; // *** End of subroutine 2 ***

END_ORGANIZATION_BLOCK // ******* End of OB1 ********

// ***********************************************************

5.5 Parameterization of the drivesDirect coupling to a master via the USS protocol is possible via the basic driveconverter interface for MASTERDRIVES, the MICRO-/ MIDIMASTER and theSIMOREG K 6RA24. Add-on modules used in some units also provide a USSinterface. See the relevant Instruction Manual for parameterization of theseinterfaces in the units.

Parameterization of the basic drive converter interface for various units is givenbelow for the example program.

5.5.1 Parameterization of the USS interfaces for MASTERDRIVES FCor VC with CU2

Designation SST1 (X300) SST2 (X100)

Parameterizationenable

P053 = 6(parameterization enable SST1+PMU)

P053 = 34(parameterization enable SST2+PMU)

Node address P683, i001 = 0 P683, i003 = 0

Baud rate P684, i001 = 6 (baud rate 9600 baud) P684, i003 = 6 (baud rate 9600 baud)

Number of PKW P685, i001 = 3 (no. of PKW 3 words) P685, i003 = 3 (no. of PKW 3 words)

Number of PZD P686, i001 = 2 (no. of PZD 2 words) P686, i003 = 2 (no. of PZD 2 words)

Frame failure time P687, i001 = 1s P687, i003 = 1s

Control bit connection P554, i001 = 2001 (control word, bit 0= on/off1 = PZD1, bit 0)etc.

P554, i001 = 6001 (control word, bit 0= on/off1 = PZD1, bit 0)etc.

Setpoints P443, i001 =2002(main setpoint = PZD2)

P443, i001 = 6002(main setpoint = PZD2)

Actual values P681, i001 = 968 (status word = PZD1)

P681, i002 = 218(main actual value = PZD2)

P680, i001 = 968 (status word = PZD1)

P680, i002 = 218(main actual value = PZD2)

Example program Edition 10/99

42 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

5.5.2 Parameterization of the USS interfaces for MASTERDRIVES MCor VC with CUVCDesignation SST1 SST2

Parameterization enable P053 = 6 (parameterizationenable SST1+PMU)

P053 = 34 (parameterizationenable SST2+PMU)

Node address P700, i001 = 0 P700, i002 = 0

Baud rate P701, i001 = 6(baud rate 9600 baud)

P701, i002 = 6(baud rate 9600 baud)

Number of PKW P702, i001 = 3(no. of PKW 3 words)

P702, i002 = 3(no. of PKW 3 words)

Number of PZD P703, i001 = 2(no. of PZD 2 words)

P703, i002 = 2(no. of PZD 2 words)

Frame failure time P704, i001 = 1s P704, i002 = 1s

Control bit connection P554, i001 = 2001(control word, bit 0 = on/off1 =PZD1, bit 0etc.

P554, i001 = 6001(control word, bit 0 = on/off1 =PZD1, bit 0)etc.

Setpoints P443, i001 = 2002(main setpoint = PZD2)

P443, i001 = 6002(main setpoint = PZD2)

Actual values P680, i001 = 968status word= PZD1)

P680, i002 = 218(main actual value= PZD2)

P681, i001 = 968status word = PZD1)

P681, i002 = 218(main actual value= PZD2)

5.5.3 Parameterization of the USS interfaces for the MICRO-/MIDIMASTER

Designation Parameters

Access level P009 = 3

Operating authority internal orexternal

P910 = 1(control and setpoint setting via serial interface)

Bus address P091 = 1

Baud rate P092 = 6 baud rate 9600 baud)

Frame failure time P093 = 1s

Edition 10/99 Example program

Siemens AG - DriveES SIMATIC V5.0 43DRVUSS2 - Function Description

5.5.4 Parameterization of the USS interfaces for the SIMOREG K6RA24

Designation G-SST0 X500 (RS485) G-SST1 X502 (RS485)Option A1618 required!

Key parameters P051 = 20(parameterization enable)

P051 = 20(parameterization enable

Protocol selection P780 = 1192 (USS protocol) P790 = 1192 (USS protocol))

Node address P786 = 2 (slave 2),3 (slave 3)

P796 = 2 (slave 2),3 (slave 3)

Baud rate P783 = 6 (9600 baud) P793 = 6 (9600 baud)

Number of PKW(parameterizationinterface)

P782 = 3(no. of PKW 3 words)

P792 = 3(no. of PKW 3 words)

Number of PZD (processdata interface)

P781 = 2(no. of PZD 2 words)

P791 = 2(no. of PZD 2 words)

Frame failure time P787 = 1s P797 = 1s

PZD assignment forcontrol word and setpoints

(process data receivedfrom 6RA24)

P640 = 20(control word = PZD1)

P628.00 = 21(main setpoint = PZD2)

P640 = 36(control word = PZD1)

P628.00 = 37(main setpoint = PZD2)

PZD assignment for actualvalues

(process data transmittedby the 6RA24)

P784.00 = 325(status word = PZD1)

P784.01 = 167(actual value = PZD2)

P794.00 = 325(status word = PZD1)

P794.01 = 167(actual value = PZD2)

Versions Edition 10/99

44 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

6 VersionsThis driver was developed with:

Hardware:

½ PCD-4T with Microsoft Windows 3.11

½ SIMATIC S7-200 with CPU 214 (6ES7 214 - 1BC00-0XB0)

Software:

½ Configuration tool: STEP 7 - MICRO/DOS Version 1.1 (6ES7 810-2DA00-0YX0)

Edition 10/99 Literature

Siemens AG - DriveES SIMATIC V5.0 45DRVUSS2 - Function Description

7 Literature/1/: Universal Serial Interface Protocol USS® Protocol

Specification

/5/: SIMOVERT Master DrivesUse of the Serial Interfaces with USS ProtocolOrder No. 6SE7087-6CX87-4KB0Order from: A&D MC E23

/6/: PROFIBUS Profile Variable-Speed Drives, PROFIDRIVEPROFIBUS User Organization KarlsruheOrder No. 3.071

Abbreviations Edition 10/99

46 Siemens AG - DriveES SIMATIC V5.0DRVUSS2 - Function Description

8 AbbreviationsADR Adress byte

BCC Block check character

CB1 Communication board 1

CB24 Communication board 24

CPU Central processing unit

CP Communication processor

DVA Variable-speed drives

HSW Main setpoint

HIW Main actual value

IND Index in the PKW interface of the net data structure

INT Interrupt

LAE Frame length: ADR + net data + BCC

OB Organization block

PAFE Parameterization error

PKE Parameter ID in the net data structure

PKW Parameter ID value

PLC Programmable controller

PPO Parameter process data object (net data structure)

PWE Parameter value in the net data structure

PZD Process data

RLO Result of logic operation

QVZ Acknowledgment delay

SBR Subroutine

SLAE Total frame length:

STW Control word in the net data structure

STX Total frame length:

USS Universal serial interface

VB Variable byte

VD Variable double word

VW Variable word

ZSW Status word in the net data structure

Siemens AGBereich Automatisierungs- und Antriebstechnik (A&D)Geschäftsgebiet Motion Control Systems (MC)Postfach 3180, D-91050 Erlangen

Siemens Aktiengesellschaft

Siemens AG, 1999Subject to change without prior notice