+ All Categories
Home > Documents > 6076b1_e.pdf

6076b1_e.pdf

Date post: 16-Jan-2016
Category:
Upload: uriac86
View: 3 times
Download: 0 times
Share this document with a friend
Popular Tags:
140
Designation: Revision: Order No.: INTERBUS This manual is valid for: © Phoenix Contact 03/2001 6076BC01 Controller Board Software for Siemens SIMATIC S7-400 IBS S7 400 ETH DSC SWD UM E BC01 27 43 99 6 IBS S7 400 ETH DSC/I-T Order No. 27 31 10 2 User Manual
Transcript
Page 1: 6076b1_e.pdf

Designation:

Revision:

Order No.:

INTERBUS

This manual is valid for:

© Phoenix Contact 03/2001

6076BC01

Controller Board Software for Siemens SIMATIC S7-400

IBS S7 400 ETH DSC SWD UM E

BC01

27 43 99 6

IBS S7 400 ETH DSC/I-T Order No. 27 31 10 2

User Manual

Page 2: 6076b1_e.pdf
Page 3: 6076b1_e.pdf

Please Observe the Following Notes:

In order to guarantee the safe use of your device, we recommend that you read this manual carefully. The following notes give you information on how to use this manual.

Qualifications of the User Group

The products described in this manual should be installed/operated/maintained only by qualified application programmers and software engineers, who are familiar with automation safety concepts and applicable national standards. Phoenix Contact assumes no liability for damage to any products resulting from disregard of information contained in this manual.

Explication of Symbols Used

The attention symbol refers to an operating procedure which, if not carefully followed, could result in damage to equipment or personal injury.

The note symbol informs you of conditions that must strictly be observed to achieve error-free operation. It also gives you tips and advice on hardware and software optimization to save you extra work.

The text symbol refers you to detailed sources of information (manuals, data sheets, literature, etc.) on the subject matter, product, etc. This text also provides helpful information for the orientation in the manual.

We Are Interested in Your Opinion

We are constantly striving to improve the quality of our documents.

Should you have any suggestions or recommendations for improving the contents and layout of our documents, please send us your comments. Please use the fax form at the end of the manual for this purpose.

6076BC01

Page 4: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Statement of Legal Authority

This manual, including all illustrations contained herein, is copyright protected. Use of this manual by any third party in departure from the copyright provision is forbidden. Reproduction, translation and electronic or photographic archiving or alteration requires the express written consent of Phoenix Contact. Violators are liable for damages.

Phoenix Contact reserves the right to make any technical changes that serve the purpose of technical progress.

Internet

You will find current information on products from Phoenix Contact on the Internet at www.phoenixcontact.com.

6076BC01

Page 5: 6076b1_e.pdf

Table of Contents

1 Driver Software Tasks.......................................................................................1-3

2 INTERBUS Standard and Diagnostic Registers ...............................................2-3

2.1 Description of the Diagnostic Registers ..................................... 2-4

2.1.1 Diagnostic Status Register ............................................2-5

2.1.2 Diagnostic Parameter Register .....................................2-6

2.1.3 Diagnostic Register Indicators ......................................2-7

2.2 Description of Standard Functions ............................................. 2-9

2.2.2 Standard Function Status Register .............................2-10

2.2.3 Standard Function Parameter Register ......................2-11

2.3 System Control......................................................................... 2-12

2.3.1 Execution of a Standard Function Without Parameter Transfer (Example: Start INTERBUS) ........................2-12

2.3.2 Execution of a Standard Function With Parameter Transfer (Example: Disconnect Bus Segment) ...........2-13

3 INTERBUS Operating Modes ...........................................................................3-3

3.1 Asynchronous Mode .................................................................. 3-3

3.2 Asynchronous With Synchronization Pulse Mode...................... 3-3

4 Description of the Function Blocks....................................................................4-3

4.1 The Driver Software Floppy Disk ............................................... 4-4

4.2 Call Structure of the Driver Functions ........................................ 4-7

4.3 Description of the Structure........................................................ 4-9

4.4 Structure of Driver Descriptions ............................................... 4-10

4.5 Description of the Driver Functions .......................................... 4-11

4.5.1 FC 20 INIT_IB .............................................................4-11

4.5.2 FC 21 MEM_READ .....................................................4-20

4.5.3 FC 22 MEM_WRIT ......................................................4-24

6076BC01 i

Page 6: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.5.4 FC 24 IB_DIAG ...........................................................4-28

4.5.5 FC 25 IB_SERV ..........................................................4-32

4.5.6 FC 27 IB_FUNCT ........................................................4-35

4.5.7 FC 28 IB_ SYNC .........................................................4-37

4.6 Description of the INTERBUS Data Block IBDB ...................... 4-39

5 Application Examples........................................................................................5-3

5.1 Example Applications................................................................. 5-4

5.1.1 I/O Data Transport in Asynchronous Bus Operating Mode .............................................................................5-4

5.1.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode ................5-4

5.1.3 PCP Communication Using FC 25 ................................5-5

5.1.4 PCP Communication Using FC 27 ................................5-5

5.2 INTERBUS and Control System Configuration in the Examples ................................................................................... 5-6

5.3 Linking the Examples in Your Control System (Direct Operating Mode)............................................................. 5-7

5.4 Description of the Function Blocks in the Example (Direct Operating Mode)........................................................... 5-10

5.4.1 I/O Data Transport in Asynchronous Bus Operating Mode ..........................................................5-10

5.4.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode ..............5-12

5.4.3 PCP Communication Using FC 25 ..............................5-16

5.4.4 PCP Communication Using FC 27 ..............................5-26

5.5 Linking the Examples in Your Control System (Extended Operating Mode)..................................................... 5-31

ii 6076BC01

Page 7: 6076b1_e.pdf

Table of Contents

5.6 Description of the Function Blocks in the Example (Extended Operating Mode)..................................................... 5-33

5.6.1 I/O Data Transport in Asynchronous Bus Operating Mode ..........................................................5-33

5.6.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode ..............5-36

5.6.3 PCP Communication Using FC 25 ..............................5-40

5.6.4 PCP Communication Using FC 27 ..............................5-50

6 Technical Data for the Driver Functions............................................................6-3

6076BC01 iii

Page 8: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

iv 6076BC01

Page 9: 6076b1_e.pdf

Section 1

This section informs you about

– the advantages of using INTERBUS system functions,

– the three types of INTERBUS driver functions and

– the possibility of controlling INTERBUS using these blocks.

Driver Software Tasks ..........................................................................................1-3

6076BC01 1-1

Page 10: 6076b1_e.pdf

1-2 6076BC01

Page 11: 6076b1_e.pdf

Driver Software Tasks

1 Driver Software Tasks

The driver software for the IBS S7 400 ETH DSC/I-T controller board provides a variety of functions (INTERBUS system functions), which can be used to control INTERBUS via the PLC.

The bus configuration, including the process data assignment, is carried out using IBS CMD SWT G4 software.

To avoid long cycle times, the functions are tailored to the corresponding control system and are optimized and structured with regard to the program. Specific bits are set to operate the driver functions.

There are three types of driver functions:

1. Initialization driver

2. Send/receive functions (interface drivers)

3. Function-oriented drivers (e.g., diagnostic drivers)

The task of the initialization driver is to synchronize the INTERBUS system and the control system during startup. It also performs the basic settings of the INTERBUS system in a global data block. All basic settings of the subsequent driver blocks are available in this data block (IBDB).

The INTERBUS system I/O data is transferred via driver blocks. The same mechanism is also used for communication data. Such service-related data for intelligent end devices (parameterizable analog modules, frequency inverters, etc.) can either be preconfigured using IBS CMD SWT G4 and activated through an output of the controller board or processed with the application program using driver blocks.

Another type of function is application-related and provides the user with typical functions (e.g., acknowledgment, error handling, etc.) in preprogrammed format.

The INTERBUS system offers automatic diagnostics. This is automatically activated in the event of an error and the diagnostic result is communicated to the user and the control program in the diagnostic display and the diagnostic register. The user and the control program can now respond to the error. The response can take place directly via the standard function register. The functions behind this, such as "Refresh diagnostic display" (e.g., in the event of an I/O supply failure: PF indicator) and "Start INTERBUS" (in event of bus errors) serve as the error acknowledgment (bit 0 and bit 2 of the register). The example programs include a standard diagnostic and acknowledgment driver. This evaluates the diagnostic

6076BC01 1-3

Page 12: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

result (via the diagnostic status register or diagnostic parameter register) and gives a controlled acknowledgment of the error (with the standard function registers) automatically or via an acknowledge input.

Additional information on the specific applications of the driver functions can be found in the IBS S7 400 ETH DSC QS UM E Quick Start Guide (Order No. 27 43 98 3).

1-4 6076BC01

Page 13: 6076b1_e.pdf

Section 2

This section informs you about

– INTERBUS standard and diagnostic registers.

INTERBUS Standard and Diagnostic Registers ...................................................2-3

2.1 Description of the Diagnostic Registers ......................................2-4

2.1.1 Diagnostic Status Register.............................................2-5

2.1.2 Diagnostic Parameter Register ......................................2-6

2.1.3 Diagnostic Register Indicators .......................................2-7

2.2 Description of Standard Functions ..............................................2-9

2.2.2 Standard Function Status Register ..............................2-10

2.2.3 Standard Function Parameter Register .......................2-11

2.3 System Control..........................................................................2-12

2.3.1 Execution of a Standard Function Without Parameter Transfer (Example: Start INTERBUS) .........................2-12

2.3.2 Execution of a Standard Function With Parameter Transfer (Example: Disconnect Bus Segment)............2-13

6076BC01 2-1

Page 14: 6076b1_e.pdf

2-2 6076BC01

Page 15: 6076b1_e.pdf

INTERBUS Standard and Diagnostic Registers

2 INTERBUS Standard and Diagnostic Registers

The controller board has a set of registers for diagnostics and for easy control of the bus system.

This register set includes:

Three diagnostic registers:

– Diagnostic status register (input word)

– Diagnostic parameter register (input word)

– Extended diagnostic parameter register (input word)

Three standard function registers:

– Standard function start register (output word)

– Standard function parameter register (output word)

– Standard function status register (input word)

The registers are mapped in the analog I/O memory area of the control system according to the base address of the controller board. You can read from or write to the registers using direct I/O commands.

For additional information on the position of the INTERBUS registers, please refer to the IBS S7 400 ETH DSC QS UM E Quick Start Guide (Order No. 27 43 98 3).

6076BC01 2-3

Page 16: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

2.1 Description of the Diagnostic Registers

The diagnostic display is mapped to the control system by the diagnostic status register and diagnostic parameter register. These registers inform the control system of the current state of the INTERBUS system. In the application program, operating states, errors and other information are represented as inputs.

The extended diagnostic parameter register contains additional diagnostic information about the INTERBUS system (e.g., Inline devices). If an error occurs, this register is mapped using the FC 24 IB_DIAG diagnostic function in DBW 168 of the IBDB (global INTERBUS data block).

2-4 6076BC01

Page 17: 6076b1_e.pdf

INTERBUS Standard and Diagnostic Registers

2.1.1 Diagnostic Status Register

The diagnostic status register contains information on the state of INTERBUS. A state is assigned to each bit, which is described in more detail in the diagnostic parameter register.

Figure 2-1 Diagnostic status register

� � �

� � � � � �

� �

� � � � � �

� � � � � � � � � � � � � � � �

� � � � � � � � � � � � � � � � � � � � � � � ! � � � "

� � # � � � " � $ � � � � � % � � � & � � � ' � � � " � "

( � � � � % � � # � � � � � � � � � ) � � � � � � & � � � � * � � " � � %

+ � + ! � � � � % & � � � � � , � � � � "

� � � � � � � � " � � " � # ! � � � � � � � � � % � � � - � ) � � * � � � � � � � "

� � � � � � � . � ! ) � � � " � � � � � � � ) � �

/ � � � � � � � � # � � � " � � � � � � � " � � � � � � � � ' � � � " � "

� � �

� � � � � � � � 0 1

� � �

� � � � �

� � � �

� � � � * � � � � ) � # � ! ) �

� � � � � � � � � � � � � � � ) ) � � � , � � � " 2 � � � " $ � � � � # � ! ) �

� � � � � � � � � � & � � � � � � � � � � � � � � - �

� � � � � � ) ) � � � , � � � " � � � � � � � " � � � � * � � � � �

� � � � � � � � � � � � �

+ � + ! � � � � � � �

� � � � � � � � � % � � � � � � � � � ! � � � � � � � � � � � � - �

� � � � 3 � � ) � � � � " � � � � # � % ! � � � � � � � � � � � � � " � � � � * � � � � �

� .

� � � � � � � �0 1

4 1 0 4 � 1 1 5

6076BC01 2-5

Page 18: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

2.1.2 Diagnostic Parameter Register

The diagnostic parameter register provides additional information on the error indicated in the diagnostic status register. This is either

the error location (in the case of bus errors)

or the error code.

Figure 2-2 Diagnostic parameter register

Special case: If a local bus error cannot be located, byte n+1 of the diagnostic parameter register (error location) indicates the value 128 or bit 7 is set. The error is in the local bus segment indicated.

Whenever an error bit is set, the 16-bit diagnostic parameter register is rewritten. If no error bit is set, the register has the value 0.

For additional information please refer to the IBS SYS DIAG DSC UM E Diagnostics Guide.

�� � � �

� � � � � � � � � � � � � � % & � � � � % & � � � � � ! & , � �

� �

� ' � & * ) � 6 � " � - � � � � � ! & , � � � 7 8 �

9 0 9 0 + 1 � �

�� �������

�������������

�� � � �

� � � � � � � ! & , � �

� ' � & * ) � 6 � � " " � � � � � � - � � ) � * : � � � " � � 1 � 9 1 � � '

����������

9 ; 4 1 + 1 5 0

� � �

2-6 6076BC01

Page 19: 6076b1_e.pdf

INTERBUS Standard and Diagnostic Registers

2.1.3 Diagnostic Register Indicators

Operating Indicators (READY, ACTIVE, and RUN)

The operating indicators display the current state of the INTERBUS system. The parameter register is not used.

After POWER UP and selftest (display: TEST...) the controller board is ready for operation (READY bit = 1). The system is then parameterized using the memory card (display: BOOT...) and the appropriate INTERBUS configuration is selected. The system now indicates that it is active (display: ACTV: flashing; BA LED for the device flashing; ACTIVE bit = 1). After the system start (display: RUN, BA LED active, RUN bit = 1) INTERBUS data cycles are run and the control program can be started (READY, ACTIVE and RUN bits = 1).

Error Indication With Bus Disconnection (DETECT and BUS)

The active DETECT signal (DETECT = 1) indicates that an error is preventing further operation of the bus. The outputs fall back to 0 and the diagnostic routine searches for the cause of the error. When the cause has been identified, the DETECT bit is reset (DETECT = 0) and the error is displayed.

* For additional information, please refer to the IBS SYS DIAG DSC UM E Diagnostics Guide.

CTRL = 1: Error on the controller board/hardware fault. The parameter register indicates an error code*.

BUS = 1: The error occurred on a remote bus or local bus segment (consisting of a device and the INTERBUS path located in front of it). The parameter register indicates the type of error:

Remote bus error: Device number of the bus terminal module(e.g., 1.0: Bus segment 1. Device 0)

Local bus error: Device number of a local bus device(e.g., 1.3: Bus segment 1. Device 3)

6076BC01 2-7

Page 20: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Error Indication Without Bus Disconnection (PF and USER)

Errors are indicated by setting the PF (Peripheral Fault) and USER bits:

** Depending on messages given by the device (see device data sheet or user manual).

PF = 1: Error** on the application side of an INTERBUS device, e.g.,:

- Short circuit at the output

- No sensor/actuator supply

USER = 1: User operating error

2-8 6076BC01

Page 21: 6076b1_e.pdf

INTERBUS Standard and Diagnostic Registers

2.2 Description of Standard Functions

For direct influence on the bus system, the required basic functions are available in the standard registers. Predefined and frequently used functions can be executed by setting an output bit.

2.2.1 Standard Function Start Register

This register includes the start bits of the standard functions. A standard function is started when the corresponding bit is set.

New functions can only be executed after the preceding function has finished.

The following functions are assigned to the individual standard function start bits:

Figure 2-3 Assignment of frequently used functions in the standard function start register

In order to execute the functions marked 1) or 2), additional parameters are required, which must be transferred in the separate standard function parameter register.

Bits 7 to 15 of the standard function start register can only have the state "0". Setting bits 7 to 15 to "1" may cause errors in the INTERBUS system that could result in damage or personal injury.

1) Frame reference of the configuration stored in the parameterization memory (default setting: frame reference = 1)

2) INTERBUS device number:Byte n (bits 0 ... 7): Bus segmentByte n+1 (bits 0 ... 7): Position in the segment (see Figure 2-4)

+ � * � � � � " � - � � �

� � � � � � � � � � � � � � � � � % & � � �

� ) � � � � " � � % � � � � � � � " � � * ) � �

� � � � � � � � � � � � � � % & � � �

� � � � � ) � " � - � � � � , � * � � � � � %

� � * � � � � � , ! � � � � � � � & : � � � � � � � � ! � * ! � � �

� � " � � � ) � � � � � � � � � � � " � � � � # � % ! � � � � � �

� 9 0 � � � � � � �<

� � � � � � � � � � � � � � + � � � � � � � &

( ! � � � � � � � , � � � � � �� � � = � = � , � � � � � � ! � � �

4 1 0 4 � 1 1 �

� >

; >

; >

; >

; >

6076BC01 2-9

Page 22: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

2.2.2 Standard Function Status Register

The processing sequence can be controlled using the corresponding standard function status bit. As soon as the controller board detects the function request in the start bit, the corresponding status bit is set in the status register and remains active during processing. The assignment of the status bits corresponds to the assignment of the start bits.

After processing, the standard function start bit must be reset. Regardless of whether or not it was possible to execute the service successfully, the standard function status bit is reset to 0 after processing.

The standard function RESULT bit in the diagnostic status register indicates whether the function was executed successfully.

If the function was not completed successfully, an appropriate error message is stored in both the diagnostic status register and in the diagnostic parameter register. For the meanings of error messages, please refer to the IBS SYS DIAG DSC UM E Diagnostics Guide.

Standard function RESULT bit = 1: Function not completed successfully

Standard function RESULT bit = 0: Function completed successfully

2-10 6076BC01

Page 23: 6076b1_e.pdf

INTERBUS Standard and Diagnostic Registers

2.2.3 Standard Function Parameter Register

Some standard functions require a parameter to be specified for function execution. In general, this parameter is the number of the bus device. The device number consists of both the bus segment and position in the segment. Device numbers are assigned in binary format in the 16-bit standard function parameter register (see Figure 2-4).

Figure 2-4 Transferring the device number in the standard function parameter register

Example: Device number 2.3

Bus segment: 2dec 00000010bin

Position in the segment: 3dec 00000011bin

0 1 0 1

� � � � � � � � � � � � � � � � � � % & � � �+ ! � � � � % & � � �

1 1 1 1 1 1 � 1 1 1 1 1 1 1 � �

+ � � � * � � � � � � �

9 5 4 ? � 1 � ;

6076BC01 2-11

Page 24: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

2.3 System Control

Initiating, monitoring and completion of a standard function must be integrated in the application program.

2.3.1 Execution of a Standard Function Without Parameter Transfer (Example: Start INTERBUS)

Figure 2-5 Function execution without parameter transfer

1. The control program activates the standard function using the standard function start bit.

2. The standard function status bit indicates the function execution.

3. Resetting the standard function start bit terminates the function activation.

4. After the standard function status bit has changed to "0", the standard function result bit shows the result of the function execution (RESULT = 1: function not completed successfully).

� ! � * ! � � , � �/ � ; 4 � 8 1

� � * ! � � , � �� � ; 4 9 8 1

� � * ! � � , � �� � ; 9 4 8 ;

� � � " � � " � # ! � � � � � � �� � � � � � , � �

� � � " � � " � # ! � � � � � � �� � � ! ) � � , � �

� ; 7 5

� � � " � � " � # ! � � � � � � �� � � � ! � � , � �

9 0 9 0 � 1 1 ;

2-12 6076BC01

Page 25: 6076b1_e.pdf

INTERBUS Standard and Diagnostic Registers

2.3.2 Execution of a Standard Function With Parameter Transfer (Example: Disconnect Bus Segment)

Figure 2-6 Function execution with parameter transfer

1. Enter the parameter in the standard function parameter register.

2. The control program activates the standard function using the standard function start bit.

3. The standard function status bit indicates the function execution.

4. Resetting the standard function start bit terminates the function activation.

5. After the standard function status bit has changed to "0", the standard function result bit shows the result of the function execution (RESULT = 1: function not completed successfully).

The diagnostic status register contains the standard function result bit.

After setting the standard function status bit, the standard function start bit must be reset within 8 s.

� ; 7 5

� � � � & � � � �

9

9 0 9 0 � 1 1 7

� � � " � � " � # ! � � � � � �� � � � � � , � �

� � � " � � " � # ! � � � � � �� � � � ! � � , � �

� � � " � � " � # ! � � � � � �� � � ! ) � � , � � �

� � � " � � " � # ! � � � � � �* � � � & � � � � � � � % � � � � �

� ! � * ! � � , � �/ � ; 4 � 8 7

� � * ! � � , � �� � ; 4 9 8 7

� � * ! � � , � �/ � ; 9 4 8 ;

� ! � * ! � � $ � � "/ � � ; 4 ;

6076BC01 2-13

Page 26: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

2-14 6076BC01

Page 27: 6076b1_e.pdf

Section 3

This section informs you about

– INTERBUS operating modes.

INTERBUS Operating Modes ...............................................................................3-3

3.1 Asynchronous Mode ...................................................................3-3

3.2 Asynchronous With Synchronization Pulse Mode.......................3-3

6076BC01 3-1

Page 28: 6076b1_e.pdf

3-2 6076BC01

Page 29: 6076b1_e.pdf

INTERBUS Operating Modes

3 INTERBUS Operating Modes

The INTERBUS operating modes essentially determine the point in time when the driver software accesses INTERBUS data while the INTERBUS data cycles are running. Any interrupts that may be required for this purpose are generated by the controller board. You can set the operating modes in IBS CMD SWT G4.

The following operating modes are available.

3.1 Asynchronous Mode

Asynchronous to the INTERBUS data cycles, the application program and the driver software access the I/O data stored in the control system. This means that data from the current INTERBUS data cycles and the previous data cycles can be accessed. This may result in inconsistency in the transferred data.

Use this operating mode if:

– data consistency greater than 16 bits is not required

– no time restrictions are to be applied

3.2 Asynchronous With Synchronization Pulse Mode

Using this operating mode, INTERBUS I/O data can be transmitted consistently. The controller board firmware generates a synchronization pulse at the end of the INTERBUS cycle. From this point on, INTERBUS process data can be transmitted consistently from the driver blocks (read/write). In the control system, the driver software starts the next INTERBUS cycle with another synchronization pulse.

Use this operating mode to transfer data greater than 16 bits consistently between INTERBUS and the control system.

Please note that for "asynchronous with synchronization pulse" mode, the FC 28 IB_SYNC drive block must be integrated in your application.

6076BC01 3-3

Page 30: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

3-4 6076BC01

Page 31: 6076b1_e.pdf

Section 4

This section informs you about

– INTERBUS system functions for starting up and controlling INTERBUS,

– the parameter data required to use function blocks successfully within a certain configuration.

Description of the Function Blocks .......................................................................4-3

4.1 The Driver Software Floppy Disk ................................................4-4

4.2 Call Structure of the Driver Functions .........................................4-7

4.3 Description of the Structure.........................................................4-9

4.4 Structure of Driver Descriptions ................................................4-10

4.5 Description of the Driver Functions ...........................................4-11

4.5.1 FC 20 INIT_IB..............................................................4-11

4.5.2 FC 21 MEM_READ......................................................4-20

4.5.3 FC 22 MEM_WRIT.......................................................4-24

4.5.4 FC 24 IB_DIAG............................................................4-28

4.5.5 FC 25 IB_SERV...........................................................4-32

4.5.6 FC 27 IB_FUNCT.........................................................4-35

4.5.7 FC 28 IB_SYNC...........................................................4-37

4.6 Description of the INTERBUS Data Block IBDB .......................4-39

6076BC01 4-1

Page 32: 6076b1_e.pdf

4-2 6076BC01

Page 33: 6076b1_e.pdf

Description of the Function Blocks

4 Description of the Function Blocks

The IBS S7 400 ETH UM E User Manual (Order No. 27 40 09 6) includes a disk with functions in STEP 7 programming language. In addition to the drivers for the operation of the corresponding controller board, it contains example programs which can be directly linked to your application program. The controller board functions are described using these example programs in preprogrammed format. A description of the drivers and examples can be found in the following documentation and as a text file on the disk.

6076BC01 4-3

Page 34: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.1 The Driver Software Floppy Disk

Disk content

Installing the Driver Blocks on the Hard Disk of Your PC:

1. Start your PC.

2. Insert the IBS S7 400 DSC SWD driver disk.

3. Call the README.TXT file. This file contains additional information on using the files on the floppy disk.

4. Copy the IBSWD412.EXE and README.TXT files from the driver disk to your hard disk.

Select the main directory on your hard disk as the target directory (because of the path depth).

5. Call the IBSWD412.EXE program. The driver blocks and example applications are automatically extracted to the specified directory (default setting: "c:\"), when you select "UNZIP".

The driver blocks for the controller board are available as an S7 project file (IBSWD412.S7P). In the EX_XXX directories you can also find preprogrammed example applications for I/O data transport in asynchronous and asynchronous with synchronization pulse modes and for PCP operation with the corresponding IBS CMD G4 and S7 project files. The examples are stored separately in the EX_DOM and EX_EOM directories according to direct and extended mode.

Notes for Users of IBS S7... SWD Software

Ensure that the directory structure described on the following page is installed on your hard disk from the EXE file.

If INTERBUS driver software for S7 is already installed on your hard disk, the EXE file will add the additional directories and files to the existing structure.

(Drive): \IBSWD412.EXE Self-extracting file with driver blocks for the IBS S7 400 ETH DSC/I-T controller board

\README.TXT Function block description

4-4 6076BC01

Page 35: 6076b1_e.pdf

Description of the Function Blocks

File structure on the hard disk

Please note that the CMD files (*.BG4) must be copied to your IBS CMD project directory so that you can use the examples.

(Drive): \INTERBUS.S7 \S7_400 \ENGLISH

The following folders and files can be found in the ENGLISH directory:

\ENGLISH \IBSWD412 \IBSWD412 \IBSWD412.S7P

\FC20.TXT\FC21.TXT\FC22.TXT\FC24.TXT\FC25.TXT\FC27.TXT\FC28.TXT

\EX_DOM \IOASYNCH\IOASYIMP\PCPFC25\PCPFC27

\IOASYNCH.S7P\IOASYIMP.S7P\PCPFC25.S7P\PCPFC27.S7P

\IOASYNCH.BG4\IOASYIMP.BG4\PCPFC25.BG4\PCPFC27.BG4

\EX_EOM \IOASYNCH\IOASYIMP\PCPFC25\PCPFC27

\IOASYNCH.S7P\IOASYIMP.S7P\PCPFC25.S7P\PCPFC27.S7P

\IOASYNCH.BG4\IOASYIMP.BG4\PCPFC25.BG4\PCPFC27.BG4

6076BC01 4-5

Page 36: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Description of the file structure

Calling a Project File Under STEP 7

1. In the SIMATIC Manager, select the "Open" menu item.

2. In the "Browse" dialog box, select the disk drive in which the desired project can be found, e.g.,:

3. Double-click on the desired project file (IBSWD412.S7P).

File Description

IBSWD412.S7P S7 project file, contains the driver blocks

IOASYNCH.S7P S7 project files for I/O data transport in the bus operating modes

Asynchronous

IOASYIMP.S7P Asynchronous with synchronization pulse

PCPFC25.S7P S7 project files for PCP communication

Via FC 25

PCPFC27.S7P Via FC 27

IOASYNCH.BG4 IBS CMD files for I/O data transport in the bus operating modes

Asynchronous

IOASYIMP.BG4 Asynchronous with synchronization pulse

PCPFC25.BG4 IBS CMD files for PCP communication

Via FC 25

PCPFC27.BG4 Via FC 27

FC20.TXTFC21.TXTFC22.TXTFC24.TXTFC25.TXTFC27.TXTFC28.TXT

Description of the driver functions

- INTERBUS.S7 \S7_400 \ENGLISH\IBSWD412 \IBSWD412 \IBSWD412.S7P

4-6 6076BC01

Page 37: 6076b1_e.pdf

Description of the Function Blocks

4.2 Call Structure of the Driver Functions

Call structure for asynchronous mode

Figure 4-1 Call structure in asynchronous mode

Key:IBDB = INTERBUS data block

9 0 9 0 � 1 1 9

� � � �

� � � � �( � ( @ � � � � � ! �

� " " � � � � � � � �

" � � � � � #

� � � � �( � ( @ � � � �

� ! �

� ! �

� � � � �� + @ � � �

� � � � � �

� � � � �� + @ � � 3 � ! �

� � � � �� + @ . � � � � � ! �

� ! �� � � � �

� � � � @ � +

6076BC01 4-7

Page 38: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call structure for asynchronous with synchronization pulse mode

Figure 4-2 Call structure in asynchronous with synchronization pulse mode

Key:

IBDB = INTERBUS data block

In the above diagram, FC 28 is waiting for an interrupt in OB 1 from the controller board. When this interrupt is generated, the program branches into OB 40. An acknowledgment is sent to the controller board through FC 28. The read/write drivers are called via blocks FC 50 and FC 51, in order to transmit consistent data. This consistent data is available for processing after completion of OB 40 and FC 28.

If another interrupt is created, although FC 28 is not active, the program branches into OB 40, confirms the interrupt through FC 28, and jumps back into OB 1.

Default settings for the call structure described above must be made in IBS CMD in the "Operating Mode Options" dialog box. For additional information, please refer to the IBS S7 400 ETH DSC QS UM E Quick Start Guide, Order No. 27 43 98 3.

9 0 9 0 � 1 � ;

� � � �

� ! �� � � � � � � � � �

( � ( @

� � � �

� � � � �

( � ( @

� � � �

� ! �� � � � �� � � � $

� + @ � � �

� ! �

� � � � �

� + @ � � �

� � � � $

� � � � $

� + @ � � �

� � � � �

4-8 6076BC01

Page 39: 6076b1_e.pdf

Description of the Function Blocks

4.3 Description of the Structure

The INTERBUS system functions are designed as driver blocks. These system functions are called when starting the control system and in the cyclic program with conditional or absolute calls. The driver blocks are written in STEP 7.

The INIT_IB initialization function is called when starting up the control system (OB 100). This driver synchronizes the controller board with the control system and initializes the following function blocks using the common IBDB data block.

The I/O data is transmitted over the read/write functions MEM_WRIT/MEM_READ.

In the cyclic program (OB 1), the IB_DIAG driver evaluates the diagnostic result, acknowledges error messages and starts the INTERBUS system.

With the aid of the IB_SERV function the user is able to exchange PCP data between the controller board and the PCP devices, and can execute system management services.

The IB_FUNCT function controls the sequence of user functions defined in IBS CMD.

The IB_SYNC function ensures the transfer of consistent data greater than 16 bits in asynchronous with synchronization pulse mode.

The description of the driver blocks in Section 4.5, "Description of the Driver Functions", starting on page 4-11, applies to the direct and extended mode of the controller board. Differences are indicated in the appropriate places.

6076BC01 4-9

Page 40: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.4 Structure of Driver Descriptions

The functions are described according to the following pattern:

1. Tasks of the driver and its parameters and connections to other function blocks, if applicable.

2. Preconditions, for example for calling the driver.

3. Call structure of the function in STEP 7 syntax.

4. Description of the parameters used.

5. Marginal conditions to be noted, if applicable.

6. Description/listing of data blocks used, if applicable.

4-10 6076BC01

Page 41: 6076b1_e.pdf

Description of the Function Blocks

4.5 Description of the Driver Functions

4.5.1 FC 20 INIT_IB

Task The initialization function (FC 20) is called during the control system startup (OB 100). Its task is to synchronize the control system and the controller board. In addition, this driver controls the startup behavior of the controller board and parameterizes the software drivers (e.g., transfer of base addresses). It also enters data in the INTERBUS data block that is required by other functions. The controller board can also be parameterized using a parameterization data block created by IBS CMD, which contains the boot configuration.

Once the controller board and the INTERBUS system have been started, the function will be terminated.

To start FC 20 in OB 100, an activation bit must be set (BUSY parameter). This parameter remains set as long as the function is active. After the controller board has been parameterized and the INTERBUS system has been started, the function resets the activation bit (BUSY = 0). The result is displayed in the RET bit. If RET = 0, the INTERBUS system has been started and is ready to operate. If the RET bit is set (RET = 1), an error has occurred and, in the following examples, the control system is set to STOP. The diagnostic display, the diagnostic register and IBS CMD SWT G4 indicate the cause.

Depending on the operating mode (direct or extended), in which you would like to operate the controller board, different inputs must be made in FC 20.

For additional information, please refer to the IBS SYS DIAG DSC UM E Diagnostics Guide.

Preconditions The FC 20 INIT_IB function must be called in the startup OB.

6076BC01 4-11

Page 42: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call structure in direct mode

AN M10.0

S M10.0 // Set activation bit

CALL FC 20 // Initialization driver call

IBDB := DB20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the communication register, which was parameterized in

STEP 7

DIAG_STATE := 244 // S7 address of the diagnostic status register

DIAG_PARA := 246 // S7 address of the diagnostic parameter register

FKN_START := 248 // S7 address of the standard function start register

FKN_PARA := 250 // S7 address of the standard function parameter register

FKN_STATE := 250 // S7 address of the standard function status register

MEM_READ := 0 // Not used

MEM_WRITE := 0 // Not used

LOAD := 0 // Setting: loading the configuration

BOOT := 0 // INTERBUS startup

MODE := 0 // Controller board operating mode

TIMER_NR := T1 // Timer used

SOURCE := 0 // Parameterization data block number

CONFIGURATION := DW#16#F // Configuration of the block, controller board operating in direct mode.

RET := M10.1 // Result bit

BUSY := M10.0 // Activate function

4-12 6076BC01

Page 43: 6076b1_e.pdf

Description of the Function Blocks

Call structure in extended mode

AN M10.0

S M10.0 // Set activation bit

CALL FC 20 // Initialization driver call

IBDB := DB20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the controller board

DIAG_STATE := 0 // Not used

DIAG_PARA := 0 // Not used

FKN_START := 0 // Not used

FKN_PARA := 0 // Not used

FKN_STATE := 0 // Not used

MEM_READ := 21 // Number of the "read" driver

MEM_WRITE := 22 // Number of the "write" driver

LOAD := 0 // Setting: loading the configuration

BOOT := 0 // INTERBUS startup

MODE := 0 // Controller board operating mode

TIMER_NR := T1 // Timer used

SOURCE := 0 // Parameterization data block number

CONFIGURATION := DW#16#8000000F

// Configuration of the block, controller board operating in extended mode.

RET := M10.1 // Result bit

BUSY := M10.0 // Activate function

6076BC01 4-13

Page 44: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Parameter description

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

In direct mode, the S7 addresses for INTERBUS registers must be entered in the following six parameters. In extended mode, only the S7 base address of the controller board is entered, the other parameters contain the value "0".

Assign the base addresses in STEP 7. The procedure for assigning addresses can be found in the IBS S7 400 ETH DSC QS UM E Quick Start Guide (Order No. 27 43 98 3).

Direct Mode Extended Mode

COM_ADR S7 base address of the communication register

S7 base address of the controller board

DIAG_STATE S7 address of the diagnostic status register

= 0.

S7 addresses of the standard register are dependent on the base address of the controller board (COM_ADR). These register addresses are automatically assigned. Therefore, enter the value "0".

DIAG_PARA S7 address of the diagnostic parameter register

FKN_START S7 address of the standard function start register

FKN_PARA S7 address of the standard function parameter register

FKN_STATE S7 address of the standard function status register

4-14 6076BC01

Page 45: 6076b1_e.pdf

Description of the Function Blocks

In direct mode, the following two parameters are not used. Therefore, value "0" is entered. In extended mode, the value corresponds to the function number of the appropriate write or read driver.

LOAD The controller board is parameterized during startup of the entire system. The parameterization contains, for example, the bus configuration and the addressing. This parameter determines how to initialize and parameterize the controller board.

Direct Mode Extended Mode

MEM_READ = 0, not used Function number of the read driver. In the example FC 21: MEM_READ = 21.

MEM_WRITE = 0, not used Function number of the write driver. In the example FC 22: MEM_WRITE = 22.

LOAD Abbrev. Description

0 FLASH Loads the configuration from the parameterization memory

Prerequisite: Configuration with IBS CMD/parameterization memory

1 APPLIC Loads the configuration with function blocks of the application.

In p

repa

ratio

n

2 CMD_IB Loads the configuration with a CMD file and data blocks.

6076BC01 4-15

Page 46: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

BOOT The value of the BOOT parameter controls INTERBUS startup.

MODE This parameter sets the operating mode of the controller board.

TIMER_NR Number of a timer used by the function (the value depends on the CPU used).In the example, the value is "T1".

SOURCE Enter the number of the first parameterization data block used with parameterization mode 2 (LOAD = 2). This data block is parameterized under IBS CMD.

BOOT Description

0 Starts the bus system from the configuration.

1 Starts the bus system with configuration frame 1 using the initialization driver.

MODE Operating Mode

Abbrev. Description

0 Asynchronous A_SYN The INTERBUS cycle on the controller board runs asynchronously to the control system.

Setting in IBS CMD:asynchronous

2 Asynchronous with synchronization pulse

A_SYN_IMP The INTERBUS cycle is controlled by an interrupt from the controller board.

Setting in IBS CMD:asynchronous with synchronization pulse

4-16 6076BC01

Page 47: 6076b1_e.pdf

Description of the Function Blocks

CONFIGURATION The CONFIGURATION parameter reserves 32 configuration bits for INTERBUS blocks.

Direct or extended mode is specified using bit 31 of the controller board.

In the event of an error, only one error data item is indicated on the controller board. In addition, the diagnostic registers indicate this error data item. If bits 0 (PF), 1 (USER), 2 (BUS) and 3 (CTRL) are set to "0", additional error information can be obtained automatically using the FC IB_DIAG function.

Table 4-1 Bit entries of the CONFIGURATION parameter

Value Description

Bit

0 (P

F) 0 Using FC IB_DIAG, peripheral fault (PF) entries are

assigned a corresponding time stamp in IBDB. They are stored starting at DBW320.

1 No entry of error data in IBDB through FC IB_DIAG.

Bit

1 (U

SE

R) 0 Using FC IB_DIAG, user error (USER) entries are

assigned a corresponding time stamp in IBDB. They are stored starting at DBW290.

1 No entry of error data in IBDB through FC IB_DIAG.

Bit

2 (B

US

) 0 Using FC IB_DIAG, bus error (BUS) entries are assigned a corresponding time stamp in IBDB. They are stored starting at DBW210.

1 No entry of error data in IBDB through FC IB_DIAG.

7 �

� � � " � 1� � � " � �

10<� 9� 4; 7; 5

�� � �� � ;� � 7

4 1 0 4 � 1 1 7

7 ; �

����

+�

���

�.

�����-�"

1�2��

5

6076BC01 4-17

Page 48: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

For the assignment of the above entries to the corresponding data words, please refer to Table "Data words of the INTERBUS data block IBDB" on page 4-39.

RET This bit memory bit indicates whether an error occurred in the application.

Bit

3 (C

TR

L) 0 Using FC IB_DIAG, controller error (CTRL) entries are assigned a corresponding time stamp in IBDB. They are stored starting at DBW260.

1 No entry of error data in IBDB through FC IB_DIAG.

Bit

4 0/1 ReservedB

it 31 0 Controller board direct mode

1 Controller board extended mode

RET Description

0 The function was executed without errors.

1 An error occurred. The error cause is indicated in data word DBW56 of the INTERBUS data block IBDB. In this case, high byte DBB56 indicates an error number (see Table 4-2), while low byte DBB57 indicates the number of the faulty program step.

Table 4-2 Error numbers of FC INIT_IB in DBB56 of the IBDB

Error Number Description

1 Timeout

2 Negative result for "Stopping the bus system, resetting outputs and requesting a new configuration"

Table 4-1 Bit entries of the CONFIGURATION parameter

Value Description

4-18 6076BC01

Page 49: 6076b1_e.pdf

Description of the Function Blocks

Please ensure that, in the case of error numbers 1, 2 or 3, the parameterization stored in the parameterization memory corresponds to the installed bus configuration.

Check see if the bus is running (state RUN) when error number 1 is displayed.

Error numbers 2 and 3 only occur if the user has tried to start up the bus with set parameters LOAD = 0 and BOOT > 0. In this case, there is no valid parameterization or bus configuration available in the parameterization memory. In the event of an error, check your parameterization.

Check the base address and the mounting location of your controller board when error number 5 is displayed.

If error number 6 occurs, check the parameterization under IBS CMD.

BUSY To activate FC 20, set this bit memory bit on a positive edge. After processing, the function resets the bit.

3 Negative result for "Start_Data_Transfer"

4 Invalid LOAD parameter

5 Communication register cannot be addressed (incorrect base address, hardware error, etc.)

6 Parameterization sequence error (SOURCE indicates the DB with the faulty instruction):

- The faulty service code was entered in DBW74 in IBDB

- The displayed diagnostic status register is entered in the DBW76 in the IBDB

- The displayed diagnostic parameter register is entered in DBW78 in the IBDB

Table 4-2 Error numbers of FC INIT_IB in DBB56 of the IBDB

Error Number Description

6076BC01 4-19

Page 50: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.5.2 FC 21 MEM_READ

Task The FC 21 MEM_READ function reads data from the controller board and copies it to the specified destination area of the control system.

Call structure

Parameter descriptions

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

AN M11.0

S M11.0

CALL FC 21 // Driver call to read input data

IBDB := DB20 // INTERBUS data block

MODE := 1 // Operating mode of the function, here: read data records

SOURCE := 0 // Data source (INTERBUS)

DEST_AREA := 0 // Data destination area

DEST_AREA_NR := 0 // Data block number

DEST_OFFSET := 0 // Start address in the destination area

DEST_LENGTH := 0 // Number of words to be read

RET := M11.1 // Result bit

BUSY := M11.0 // Activate function

4-20 6076BC01

Page 51: 6076b1_e.pdf

Description of the Function Blocks

MODE This parameter defines the operating mode of FC MEM_READ.

SOURCE Data source in the INTERBUS system.

DEST_AREA The destination area of the read data is set here. Only relevant if MODE = 0.

MODE Description

0 Data transport from the INTERBUS (SOURCE) input level to the destination area of the control system (DEST_AREA).

1 - 4 In accordance with IBS CMD, enter the data record here to be read by FC MEM_READ. In order to read more than one data record, FC 21 must be called more than once: - One data record: Call FC 21: MODE = 1- Two data records: First call to FC 21: MODE = 1

Second call to FC 21: MODE = 2

A maximum of 4 different data records may be read.

5 - 9 Reserved

10 Handshake operation

MODE Source Area/SOURCE Parameter Entries

0 Address in the INTERBUS buffer

1 - 4, 5 - 9, 10

0, not used

DEST_AREA Data Destination

0 No input data storage

1 P area (I/O address area)

2 I area (process image - inputs)

3 Q area (process image - outputs)

4 M area (bit memory bits)

5 DB area (data blocks)

6076BC01 4-21

Page 52: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

DEST_AREA_NR If the entry of the DEST_AREA parameter = 5, enter the number of the destination data block. If DEST_AREA < > 5, this parameter will not be evaluated. Only relevant if MODE = 0.

DEST_OFFSET This parameter defines the start address of the data to be transmitted in the data destination area. Depending on the DEST_AREA parameter, the entry 8 may indicate IW8, MW8 or DBW8.Only relevant if MODE = 0.

DEST_LENGTH Enter the number of words to be transmitted. These words are copied to the destination area.Only relevant if MODE = 0.

RET This bit memory bit shows whether the function was carried out without errors (RET = 0). If an error occurred, the function is stopped and the parameter set to "1". An error number indicates the error cause in data word DBW58 of the INTERBUS data block IBDB.

Table 4-3 Error numbers of FC MEM_READ in DBW58 of the IBDB

Error Number Description

1 "DB 0" has been entered as the destination in the DEST_AREA_NR parameter.

2 A destination area that is not permitted has been entered in the DEST_AREA parameter.

3 An operating mode that is not permitted has been specified in the MODE parameter.

4 An invalid CR number (number of a PCP-compatible INTERBUS device) has been entered in the SOURCE parameter.

5 A data record that has not been activated in IBS CMD has been entered in the MODE parameter.

> 10 The Siemens system function called, SFC 59, has been processed negatively. The content of DBW 58 corresponds to the Siemens error code.

For additional information on Siemens error codes, please refer to the "Standard/System Functions" Siemens User Manual.

4-22 6076BC01

Page 53: 6076b1_e.pdf

Description of the Function Blocks

BUSY To call FC 21, set this bit memory bit on a positive edge. After processing, the function resets the bit.

6076BC01 4-23

Page 54: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.5.3 FC 22 MEM_WRIT

Task The FC 22 MEM_WRIT function writes data from the source area of the control system to the specified destination area on the controller board.

Call structure

Parameter descriptions

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

AN M12.0

S M12.0

CALL FC 22 // Driver call to write output data

IBDB := DB20 // INTERBUS data block

MODE := 1 // Operating mode of the function, here: write data records

SOURCE_AREA := 0 // Data source area

SOURCE_AREA_NR := 0 // Data block number

SOURCE_OFFSET := 0 // Start address in data source area

SOURCE_LENGTH := 0 // Number of words to be written

DESTINATION := 0 // Data destination (INTERBUS)

RET := M12.1 // Result bit

BUSY := M12.0 // Activate function

4-24 6076BC01

Page 55: 6076b1_e.pdf

Description of the Function Blocks

MODE This parameter defines the operating mode of FC MEM_WRIT.

SOURCE_AREA The source area of the data to be written is set here. Only relevant if MODE = 0.

SOURCE_AREA_NR If the entry of the SOURCE_AREA parameter = 5, enter the number of the source data block. If SOURCE_AREA < > 5, this parameter will not be evaluated. Only relevant if MODE = 0.

MODE Description

0 Data transport from the requisite source area of the control system (SOURCE_AREA) to the INTERBUS output level (DESTINATION).

1 - 4 In accordance with IBS CMD, enter the data record here to be written by FC MEM_WRIT. In order to write more than one data record, FC 22 must be called more than once: - One data record: Call FC 22: MODE = 1- Two data records: First call to FC 22: MODE = 1

Second call to FC 22: MODE = 2

A maximum of 4 different data records may be written.

5 - 9 Reserved

10 Handshake operation

SOURCE_AREA Data Source

0 No source indication for output data (e.g., data record operation)

1 P area (I/O address area)

2 I area (process image - inputs)

3 Q area (process image - outputs)

4 M area (bit memory bits)

5 DB area (data blocks)

6076BC01 4-25

Page 56: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

SOURCE_OFFSET This parameter is used to define the start address of the data to be transmitted in the source area. Depending on the SOURCE_AREA parameter, the entry 12 may indicate QW12, MW12 or DBW12.Only relevant if MODE = 0.

SOURCE_LENGTH Enter the number of words to be transmitted. These words are copied from the source area. Only relevant if MODE = 0.

DESTINATION Destination address for data in the INTERBUS system.

RET This bit memory bit shows whether the function was carried out without errors (RET = 0). If an error occurred, the function is stopped and the parameter set to "1". An error number indicates the error cause in data word DBW60 of the INTERBUS data block IBDB.

MODE Destination Area/DESTINATION Parameter Entries

0 Address in the INTERBUS buffer

1 - 4, 5 - 9, 10

0, not used

Table 4-4 Error numbers of FC MEM_WRIT in DBW60 of the IBDB

Error Number Description

1 "DB0" has been entered as a source in the SOURCE_AREA_NR parameter.

2 A source area that is not permitted has been entered in the SOURCE_AREA parameter.

3 An operating mode that is not permitted has been specified in the MODE parameter.

4 An invalid CR number (number of a PCP-compatible INTERBUS device) has been entered in the DESTINATION parameter.

4-26 6076BC01

Page 57: 6076b1_e.pdf

Description of the Function Blocks

BUSY To call FC 22, set this bit memory bit on a positive edge. After processing, the function resets the bit.

5 A data record that has not been activated in IBS CMD has been entered in the MODE parameter.

> 10 The Siemens system function called, SFC 58, has been processed negatively. The content of DBW 60 corresponds to the Siemens error code.

For additional information on Siemens error codes, please refer to the "Standard/System Functions" Siemens User Manual.

Table 4-4 Error numbers of FC MEM_WRIT in DBW60 of the IBDB

Error Number Description

6076BC01 4-27

Page 58: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.5.4 FC 24 IB_DIAG

Task The IB_DIAG function processes INTERBUS error messages together with the internal functions of the controller board. The diagnostic result is evaluated in the cyclic program and indicated by the diagnostic status register. In the event of errors, error messages are acknowledged either automatically or by pressing an external button (connected to a separate control system input) and the bus is restarted.

The driver evaluates the diagnostic status register bits PF (peripheral fault), USER (user error), BUS (bus error) and CTRL (controller board error).

After a BUS or CTRL error, the function of bit 0 in the standard function start register is initiated using the START_UP, ACTIVATE or AUTO_START parameters. If the diagnostic status register indicates a PF or USER error, the same parameters initiate the function of bit 2.

Bit 0 = start INTERBUS system

Bit 2 = update diagnostic display

If the AUTO_START parameter = 1, in the event of an error, IB_DIAG will try to start INTERBUS (BUS or CTRL) in accordance with a defined time pattern (in DBW 98 of the IBDB a preset interval of 2 seconds) or to update the diagnostic display (PF).

If the START_UP parameter = 1, IB_DIAG tries to start the bus once after startup and updates the diagnostic display.

4-28 6076BC01

Page 59: 6076b1_e.pdf

Description of the Function Blocks

Call structure

Parameter descriptions

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

ACTIVATE This parameter is controlled by a button which must be connected externally, and acknowledges an existing error. In the event of a bus error, the INTERBUS system is restarted. The diagnostic display is updated in the event of a peripheral fault or user error.

AUTO_START The AUTO_START parameter controls the function of bits 0 or 2 of the standard function start register.

CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I4.0 // Acknowledgment button

AUTO_START := M100.0 // Automatic restart

RUN := M100.1 // Message: INTERBUS active

PF := M100.2 // Peripheral fault

BUS_QUALITY := M100.3 // Transmission quality

DETECTION := M100.4 // Searching for bus error

BUSY_STATE := M100.5 // Function active

RET := M100.6 // Result bit

START_UP := M100.7 // INTERBUS start after control system startup (OB100)

AUTO_START Description

0 Only the ACTIVATE or Start_UP parameters can be used to activate the function of bits 0 or 2.

1 The function of bits 0 or 2 is activated automatically after an error. If the error cannot be removed, FC IB_DIAG reactivates bits 0 or 2 at preset intervals (see DBW98 in the IBDB).

6076BC01 4-29

Page 60: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

RUN The bit memory bit of the RUN parameter indicates the operating state of INTERBUS.

PF This bit memory bit indicates errors in the INTERBUS I/O.

BUS_QUALITY Evaluation of the transmission quality

= 1: quality not achieved= 0: quality achieved

The BUS_QUALITY bit provides additional service information to increase system availability. When this bit is set (BUS_QUALITY = 1), transmission errors have occurred.Check the transmission paths with the IBS CMD diagnostic software (evaluation of the transmission statistics) to avoid system errors in the long term.

Example:Use the BUS_QUALITY bit to detect aging effects in your system at an early stage (e.g., increased optical fiber cable attenuation or wear of trailing cables and slip rings). You can take appropriate measures in good time.

DETECTION After a bus error, the "RUN" bit in the diagnostic status register is deactivated and the "Diagnostic routine active" bit (DETECT) is activated. After error localization, the bit is reset.

RUN Description

0 INTERBUS is in the STOP state.

1 INTERBUS is in the RUN state.

PF Description

0 INTERBUS is not indicating a peripheral fault.

1 INTERBUS is indicating a peripheral fault. The device number is stored in the diagnostic parameter register.

4-30 6076BC01

Page 61: 6076b1_e.pdf

Description of the Function Blocks

BUSY_STATE Indicates that a standard function is active. During normal operation, i.e., no errors have occurred and the bus is in the RUN state, this message bit is reset to "0". If this function is active share for several PLC cycles, the bit is set to "1".

RET This bit memory bit shows whether the function was carried out without errors (RET = 0). If an error occurred, the function is stopped and the parameter set to "1".

START_UP This parameter activates and starts the INTERBUS system. If there is an error during startup, the INTERBUS system is started automatically after a cold or warm restart of the control system. However, this requires the bit memory bit to be set during control system startup.

The RUN and PF parameters are set according to the RUN (data transmission active) and PF (peripheral fault) bits of the diagnostic status register.

For additional information, please refer to the IBS S7 400 ETH DSC QS UM E Quick Start Guide. An error description can be found in the IBS SYS DIAG DSC UM E Diagnostics Guide.

6076BC01 4-31

Page 62: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4.5.5 FC 25 IB_SERV

Task The IB_SERV function sends services to the controller board and receives answers, which are evaluated and the RET bit set or not set, according to the result of the evaluation.

This function can be used for a maximum of 62 PCP devices (CR = 2 through 63) and for system management services (CR = 0). Please note that the execution status of the function must then be buffered. This is carried out by the INTERNAL parameter with a bit memory word reserved for the current CR.

The TOGGLE parameter must be connected with a bit that simulates a pulse timer. This timer creates the following pattern: "1/2 sec = 0; 1/2 sec = 1".

Call structure

Parameter descriptions

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

SOURCE_DB_NR Enter the number of the data block containing the service to be sent here (e.g., DB10).

SOURCE_DW_NR This parameter defines the data word start address in the send data block (e.g., DW0).

CALL FC 25 // IB_SERV driver call

IBDB := DB20 // INTERBUS data block

SOURCE_DB_NR := 10 // Number of the send data block

SOURCE_DW_NR := 0 // Start address in send data block

CR_NR := 2 // CR number of the PCP device

DEST_DB_NR := 11 // Number of the receive data block

DEST_DW_NR := 0 // Start address in receive data block

TOGGLE := M0.7 // Seconds bit

RET := M10.1 // Result bit

BUSY := M10.0 // Activate function

INTERNAL := MW60 // Internal buffer

4-32 6076BC01

Page 63: 6076b1_e.pdf

Description of the Function Blocks

CR_NR The CR_NR parameter defines either the communication reference (CR number) of the PCP device or system management operation."CR_NR = 2 through 63" for up to 62 PCP devices or "CR_NR = 0" for system management services.

DEST_DB_NR Enter the number of the data block in which the service to be received is stored in this parameter (e.g., DB11).

DEST_DW_NR This parameter defines the data word start address in the receive data block (e.g., DBW0).

TOGGLE This bit memory bit simulates a pulse timer, which delivers the value "0" or the value "1" every alternate half second. This variable must always be set.

RET This bit memory bit shows whether the function was carried out without errors (RET = 0). If an error occurred, the function is stopped and the parameter set to "1". An error number indicates the error cause in data word DBW62 of the INTERBUS data block IBDB.

BUSY To call FC 25, set this bit memory bit on a positive edge. After processing, the function resets the bit.

Table 4-5 Error numbers of FC IB_SERV in DBW62 of the IBDB

Error Number Description

1 Timeout:A time, preset by the system, was exceeded while waiting for a response. Check your call syntax and system.

2 A faulty confirmation code was received. Example: an initiate request set for the second time caused an abort. Check the sequence of the sent services.

3 Negative result. For example, a service was parameterized incorrectly or a system function was processed negatively.

6076BC01 4-33

Page 64: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

INTERNAL Buffers the execution status of the IB_SERV function.

A data word must be reserved for each PCP device. These can be in the data block, bit memory word or I/Q areas.

For additional information, please refer to the IBS S7 400 ETH DSC QS UM E Quick Start Guide. An error description can be found in the IBS SYS DIAG DSC UM E Diagnostics Guide.

4-34 6076BC01

Page 65: 6076b1_e.pdf

Description of the Function Blocks

4.5.6 FC 27 IB_FUNCT

Task The IB_FUNCT function is called in the cyclic program of the PLC. It executes the handshake for user functions defined under IBS CMD. Any necessary user data is transmitted with the MEM_READ and MEM_WRIT functions.

Call structure

Parameter descriptions

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

TIMER_NR Number of the timer used by FC 27 (e.g., T 2).

A I4.1

FP M40.0

S M11.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB20 // INTERBUS data block

TIMER_NR := T 2 // Timer used

RET := M11.1 // Result bit

START := DB3.DBX4.0 // User function start bit

STATE := DB2.DBX4.0 // User function status bit

RESULT := DB2.DBX5.0 // User function result bit

BUSY := M11.0 // Activate function

6076BC01 4-35

Page 66: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

RET This bit memory bit indicates whether the function was carried out without errors (RET = 0). If an error occurred, the function is stopped and the parameter set to "1". The error cause is indicated in data word DBW82 of the INTERBUS data block IBDB.

START Start bit of the user function to be executed.

STATE Status bit of the user function to be executed. Indicates the processing status of the user function.

RESULT Result bit of the user function to be executed. Indicates whether the user function was executed successfully.

BUSY To call FC 27, set this bit memory bit on a positive edge. After processing, the function resets the bit.

For additional information, please refer to the IBS S7 400 ETH DSC QS UM E Quick Start Guide. An error description can be found in the IBS SYS DIAG DSC UM E Diagnostics Guide.

Table 4-6 Error numbers of FC IB_FUNCT in DBW82 of the IBDB

Error Number Description

1 Timeout.The execution time of the user function (10 s) was exceeded. Check your parameterization.

2 The user function was not executed successfully. The RESULT parameter was set to "1".Check the parameterization of your user function.

4-36 6076BC01

Page 67: 6076b1_e.pdf

Description of the Function Blocks

4.5.7 FC 28 IB_ SYNC

Task This function must be called in OB 1 and in OB 40. Using the CYCLE_OB parameter (see below), the function detects from which OB it was called (see also Figure 4-2 on page 4-8). The function controls the protocol in asynchronous mode with synchronization pulse . It also calls functions to read and write the I/O data. In addition, FC 28 monitors the transfer of consistent data greater than 16 bits (see Figure 4-2 on page 4-8).

Preconditions The FC IB_SYNC function requires a read/write function to start up (in the example below FC 50 and FC 51). These functions must be programmed without parameters.

This function block is only required in asynchronous mode with synchronziation pulse.

Call structure

Parameter descriptions

IBDB This global INTERBUS data block with a length of 840 words is stored as DB20 on the driver disk in the user manual.

READ_FC For this parameter enter the function to be called to read input data.

WRITE_FC For this parameter enter the function to be called to write input data.

CYCLE_OB This parameter specifies the block in which FC 28 was called.

CALL FC 28 // IB_SYNC driver call

IBDB := DB20 // INTERBUS data block

READ_FC := FC50 // Function call to read input data

WRITE_FC := FC51 // Function call to write output data

CYCLE_OB := TRUE // Call identification

RET := M10.1 // Result bit

TRUE : FC 28 was called in OB 1.FALSE : FC28 was called in the alarm OB.

6076BC01 4-37

Page 68: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

RET This bit memory bit indicates whether the function was carried out without errors (RET = 0). If an error occurred, the function is stopped and the parameter set to "1". An error number indicates the error cause in data word DBW86 of the INTERBUS data block IBDB.

Example for an FC 50 read function:

Example for an FC 51 write function:

For additional information, please refer to the IBS S7 400 ETH DSC QS UM E Quick Start Guide. An error description can be found in the IBS SYS DIAG DSC UM E Diagnostics Guide.

Table 4-7 Error numbers of FC IB_SYNC in DBW86 of the IBDB

Error Number Description

1 The MODE parameter in FC INIT_IB was not set to "2". Check the value of the MODE parameter.

2 The last data cycle was not executed successfully. The function uses the data from the last error-free data cycle.

:AN M10.0 //

:S M10.0 //

CALL FC 21 // Call FC MEM_READ

IBDB := DB20 // INTERBUS data block

: : :: : :

:BE

:AN M10.0 //

:S M10.0 //

CALL FC 22 // Call FC MEM_WRIT

IBDB := DB20 // INTERBUS data block

: : :: : :

:BE

4-38 6076BC01

Page 69: 6076b1_e.pdf

Description of the Function Blocks

4.6 Description of the INTERBUS Data Block IBDB

Table 4-8 Data words of the INTERBUS data block IBDB

Data Word

Parameter Description

DBW56 ERR_Nr_INIT See "Error numbers of FC INIT_IB in DBB56 of the IBDB" on page 4-18.

DBW58 ERR_Nr_READ See "Error numbers of FC MEM_READ in DBW58 of the IBDB" on page 4-22.

DBW60 ERR_Nr_WRITE See "Error numbers of FC MEM_WRIT in DBW60 of the IBDB" on page 4-26.

DBW62 ERR_Nr_IB_SERV See "Error numbers of FC IB_SERV in DBW62 of the IBDB" on page 4-33.

DBW74 IB_INIT_ERR_PAR_CODE

See "Error numbers of FC INIT_IB in DBB56 of the IBDB" on page 4-18.

DBW76 IB_INIT_ERR_DIAG_STATE

See "Error numbers of FC INIT_IB in DBB56 of the IBDB" on page 4-18.

DBW78 IB_INIT_ERR_DIAG_PARA

See "Error numbers of FC INIT_IB in DBB56 of the IBDB" on page 4-18.

DBW82 ERR_Nr_IB_FUNCT See "Error numbers of FC IB_FUNCT in DBW82 of the IBDB" on page 4-36.

DBW86 ERR_NR_IB_SYNC See "Error numbers of FC IB_SYNC in DBW86 of the IBDB" on page 4-38.

DBW96 UPDATE_TIMER Timer number for the FC IB_DIAG diagnostic function

6076BC01 4-39

Page 70: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

DBW98 UPDATE_TIME Preset timer interval for FC IB_DIAG: 2 seconds

DBW168 DIAG_PARA_2 Entry of the extended diagnostic parameter register through FC IB_DIAG

DBW190 INTERRUPT_CNT Number of internal FC loops in asynchronous with synchronization pulse mode.

DBW200 Error_Counter_BUS_ERR

Number of bus errors (BUS)

DBD202 DATE_BUS_ERR Date of BUS error

DBD206 TIME_BUS_ERR Time of BUS error

DBW210 BUS_ERR_1 Initial error information about the BUS error

... ... ...

DBW248 BUS_ERR_20 Latest error information about the BUS error

DBW250 Error_Counter_CTRL_ERR

Number of errors that have occurred on the controller board (CTRL)

DBD252 DATE_CTRL_ERR Date of CTRL error

DBD256 TIME_CTRL_ERR Time of CTRL error

DBW260 CTRL_ERR_1 Initial error information about the CTRL error

... ... ...

Table 4-8 Data words of the INTERBUS data block IBDB

Data Word

Parameter Description

4-40 6076BC01

Page 71: 6076b1_e.pdf

Description of the Function Blocks

For more detailed error information, please refer to the Section "Error Codes" in the IBS SYS FW G4 UM E User Manual (Order No. 27 45 18 5).

DBW278 CTRL_ERR_10 Latest error information about the CTRL error

DBW280 Error_Counter_USER_ERR

Number of user/parameterization errors (USER)

DBD282 DATE_USER_ERR Date of USER error

DBD286 TIME_USER_ERR Time of USER error

DBW290 USER_ERR_1 Initial error information about the USER error

... ... ...

DBW308 USER_ERR_10 Latest error information about the USER error

DBW310 Error_Counter_PF_ERR

Number of peripheral faults (PF)

DBD312 DATE_PF_ERR Date of PF

DBD316 TIME_PF_ERR Time of PF

DBW320 PF_ERR_1 Initial error information about the PF

... ... ...

DBW830 PF_ERR_256 Latest error information about the PF

Table 4-8 Data words of the INTERBUS data block IBDB

Data Word

Parameter Description

6076BC01 4-41

Page 72: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4-42 6076BC01

Page 73: 6076b1_e.pdf

Section 5

This section informs you about

– the example applications provided with the software,

– integrating the examples in S7 software,

– the tasks of the parameters in the individual examples.

Application Examples ...........................................................................................5-3

5.1 Example Applications..................................................................5-4

5.1.1 I/O Data Transport in Asynchronous Bus Operating Mode..............................................................................5-4

5.1.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode .................5-4

5.1.3 PCP Communication Using FC 25.................................5-5

5.1.4 PCP Communication Using FC 27.................................5-5

5.2 INTERBUS and Control System Configuration in the Examples ....................................................................................5-6

5.3 Linking the Examples in Your Control System (Direct Operating Mode)..............................................................5-7

5.4 Description of the Function Blocks in the Example Direct Operating Mode).............................................................5-10

5.4.1 I/O Data Transport in Asynchronous Bus Operating Mode ...........................................................5-10

5.4.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode ...............5-12

5.4.3 PCP Communication Using FC 25...............................5-16

5.4.4 PCP Communication Using FC 27...............................5-26

5.5 Linking the Examples in Your Control System (Extended Operating Mode)......................................................5-31

5.6 Description of the Function Blocks in the Example (Extended Operating Mode)......................................................5-33

5.6.1 I/O Data Transport in Asynchronous Bus Operating Mode ...........................................................5-33

5.6.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode ...............5-36

5.6.3 PCP Communication Using FC 25...............................5-40

5.6.4 PCP Communication Using FC 27...............................5-50

6076BC01 5-1

Page 74: 6076b1_e.pdf

5-2 6076BC01

Page 75: 6076b1_e.pdf

Application Examples

5 Application Examples

The disk supplied with the IBS S7 400 ETH UM E User Manual (Order No. 27 40 09 6) contains various application examples. It contains the following executable programs for:

1. I/O data transport in asynchronous bus operating mode

2. I/O data transport in asynchronous with synchronization pulse bus operating mode

3. PCP communication over the IB_SERV (FC 25) driver

4. PCP communication over the IB_FUNCT (FC 27) driver

For the examples with PCP communication, the bus operating mode must be asynchronous.

The examples are designed to make programming your application easy and understandable. Examples (BG4 files for IBS CMD G4) for direct operating mode can be found in the \EX_DOM directory and examples for extended operating mode can be found in the \EX_EOM directory.

The corresponding STEP 7® project files are available in the \IOASYNCH, \IOASYIMP, \PCPFC25 and \PCPFC27 directories.

Please note that the CMD files (*.BG4) must be copied to your IBS CMD project directory in order to use the examples.

6076BC01 5-3

Page 76: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.1 Example Applications

The example applications for direct operating mode are in the EX_DOM directory, and in the EX_EOM directory for extended operating mode. The designation of the example is identical in direct and extended operating mode.

5.1.1 I/O Data Transport in Asynchronous Bus Operating Mode

This driver example shows how functions are parameterized under IBS CMD and STEP 7® for the transfer of I/O data (process data) between INTERBUS and the control system. INTERBUS is set to asynchronous mode in IBS CMD.

The following files are required:

– IBS CMD SWT G4: IOASYNCH.BG4

– STEP 7®: IOASYNCH.S7P

5.1.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode

This driver example shows how functions are parameterized under IBS CMD and STEP 7® for the transfer of I/O data (process data) between INTERBUS and the control system. INTERBUS is set to asynchronous mode with synchronization pulse in IBS CMD.

The following files are required:

– IBS CMD SWT G4: IOASYIMP.BG4

– STEP 7®: IOASYIMP.S7P

5-4 6076BC01

Page 77: 6076b1_e.pdf

Application Examples

5.1.3 PCP Communication Using FC 25

This driver example shows how functions are parameterized under IBS CMD and STEP 7® for communication with PCP-compatible INTERBUS devices over the IB_SERV (FC 25) block. INTERBUS is set to asynchronous mode in IBS CMD.

The following files are required:

– IBS CMD SWT G4: PCPFC25.BG4

– STEP 7®: PCPFC25.S7P

5.1.4 PCP Communication Using FC 27

This driver example shows how functions are parameterized under IBS CMD and STEP 7® for communication with PCP-compatible INTERBUS devices over the IB_FUNCT (FC 27) block. INTERBUS is set to asynchronous mode in IBS CMD.

The following files are required:

– IBS CMD SWT G4: PCPFC27.BG4

– STEP 7®: PCPFC27.S7P

Descriptions of the example applications can be found on the following pages of this section and as comment text in the organization blocks of each example.

6076BC01 5-5

Page 78: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.2 INTERBUS and Control System Configuration in the Examples

The following diagram shows the configuration of INTERBUS with connected devices and the control system, as it is in the examples.

Figure 5-1 Example configuration

The above figure shows the complete configuration for all the examples with PCP communication. In the examples for pure I/O data traffic, the V.24 module is not connected.

� �� % &

' ( � ) � & �� + � � 0 � 5 1 1 � � � A � � � 2 � �

� � " 8 � � 8 6 � ; 0 � 7 � � � 1 � ;

) � * � ( �) � � � � �

� ( � %

% �

4 1 0 4 � 1 1 ;

� � � � � � � � � � � ( + � ! � � , (

� 5 < 9 2 5 ; ;

� � � � ) � � 2 � � ( � " ! ) �� + � � � ; 5 � 3 8 ; 5� � " 8 � � � 8 6 � ; 0 ; 9 5 < 1

� �

� �

+ �

� �

� �

� ' � 2� ' �

9 4 0 <

� ; 7 5

� ; 7 ;

� � � � � � � # � � � �# � � � � �

� � � ( � � � � � - , (� � 6 � < � B < � >

� � � � � � � � � �� " � � �

� � � ( � � � � ! � � � . �� � 6 � � ? 1 � B + � � >

� � � � � � � � � �� � � " � � �

� � � ( � � � � ! � � � � . �� � 6 � � < ? � B + � � >

;� 7

' ( � ) � & �

/ 0 � � � # � � � � �

� � � ( � / 0 � �� � 6 � ; ; 1 � B � � � >

5-6 6076BC01

Page 79: 6076b1_e.pdf

Application Examples

5.3 Linking the Examples in Your Control System (Direct Operating Mode)

Ensure that:

– the controller board is locked in the control system

– the RS-232 cable is connected to INTERBUS and to the PC

– the power supply of the S7-400 control system is switched on.

1. Call IBS CMD and load the desired example file *.BG4 from the \EX_DOM directory.

If you want to use a bus configuration that is different from the example bus configuration in Figure 5-1 on page 5-6, you must carry out the following steps.

2. Parameterize your connected bus configuration.

Note that the parameterization preset in the example (see following table) will be lost when selecting "Read configuration frame from bus". Then you have to carry out step 3.

3. Parameterize the register addresses of the controller board according to the following table (default values):

4. Format the parameterization memory and then save your configuration on the parameterization memory.

Register Address in I/Q Area

Diagnostic status register I244

Diagnostic parameter register I246

Extended diagnostic parameter register I248

Standard function start register Q248

Standard function status register I250

Standard function parameter register Q250

6076BC01 5-7

Page 80: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5. Switch the voltage supply to the S7-400 control system off and back on (POWER ON). The controller board accepts the current data from the parameterization memory and changes to RUN if the configuration was parameterized correctly. In an error occurs, please check your configuration.

6. Now you can close IBS CMD.

7. Call your STEP 7® programming package and load the example *.S7P file, which corresponds to the CMD file selected above, from the \EX_DOM directory.

8. Perform an overall reset of the S7 CPU.

9. Assign the following addresses in the parameterization mask, as described in the Section "Integration of the Controller Board in STEP 7® (Direct Operating Mode)" in the Quick Start Guide:

S7 address Start address of the input/output data of your INTERBUS configuration in the S7 address area

S5 address Start address of the input/output data of your INTERBUS configuration in the S5 address area (coupling area)

Length Number of input/output bytes of your INTERBUS configuration

The values for the input and output addresses are identical.

10. Load the hardware configuration in the control system.

11. Load the example project in the control system.

12. Start the control system.

Entry S7 Address

S5 Address

Length Part of PI

Coupling Area

1 4 0 124 0 P

2 128 128 124 0 P

3 256 0 128 0 Q

4 384 128 124 0 Q

5 512* 252 4 0 P/Q

* The address of the communication register must be outside the process image.

5-8 6076BC01

Page 81: 6076b1_e.pdf

Application Examples

Asynchronous and asynchronous with synchronization pulse examples

The INTERBUS input/output module data is now available in the S7 CPU from the S7 address that you have parameterized.

If you can see the input data on your output module (displayed by the LEDs on the module), you have started the control system and INTERBUS without errors.

Examples of PCP communication with FC 25/FC 27

You can now send services to the V.24 module, with control through the input module in the control system. You can observe messages online in DB 11. In order to make full use of the examples, you must address a terminal program via the V.24 module.

6076BC01 5-9

Page 82: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.4 Description of the Function Blocks in the Example (Direct Operating Mode)

There follows a detailed description of the driver blocks used in each example.

5.4.1 I/O Data Transport in Asynchronous Bus Operating Mode

Call Structure in OB 100

FC 20 is called during startup (OB 100) to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required in the INTERBUS driver functions application. The base address of the communication register (COM_ADR) to be set corresponds to the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the communication register

DIAG_STATE := 244 // S7 address of the diagnostic status register

DIAG_PARA := 246 // S7 address of the diagnostic parameter register

FKN_START := 248 // S7 address of the standard function start register

FKN_PARA := 250 // S7 address of the standard function parameter register

FKN_STATE := 250 // S7 address of the standard function status register

MEM_READ := 0 // Not used

MEM_WRITE := 0 // Not used

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

BOOT := 0 // INTERBUS start from the parameterization memory

5-10 6076BC01

Page 83: 6076b1_e.pdf

Application Examples

Call Structure in OB 1

MODE := 0 // Operating mode: asynchronous

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#F // The controller board is operating in direct operating mode, additional error data is stored in the IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

S M100.7

AN M10.0 // If FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

Call the FC 24 diagnostic driver. The FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I0.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

6076BC01 5-11

Page 84: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.4.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode

This operating mode should be selected if data consistency of greater than 16 bits is required for I/O data traffic.

FC 28 waits in this operating mode in OB 1 for a process alarm interrupt from the controller board. If this interrupt is released to the control system, the program branches into OB 40. The controller board is informed that the interrupt has been detected through FC 28. The FC 50 and FC 51 functions control the transmission of consistent data. Following this a new INTERBUS cycle is started, and OB 40 is quit. FC 28 is also completed. If the controller board generates a new interrupt at this point, although OB 1 is not yet completed, the program branches into OB 40, and calls FC 28. This is immediately quit again without calling the FC 50/51 functions.

Call Structure in OB 100

After calling the FC 24 diagnostic driver, program your application. The inputs and outputs of the process image are directly available without calling additional driver functions.

Transmission of the input data from the INTERBUS input module to the INTERBUS output module.L IW 4

T QW 4

FC 20 is called during startup to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required by the INTERBUS driver functions in the application. The base address of the communication register (COM_ADR) to be set corresponds to the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call.

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the communication register

5-12 6076BC01

Page 85: 6076b1_e.pdf

Application Examples

DIAG_STATE := 244 // S7 address of the diagnostic status register

DIAG_PARA := 246 // S7 address of the diagnostic parameter register

FKN_START := 248 // S7 address of the standard function start register

FKN_PARA := 250 // S7 address of the standard function parameter register

FKN_STATE := 250 // S7 address of the standard function status register

MEM_READ := 0 // Not used

MEM_WRITE := 0 // Not used

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 2 // Operating mode: asynchronous with synchronization pulse

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#F // The controller board is operating in direct operating mode, additional error data is stored in the IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

S M100.7

AN M10.0 // If the FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

6076BC01 5-13

Page 86: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 1

Call FC 24 diagnostic driver. FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I0.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

It waits in FC 28 until the controller board generates an interrupt, then branches into OB 40 and consistent data is transferred. This data is available to the application program after FC 28 has been executed.CALL FC 28 // IB_SYNC driver call

IBDB := DB20 // INTERBUS data block

READ_FC := FC 50 // Function for reading the input data

WRITE_FC := FC 51 // Function for writing the output data

CYCLE_OB := TRUE // Default: FC 28 is called from OB 1.

RET := M14.0 // Fault during function processing.

You can now program your application.

5-14 6076BC01

Page 87: 6076b1_e.pdf

Application Examples

Call Structure in OB 40

Transmission of consistent input data from the INTERBUS input module to the INTERBUS output module via the buffer (MW) used in the FC 50/51 functions.L MW 400

T MW 410

BE

OB 40 is called during the program cycle if a process alarm is generated by the controller board. If the interrupt is generated while FC 28 is active, the FC 50/51 functions for reading/writing the I/O data are also executed. If FC 28 is not active when the interrupt is generated, the FC 50/51 functions are not called. In this case, only the protocol for this operating mode is controlled by FC 28.CALL FC 28 // IB_SYNC driver call

IBDB := DB20 // INTERBUS data block

READ_FC := FC 50 // Function for reading the input data

WRITE_FC := FC 51 // Function for writing the output data

CYCLE_OB := FALSE // FC 28 called by OB 40

RET := M12.0 // Fault during function processing

BE

Call Structure of FC 50/FC 51:

The FC 50 function is called by FC 28 to read consistent input data. The data is read using direct I/O access and transferred in the bit memory area (MW). This means that the data is also available in OB 1.L PIW 4

T MW 400

The FC 51 function is called by FC 28 to write consistent output data. The data is read from the bit memory area (MW) and also written using direct I/O access.L MW 410

T PQW 4

6076BC01 5-15

Page 88: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.4.3 PCP Communication Using FC 25

In the example, four PCP services in OB 1 that were parameterized in data block DB 10 are being sent to a V.24 module. This V.24 module can be used, for example, to send data to or receive data from a terminal program.

The following services are parameterized in the example in IBS CMD.

The services are started using inputs of the input module in the control system. The FC 21 and FC 22 functions implement the handshake necessary for the execution of FC 25.

INITIATE This service establishes a connection between the controller board and the V.24 module.

INIT_TABLE This service parameterizes the V.24 module with the following settings:

Protocol:Baud rate:Data width:Output type:

Transparent9600 baud8 bits, even parityRS-232

Please also make these settings in the terminal program.

V.24 SEND The text "TERMINAL" is sent from the controller board to the terminal program using this service.

V.24 RECEIVE A character string is sent from the terminal program to the controller board and read using this service.

5-16 6076BC01

Page 89: 6076b1_e.pdf

Application Examples

Call Structure in OB 100

FC 20 is called during startup to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required by the INTERBUS driver functions in the application. The base address of the communication register (COM_ADR) to be set corresponds to the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call.

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the communication register

DIAG_STATE := 244 // S7 address of the diagnostic status register

DIAG_PARA := 246 // S7 address of the diagnostic parameter register

FKN_START := 248 // S7 address of the standard function start register

FKN_PARA := 250 // S7 address of the standard function parameter register

FKN_STATE := 250 // S7 address of the standard function status register

MEM_READ := 0 // Not used

MEM_WRITE := 0 // Not used

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 0 // Operating mode: asynchronous

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#F // The controller board is operating in direct operating mode, additional error data is stored in the IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

6076BC01 5-17

Page 90: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 1

S M100.7

AN M10.0 // If the FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

Call FC 24 diagnostic driver. FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I0.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

The following function serves as a handshake function for executing the PCP services.

This function must be called in order to execute the PCP services.AN M10.0

S M10.0

CALL FC 21 // Calling the driver for executing the handshake

IBDB := DB 20 // INTERBUS data block

MODE := 10 // Handshake operation

SOURCE := 0 // Not used

DEST_AREA := 0 // Not used

DEST_AREA_NR := 0 // Not used

5-18 6076BC01

Page 91: 6076b1_e.pdf

Application Examples

DEST_OFFSET := 0 // Not used

DEST_LENGTH := 0 // Not used

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

Start the "INITIATE" service by means of input 0.1 to initialize the V.24 module (CR 2). The services to be sent are in DB 10 from address DBW 0. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-22.A I0.1

FP M40.0

S M11.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

SOURCE_DW_NR := 0 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device that should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

TOGGLE := M0.7 // Internal bit memory bit, creates a second clock.

RET := M11.1 // Fault during function processing.

BUSY := M11.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

6076BC01 5-19

Page 92: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Start the "INIT_TABLE" service by means of input 0.2 to parameterize the V.24 module (CR 2). The service to be sent is in DB 10 from address DBW 10. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-22.A I0.2

FP M40.1

S M12.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

SOURCE_DW_NR := 10 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device that should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

TOGGLE := M0.7 // Internal bit memory bit, creates a 1/2 second clock.

RET := M12.1 // Fault during function processing.

BUSY := M12.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

Start the "V.24 SEND" service by means of input 0.3 to send V.24 data. The service to be sent is in DB 10 from address DBW 40. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-22.A I0.3

FP M40.2

S M13.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

5-20 6076BC01

Page 93: 6076b1_e.pdf

Application Examples

SOURCE_DW_NR := 40 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device which should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

TOGGLE := M0.7 // Internal bit memory bit, creates a second clock.

RET := M13.1 // Fault during function processing.

BUSY := M13.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

Start the V.24 RECEIVE service by means of input 0.4 for receiving V.24 data. The service to be sent is in DB 10 from address DBW 60. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-22.A I0.4

FP M40.3

S M14.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

SOURCE_DW_NR := 60 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device that should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

6076BC01 5-21

Page 94: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Description of the DB 10 Data Block

TOGGLE := M0.7 // Internal bit memory bit, creates a 1/2 second clock.

RET := M14.1 // Fault during function processing.

BUSY := M14.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

The following function serves as a handshake function for executing the PCP services.

This function must be called in order to execute the PCP services.AN M15.0

S M15.0

CALL FC 22 // Driver call for executing the handshake

IBDB := DB 20 // INTERBUS data block

MODE := 10 // Handshake operation

SOURCE_AREA := 0 // Not used

SOURCE_AREA_NR := 0 // Not used

SOURCE_OFFSET := 0 // Not used

SOURCE_LENGTH := 0 // Not used

DESTINATION := 0 // Not used

RET := M15.1 // Fault during function processing.

BUSY := M15.0 // Function is active.

Address Parameter Length Value DescriptionDBW0 DienstCode INI WORD W#16#8B Service code for establishing the

connection to the V.24 module (initiate request)

ParaCountINI WORD W#16#2 Number of initiate request parameters

CR_NummerINI WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexINI WORD W#16#0 Index for initializing the connection establishment

reserviert WORD W#16#0 Reserved

5-22 6076BC01

Page 95: 6076b1_e.pdf

Application Examples

DBW10 DienstCodeINIT_TABLE WORD W#16#82 Service code for configuring the V.24 module (write request)

ParaCountINIT_TABLE WORD W#16#10 Number of write request parameters

CR_NummerINIT_TABLE WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexINIT_TABLE WORD W#16#5FFF Index for configuring the V.24 module

SubIndexINIT_TABLE BYTE B#16#0 The parameter defines which standard configuration settings should be revised. (in the example: 00 = revision of all settings).

LengthINIT_TABLE BYTE B#16#14 Volume of data to be modified. If all data is to be modified, enter 14hex here.

Protokoll BYTE B#16#0 Transmission protocol (in the example: 00 = transparent)

Baud_Rate BYTE B#16#7 Transmission rate (in the example: 07 = 9600 baud)

Datenbreite BYTE B#16#2 Data width (in the example: 02 = 8 bits, even parity)

reserviert1 BYTE B#16#0 Reserved

reserviert2 BYTE B#16#0 Reserved

Error_Pattern BYTE B#16#24 Character that is written to the buffer if an error occurs while receiving a V.24 character.

First_Delimiter BYTE B#16#D End character for dual buffer and end-to-end protocol (CR)

Second_Delimiter BYTE B#16#A End character for dual buffer and end-to-end protocol (LF)

Prioritaet BYTE B#16#0 3964R priority (in the example: 00 = low)

Ausgangstyp BYTE B#16#0 Output type (in the example: 00 = RS-232)

DTR_Steuerung BYTE B#16#0 DTR control (in the example: 00 = automatic)

Umlauf_Schalter BYTE B#16#0 (in the example: 00 = no rotation)

XON_Pattern BYTE B#16#11 Control character for XON/XOFF protocolXOFF_Pattern BYTE B#16#13

reserviert3 WORD W#16#0 Reserved

reserviert4 WORD W#16#0 Reserved

Address Parameter Length Value Description

6076BC01 5-23

Page 96: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

reserviert5 WORD W#16#0 Reserved

DBW40 DienstCodeWRITE WORD W#16#82 Service code for sending V.24 data (write request)

ParaCountWRITE WORD W#16#8 Number of write request parameters

CR_NummerWRITE WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexWRITE WORD W#16#5FE0 Index for sending V.24 data

SubIndexWRITE WORD W#16#A Volume of data to be sent (in the example: 10 characters)

data0 CHAR ’T’

data1 CHAR ’E’

data2 CHAR ’R’

data3 CHAR ’M’

data4 CHAR ’I’

data5 CHAR ’N’

data6 CHAR ’A’

data7 CHAR ’L’

data8 WORD W#16#A0D

DBW60 DienstCodeREAD1 WORD W#16#81 Service code for receiving the V.24 data (read request)

ParaCountREAD1 WORD W#16#3 Number of read request parameters

CR_NummerREAD1 WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexREAD1 WORD W#16#5FE0 Index for receiving V.24 data

SubIndexREAD1 WORD W#16#0 The parameter defines that all data is to be read.

Address Parameter Length Value Description

5-24 6076BC01

Page 97: 6076b1_e.pdf

Application Examples

Description of DB 11 Data Block

Address Parameter Length Value DescriptionDBW0 ConfirmationCode WORD Code of the received confirmation

Para_Count WORD Number of parameters of the received confirmation

CR_Nummer WORD CR number of the received confirmation

Result WORD Result of the received confirmation

data1 WORD

: WORD

data13 WORD

6076BC01 5-25

Page 98: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.4.4 PCP Communication Using FC 27

In the example, four PCP services in OB 1 that were parameterized as user functions in IBS CMD are being sent to a V.24 module. This V.24 module can be used, for example, to send data to or receive data from a terminal program.

The following services are parameterized in the example in IBS CMD.

The services are started using inputs of the input module in the control system. The required parameters (input and output data record 1) are transmitted using the FC 21 and FC 22 functions.

INITIATE This service establishes a connection between the controller board and the V.24 module.

INIT_TABLE This service parameterizes the V.24 module with the following settings:

Protocol:Baud rate:Data width:Output type:

Transparent9600 baud8 bits, even parityRS-232

Please also make these settings in the terminal program.

V.24 SEND The text "TERMINAL" is sent from the controller board to the terminal program using this service.

V.24 RECEIVE A character string is sent from the terminal program to the controller board and read using this service. The character string is output in data block DB 3 from DBW 10.

5-26 6076BC01

Page 99: 6076b1_e.pdf

Application Examples

Call Structure in OB 100

FC 20 is called during startup to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required by the INTERBUS driver functions in the application. The base address of the communication register (COM_ADR) to be set corresponds to the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call.

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the communication register

DIAG_STATE := 244 // S7 address of the diagnostic status register

DIAG_PARA := 246 // S7 address of the diagnostic parameter register

FKN_START := 248 // S7 address of the standard function start register

FKN_PARA := 250 // S7 address of the standard function parameter register

FKN_STATE := 250 // S7 address of the standard function status register

MEM_READ := 0 // Not used

MEM_WRITE := 0 // Not used

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 0 // Operating mode: asynchronous

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#F // The controller board is operating in direct operating mode, additional error data is stored in IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

6076BC01 5-27

Page 100: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 1

S M100.7

AN M10.0 // If FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

Call FC 24 diagnostic driver. FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I0.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

Transmit the CR number of a PCP device to the address parameterized in IBS CMD.L 2

T QB 6

Start a user function ("INITIATE" service) by means of input 0.1 to initialize the V.24 module.A I0.1

FP M40.0

S M11.0

5-28 6076BC01

Page 101: 6076b1_e.pdf

Application Examples

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M11.1 // Fault during function processing.

START := Q8.0 // Start bit of the user function parameterized in IBS CMD.

STATE := I8.0 // Status bit of the user function parameterized in IBS CMD.

RESULT := I9.0 // Result bit of the user function parameterized in IBS CMD.

BUSY := M11.0 // Function is active.

Start a user function ("INIT_TABLE" service) by means of input 0.2 to parameterize the V.24 module.A I0.2

FP M40.1

S M12.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M12.1 // Fault during function processing.

START := Q8.1 // Start bit of the user function parameterized in IBS CMD.

STATE := I8.1 // Status bit of the user function parameterized in IBS CMD.

RESULT := I9.1 // Result bit of the user function parameterized in IBS CMD.

BUSY := M12.0 // Function is active.

Start a user function ("V.24 SEND" service) by means of input 0.3 to send V.24 data.A I0.3

FP M40.2

S M13.0

CALL FC 27 // IB_FUNCT driver call

6076BC01 5-29

Page 102: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M13.1 // Fault during function processing.

START := Q8.2 // Start bit of the user function parameterized in IBS CMD.

STATE := I8.2 // Status bit of the user function parameterized in IBS CMD.

RESULT := I9.2 // Result bit of the user function parameterized in IBS CMD.

BUSY := M13.0 // Function is active.

Start a user function ("V.24 RECEIVE" service) by means of input 0.4 to receive V.24 data.A I0.4

FP M40.3

S M14.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M14.1 // Fault during function processing.

START := Q8.3 // Start bit of the user function parameterized in IBS CMD.

STATE := I8.3 // Status bit of the user function parameterized in IBS CMD.

RESULT := I9.3 // Result bit of the user function parameterized in IBS CMD.

BUSY := M14.0 // Function is active.

5-30 6076BC01

Page 103: 6076b1_e.pdf

Application Examples

5.5 Linking the Examples in Your Control System (Extended Operating Mode)

Ensure that:

– the controller board is locked in the control system

– the RS-232 cable is connected to INTERBUS and to the PC

– the voltage supply of the S7-400 control system is switched on

1. Call IBS CMD and load the desired example file *.BG4 from the \EX_EOM directory.

After loading the CMD example file, you can find the following entries in IBS CMD in the dialog box "Settings... IBS Data Records":

These entries apply to all the examples described in the following section. The example of PCP communication with FC 27 is an exception, as the length is 110 bytes, and the area used DBB0 through DBB109.

In the example the base address of the controller board is address 512. The address of the input data word (16-bit input module for INTERBUS) is DB2.DBB0 and the address of the output data word (16-bit output module for INTERBUS) is DB3.DBB0.

If your bus configuration does not correspond to the example bus configuration, parameterize your bus configuration and allocate the addresses for input and output data, according to the example. Following the example, the data blocks (DB) must be set as input/output areas.

2. Format the parameterization memory, and then save your configuration on the parameterization memory.

3. Switch the voltage supply to the S7-400 control system off and back on (POWER ON). The controller board accepts the current data from the parameterization memory and changes to RUN if the configuration was parameterized correctly. In an error occurs, please check your configuration.

Record Area Data Block Offset Length

Input area 1 DB DB 2 0 bytes 10 bytesDBB0 - DBB9

Output area

1 DB DB 3 0 bytes 10 bytesDBB0 - DBB9

6076BC01 5-31

Page 104: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

4. Call your STEP 7® programming package and load the example *.S7P file, which corresponds to the CMD file selected above, from the \EX_EOM directory.

5. Perform an overall reset of the S7 CPU.

6. Load the example hardware configuration in the control system (see Figure 5-1 on page 5-6) as described in the Section "Integrating the Controller Board in STEP 7® (Extended Operating Mode)" in the Quick Start Guide.

7. Load the example project in the control system.

8. Start the control system.

Asynchronous and asynchronous with synchronization pulse examples

The INTERBUS input and output module data is now available in the data records parameterized in IBS CMD.

If you can see the input data on your output module (displayed by the LEDs on the module), you have started the control system and INTERBUS without errors.

Examples of PCP communication with FC 25/FC 27

You can now send services to the V.24 module, with control through the input module in the control system. You can observe messages online in DB 11. In order to make full use of the examples, you must address a terminal program via the V.24 module.

Input data word: DB2.DBW0Output data word: DB3.DBW0

5-32 6076BC01

Page 105: 6076b1_e.pdf

Application Examples

5.6 Description of the Function Blocks in the Example (Extended Operating Mode)

There follows a detailed description of the driver blocks used in each example.

5.6.1 I/O Data Transport in Asynchronous Bus Operating Mode

In this example, the CPU in OB 1 is reading an input data record and writing an output data record.

Call Structure in OB 100

FC 20 is called during startup (OB 100) to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required in the INTERBUS driver functions application. The base address of the controller board (COM_ADR) to be set corresponds to the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the controller board

DIAG_STATE := 0 // Not used

DIAG_PARA := 0 // Not used

FKN_START := 0 // Not used

FKN_PARA := 0 // Not used

FKN_STATE := 0 // Not used

MEM_READ := 21 // Number of the "read" driver

MEM_WRITE := 22 // Number of the "write" driver

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 0 // Operating mode: asynchronous

TIMER_NR := T1 // Timer used by this function

6076BC01 5-33

Page 106: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 1

SOURCE := 0 // Not used

CONFIGURATION := DW#16#8000000F

// The controller board is operating in extended operating mode, additional error data is stored in IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

S M100.7

AN M10.0 // If FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

Call FC 24 diagnostic driver. FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I4.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

5-34 6076BC01

Page 107: 6076b1_e.pdf

Application Examples

Reading the first data record parameterized under IBS CMD.AN M11.0

S M11.0

CALL FC 21 // Driver call to read input data

IBDB := DB 20 // INTERBUS data block

MODE := 1 // Data record 1

SOURCE := 0 // Not used

DEST_AREA := 0 // Not used

DEST_AREA_NR := 0 // Not used

DEST_OFFSET := 0 // Not used

DEST_LENGTH := 0 // Not used

RET := M11.1 // Fault during function processing.

BUSY := M11.0 // Function is active.

Transmission of the input data from the INTERBUS input module to the INTERBUS output module.L DB2.DBW0

T DB3.DBW0

Writing the first output data record parameterized under IBS CMD.AN M12.0

S M12.0

CALL FC 22 // Driver call to write output data

IBDB := DB 20 // INTERBUS data block

MODE := 1 // Data record 1

SOURCE_AREA := 0 // Not used

SOURCE_AREA_NR := 0 // Not used

SOURCE_OFFSET := 0 // Not used

SOURCE_LENGTH := 0 // Not used

DESTINATION := 0 // Not used

RET := M12.1 // Fault during function processing.

BUSY := M12.0 // Function is active.

6076BC01 5-35

Page 108: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.6.2 I/O Data Transport in Asynchronous With Synchronization Pulse Bus Operating Mode

This operating mode should be selected if data consistency greater than 16 bits is required for I/O data traffic.

FC 28 waits in this operating mode in OB 100 for a process alarm interrupt from the controller board. If this interrupt is released to the control system, the program branches into OB 40. The controller board is informed that the interrupt has been detected through FC 28. Functions FC 50 and FC 51 control the transmission of consistent data using the read/write functions. Following this a new INTERBUS cycle is started, and OB 40 is quit. FC 28 is also completed. If the the controller board generates a new interrupt at this time, although OB 1 is not yet completed, the program branches into OB 40, and calls FC 28. This is immediately quit again without calling the FC 50/51 functions.

Call Structure in OB 100

FC 20 is called during startup to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required by the INTERBUS driver functions in the application. The base address of the controller board (COM_ADR) to be set is dependent on the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call.

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the controller board

DIAG_STATE := 0 // Not used

DIAG_PARA := 0 // Not used

FKN_START := 0 // Not used

FKN_PARA := 0 // Not used

FKN_STATE := 0 // Not used

MEM_READ := 21 // Number of the read driver

MEM_WRITE := 22 // Number of the write driver

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

5-36 6076BC01

Page 109: 6076b1_e.pdf

Application Examples

Call Structure in OB 1

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 2 // Operating mode: asynchronous with synchronization pulse

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#8000000F

// The controller board is operating in extended operating mode, additional error data is stored in IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

S M100.7

AN M10.0 // If FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

Call FC 24 diagnostic driver. FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I4.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

6076BC01 5-37

Page 110: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 40

In FC 28 the program waits until the controller board generates an interrupt, then branches into OB 40 and consistent data is transferred. This data is available to the application program after FC 28 has been executed.CALL FC 28 // IB_SYNC driver call

IBDB := DB20 // INTERBUS data block

READ_FC := FC 50 // Function for reading the input data

WRITE_FC := FC 51 // Function for writing the output data

CYCLE_OB := TRUE // Default: FC 28 is called from OB 1.

RET := M14.0 // Fault during function processing.

Transmission of the input data from the INTERBUS input module to the INTERBUS output moduleL DB2.DBW0

T DB3.DBW0

BE

The OB 40 is called during the program cycle if a process alarm is generated by the controller board. If the interrupt is generated while FC 28 is active, the FC 50/51 functions for reading/writing the I/O data are executed. If FC 28 is not active when the interrupt is generated, theFC 50/51 functions are not called. In this case, only the protocol for this operating mode is controlled by FC 28.CALL FC 28 // IB_SYNC driver call

IBDB := DB20 // INTERBUS data block

READ_FC := FC 50 // Function for reading the input data

WRITE_FC := FC 51 // Function for writing the output data

CYCLE_OB := FALSE // FC 28 was called by OB 40.

RET := M12.0 // Fault during function processing.

BE

5-38 6076BC01

Page 111: 6076b1_e.pdf

Application Examples

The FC 50 function is called by FC 28 to read data record 1 parameterized under IBS CMD.AN M10.0

S M10.0

CALL FC 21 // Driver call to read input data

IBDB := DB20 // INTERBUS data block

MODE := 1 // Data record 1 to be read in

SOURCE := 0 // Not used

DEST_AREA := 0 // Not used

DEST_AREA_NR := 0 // Not used

DEST_OFFSET := 0 // Not used

DEST_LENGTH := 0 // Not used

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

BE

The FC 51 function is called by FC 28 to write data record 1 parameterized under IBS CMD.AN M11.0

S M11.0

CALL FC 22 // Driver call to write output data

IBDB := DB20 // INTERBUS data block

MODE := 1 // Data record 1 to be written

SOURCE_AREA := 0 // Not used

SOURCE_AREA_NR := 0 // Not used

SOURCE_OFFSET := 0 // Not used

SOURCE_LENGTH := 0 // Not used

DESTINATION := 0 // Not used

RET := M11.1 // Fault during function processing.

BUSY := M11.0 // Function is active.

BE

6076BC01 5-39

Page 112: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.6.3 PCP Communication Using FC 25

In the example, four PCP services in OB 1 that were parameterized in data block DB 10 are being sent to a V.24 module. This V.24 module can be used, for example, to send data to or receive data from a terminal program.

The following services are parameterized in the example in IBS CMD.

The services are started using inputs of the input module in the control system. The FC 21 and FC 22 functions implement the handshake necessary for the execution of FC 25.

INITIATE This service establishes a connection between the controller board and the V.24 module.

INIT_TABLE This service parameterizes the V.24 module with the following settings:

Protocol:Baud rate:Data width:Output type:

Transparent9600 baud8 bits, even parityRS-232

Please also make these settings in the terminal program.

V.24 SEND The text "TERMINAL" is sent from the controller board to the terminal program and read using this service.

V.24 RECEIVE A character string is sent from the terminal program to the controller board using this service.

5-40 6076BC01

Page 113: 6076b1_e.pdf

Application Examples

Call Structure in OB 100

FC 20 is called during startup to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required by the INTERBUS driver functions in the application. The base address of the controller board (COM_ADR) to be set corresponds to the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call.

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the controller board

DIAG_STATE := 0 // Not used

DIAG_PARA := 0 // Not used

FKN_START := 0 // Not used

FKN_PARA := 0 // Not used

FKN_STATE := 0 // Not used

MEM_READ := 21 // Number of the read driver

MEM_WRITE := 22 // Number of the write driver

LOAD := 0 // Parameterization of INTERBUS using the memory card

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 0 // Operating mode: asynchronous

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#8000000F

// The controller board is operating in extended operating mode, additional error data is stored in IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

S M100.7

AN M10.0 // If FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

BEC

CALL SFC 46

6076BC01 5-41

Page 114: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 1

Call FC 24 diagnostic driver. FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I4.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

The following function serves as a handshake function for executing the PCP services.

This function must be called in order to execute PCP services.AN M10.0

S M10.0

CALL FC 21 // Driver call for executing the handshake

IBDB := DB 20 // INTERBUS data block

MODE := 10 // Handshake operation

SOURCE := 0 // Not used

DEST_AREA := 0 // Not used

DEST_AREA_NR := 0 // Not used

DEST_OFFSET := 0 // Not used

DEST_LENGTH := 0 // Not used

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

5-42 6076BC01

Page 115: 6076b1_e.pdf

Application Examples

Start the "INITIATE" service by means of input 4.1 to initialize the V.24 module (CR 2). The services to be sent are in DB 10 from address DBW 0. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-46.A I4.1

FP M40.0

S M11.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

SOURCE_DW_NR := 0 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device which should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

TOGGLE := M0.7 // Internal bit memory bit, creates a second clock.

RET := M11.1 // Fault during function processing.

BUSY := M11.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

Start the "INIT_TABLE" service by means of input 4.2 to parameterize the V.24 module (CR 2). The service to be sent is in DB 10 from address DBW 10. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-22.A I4.2

FP M40.1

S M12.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

6076BC01 5-43

Page 116: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

SOURCE_DW_NR := 10 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device which should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

TOGGLE := M0.7 // Internal bit memory bit, creates a second clock.

RET := M12.1 // Fault during function processing.

BUSY := M12.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

Start the "V.24 SEND" service by means of input 4.3 to send V.24 data. The service to be sent is in DB 10 from address DBW 40. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-46.A I4.3

FP M40.2

S M13.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

SOURCE_DW_NR := 40 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device which should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

5-44 6076BC01

Page 117: 6076b1_e.pdf

Application Examples

TOGGLE := M0.7 // Internal bit memory bit, creates a second clock.

RET := M13.1 // Fault during function processing.

BUSY := M13.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

Start the V.24 RECEIVE service by means of input 4.4 for receiving V.24 data. The service to be sent is in DB 10 from address DBW 60. The received confirmation is in DB 11 from address DBW 0. See also the description of DB10/DB11 starting on page 5-46.A I4.4

FP M40.3

S M14.0

CALL FC 25 // IB_SERV driver call

IBDB := DB 20 // INTERBUS data block

SOURCE_DB_NR := 10 // Data block in which the service to be sent is entered.

SOURCE_DW_NR := 60 // Data word in which the first word of the service to be sent is entered.

CR_NR := 2 // CR number of the PCP device which should receive the service.

DEST_DB_NR := 11 // Data block in which the received confirmation is entered.

DEST_DW_NR := 0 // Data word in which the first word of the received confirmation is entered.

TOGGLE := M0.7 // Internal bit memory bit, creates a second clock.

RET := M14.1 // Fault during function processing.

BUSY := M14.0 // Function is active.

INTERNAL := MW60 // Internal bit memory word required for every CR.

The following function serves as a handshake function for executing the PCP services.

This function must be called in order to execute PCP services.

6076BC01 5-45

Page 118: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Description of DB 10 Data Block

AN M15.0

S M15.0

CALL FC 22 // Driver call for executing the handshake

IBDB := DB 20 // INTERBUS data block

MODE := 10 // Handshake operation

SOURCE_AREA := 0 // Not used

SOURCE_AREA_NR := 0 // Not used

SOURCE_OFFSET := 0 // Not used

SOURCE_LENGTH := 0 // Not used

DESTINATION := 0 // Not used

RET := M15.1 // Fault during function processing.

BUSY := M15.0 // Function is active.

Address Parameter Length Value DescriptionDBW0 DienstCodeINI WORD W#16#8B Service code for establishing the

connection to the V.24 module (initiate request)

ParaCountINI WORD W#16#2 Number of initiate request parameters

CR_Nummer INI WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexINI WORD W#16#0 Index for initializing the connection establishment

reserviert WORD W#16#0 Reserved

DBW10 DienstCodeINIT_TABLE WORD W#16#82 Service code for configuring the V.24 module (write request)

ParaCountINIT_TABLE WORD W#16#10 Number of write request parameters

CR_NummerINIT_TABLE WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexINIT_TABLE WORD W#16#5FFF Index for configuring the V.24 module

SubIndexINIT_TABLE BYTE B#16#0 The parameter defines which standard configuration settings should be modified (in the example: 00 = modification of all settings).

5-46 6076BC01

Page 119: 6076b1_e.pdf

Application Examples

LengthINIT_TABLE BYTE B#16#14 Volume of data to be modified. If all data is to be modified, enter 14hex here.

Protokoll BYTE B#16#0 Transmission protocol (in the example: 00 = transparent)

Baud_Rate BYTE B#16#7 Transmission rate (in the example: 07 = 9600 baud)

Datenbreite BYTE B#16#2 Data width (in the example: 02 = 8 bits, even parity)

reserviert1 BYTE B#16#0 Reserved

reserviert2 BYTE B#16#0 Reserved

Error_Pattern BYTE B#16#24 Character that is written to the buffer if an error occurs while receiving a V.24 character.

First_Delimiter BYTE B#16#D End character for dual buffer and end-to-end protocol (CR)

Second_Delimiter BYTE B#16#A End character for dual buffer and end-to-end protocol (LF)

Prioritaet BYTE B#16#0 3964R priority (in the example: 00 = low)

Ausgangstyp BYTE B#16#0 Output type (in the example: 00 = RS-232)

DTR_Steuerung BYTE B#16#0 DTR control (in the example: 00 = automatic)

Umlauf_Schalter BYTE B#16#0 (in the example: 00 = no rotation)

XON_Pattern BYTE B#16#11 Control character for XON/XOFF protocolXOFF_Pattern BYTE B#16#13

reserviert3 WORD W#16#0 Reserved

reserviert4 WORD W#16#0 Reserved

reserviert5 WORD W#16#0 Reserved

DBW40 DienstCodeWRITE WORD W#16#82 Service code for sending V.24 data (write request)

ParaCountWRITE WORD W#16#8 Number of write request parameters

CR_NummerWRITE WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexWRITE WORD W#16#5FE0 Index for sending V.24 data

SubIndexWRITE WORD W#16#A Volume of data to be sent (in the example: 10 characters)

Address Parameter Length Value Description

6076BC01 5-47

Page 120: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

data0 CHAR ’T’

data1 CHAR ’E’

data2 CHAR ’R’

data3 CHAR ’M’

data4 CHAR ’I’

data5 CHAR ’N’

data6 CHAR ’A’

data7 CHAR ’L’

data8 WORD W#16#A0D

DBW60 DienstCodeREAD1 WORD W#16#81 Service code for receiving V.24 data (read request)

ParaCountREAD1 WORD W#16#3 Number of read request parameters

CR_NummerREAD1 WORD W#16#0 CR number of the PCP device. This parameter is written by FC 25.

IndexREAD1 WORD W#16#5FE0 Index for receiving V.24 data

SubIndexREAD1 WORD W#16#0 The parameter defines that all data is to be read.

Address Parameter Length Value Description

5-48 6076BC01

Page 121: 6076b1_e.pdf

Application Examples

Description of DB 11 Data Block

Address Parameter Length Value DescriptionDBW0 ConfirmationCode WORD Code of the received confirmation

Para_Count WORD Number of parameters of the received confirmation

CR_Nummer WORD CR number of the received confirmation

Result WORD Result of the received confirmation

data1 WORD

: WORD

data13 WORD

6076BC01 5-49

Page 122: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5.6.4 PCP Communication Using FC 27

In the example, four PCP services in OB 1 that were parameterized as user functions in IBS CMD are being sent to a V.24 module. This V.24 module can be used, for example, to send data to or receive data from a terminal program.

The following services are parameterized in the example in IBS CMD.

The services are started using inputs of the input module in the control system. The required parameters (input and output data record 1) are transmitted using the FC 21 and FC 22 functions.

INITIATE This service establishes a connection between the controller board and the V.24 module.

INIT_TABLE This service parameterizes the V.24 module with the following settings:

Protocol:Baud rate:Data width:Output type:

Transparent9600 baud8 bits, even parityRS-232

Please also make these settings in the terminal program.

V.24 SEND The text "TERMINAL" is sent from the controller board to the terminal program using this service.

V.24 RECEIVE A character string is sent from the terminal program to the controller board and read using this service. The character string is output in data block DB 3 from DBW 10.

5-50 6076BC01

Page 123: 6076b1_e.pdf

Application Examples

Call Structure in OB 100

FC 20 is called during startup to synchronize the controller board with the control system. The function enters operating parameters into the IBDB, which are required by the INTERBUS driver functions in the application. The base address of the controller board (COM_ADR) to be set is dependent on the address set in the SIMATIC software and in IBS CMD.AN M10.0

S M10.0

R M10.1

CALL FC 20 // Initialization function call.

IBDB := DB 20 // INTERBUS data block

COM_ADR := 512 // S7 base address of the controller board

DIAG_STATE := 0 // Not used

DIAG_PARA := 0 // Not used

FKN_START := 0 // Not used

FKN_PARA := 0 // Not used

FKN_STATE := 0 // Not used

MEM_READ := 21 // Number of the read driver

MEM_WRITE := 22 // Number of the write driver

LOAD := 0 // Parameterization of INTERBUS using the parameterization memory

BOOT := 0 // INTERBUS start from the parameterization memory

MODE := 0 // Operating mode: asynchronous

TIMER_NR := T1 // Timer used by this function

SOURCE := 0 // Not used

CONFIGURATION := DW#16#8000000F

// The controller board is operating in extended operating mode, additional error data is stored in IBDB.

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

AN M100.7 // Setting the START_UP bits.

S M100.7

AN M10.0 // If FC 20 has not been processed correctly, the program may be stopped here.

AN M10.1 //

6076BC01 5-51

Page 124: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

Call Structure in OB 1

BEC

CALL SFC 46

Call FC 24 diagnostic driver. The FC 24 evaluates the status register and acknowledges any errors that may have occurred.CALL FC 24 // Diagnostic driver call

IBDB := DB20 // INTERBUS data block

ACTIVATE := I4.0 // Error acknowledgment using an external activation button

AUTO_START := M100.0 // Autostart after an error

RUN := M100.1 // INTERBUS in RUN

PF := M100.2 // Peripheral fault indicated

BUS_QUALITY := M100.3 // Quality exceeded.

DETECTION := M100.4 // Controller board searching for an error.

BUSY_STATE := M100.5 // Standard function is active.

RET := M100.6 // Fault during function processing.

START_UP := M100.7 // In the event of an error, INTERBUS is restarted after the control system has been reset.

Reading the first input record parameterized under IBS CMD.AN M10.0

S M10.0

CALL FC 21 // Driver call to read input data

IBDB := DB 20 // INTERBUS data block

MODE := 1 // Data record 1

SOURCE := 0 // Not used

DEST_AREA := 0 // Not used

DEST_AREA_NR := 0 // Not used

DEST_OFFSET := 0 // Not used

DEST_LENGTH := 0 // Not used

RET := M10.1 // Fault during function processing.

BUSY := M10.0 // Function is active.

5-52 6076BC01

Page 125: 6076b1_e.pdf

Application Examples

Transmission of the CR number of a PCP device to the address parameterized in IBS CMD.L 2

T DB3.DBB6

Start a user function ("INITIATE" service) by means of input 4.1 to initialize the V.24 module.A I4.1

FP M40.0

S M11.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M11.1 // Fault during function processing.

START := DB3.DBX4.0 // Start bit of the user function parameterized in IBS CMD.

STATE := DB2.DBX4.0 // Status bit of the user function parameterized in IBS CMD.

RESULT := DB2.DBX5.0 // Result bit of the user function parameterized in IBS CMD.

BUSY := M11.0 // Function is active.

Start a user function ("INIT_TABLE" service) by means of input 4.2 to parameterize the V.24 module.A I4.2

FP M40.1

S M12.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M12.1 // Fault during function processing.

START := DB3.DBX4.1 // Start bit of the user function parameterized in IBS CMD.

6076BC01 5-53

Page 126: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

STATE := DB2.DBX4.1 // Status bit of the user function parameterized in IBS CMD.

RESULT := DB2.DBX5.1 // Result bit of the user function parameterized in IBS CMD.

BUSY := M12.0 // Function is active.

Start a user function ("V.24 SEND" service) by means of input 4.3 to send V.24 data.A I4.3

FP M40.2

S M13.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M13.1 // Fault during function processing.

START := DB3.DBX4.2 // Start bit of the user function parameterized in IBS CMD.

STATE := DB2.DBX4.2 // Status bit of the user function parameterized in IBS CMD.

RESULT := DB2.DBX5.2 // Result bit of the user function parameterized in IBS CMD.

BUSY := M13.0 // Function is active.

Start a user function ("V.24 RECEIVE" service) by means of input 4.4 to receive V.24 data.A I4.4

FP M40.3

S M14.0

CALL FC 27 // IB_FUNCT driver call

IBDB := DB 20 // INTERBUS data block

TIMER_NR := T2 // Timer used by this function

RET := M14.1 // Fault during function processing.

START := DB3.DBX4.3 // Start bit of the user function parameterized in IBS CMD.

5-54 6076BC01

Page 127: 6076b1_e.pdf

Application Examples

STATE := DB2.DBX4.3 // Status bit of the user function parameterized in IBS CMD.

RESULT := DB2.DBX5.3 // Result bit of the user function parameterized in IBS CMD.

BUSY := M14.0 // Function is active.

Writing the first output data record parameterized under IBS CMD.AN M15.0

S M15.0

CALL FC 22 // Driver call to write output data

IBDB := DB 20 // INTERBUS data block

MODE := 1 // Data record 1 to be written

SOURCE_AREA := 0 // Not used

SOURCE_AREA_NR := 0 // Not used

SOURCE_OFFSET := 0 // Not used

SOURCE_LENGTH := 0 // Not used

DESTINATION := 0 // Not used

RET := M15.1 // Fault during function processing.

BUSY := M15.0 // Function is active.

6076BC01 5-55

Page 128: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

5-56 6076BC01

Page 129: 6076b1_e.pdf

Section 6

This section informs you about

– the technical data for the driver software.

Technical Data for the Driver Functions ...............................................................6-3

6076BC01 6-1

Page 130: 6076b1_e.pdf

6-2 6076BC01

Page 131: 6076b1_e.pdf

Technical Data for the Driver Functions

6 Technical Data for the Driver Functions

Block Name INIT_IB MEM_READ MEM_WRIT

Block number FC 20 FC 21 FC 22

Block length (in bytes): 2706 1912 2396

MC7 code length (in bytes): 2360 1608 2052

Local data length (in bytes): 82 74 88

Bit memory bits, times and counters used:

Timer, depending on the parameter

None None

Data block used: IBDB IBDB IBDB

Functions called : SFC 47 SFC 59 SFC 58

Version: ≥ 1.2 ≥ 1.2 ≥ 1.2

Block Name IB_DIAG IB_SERV IB_FUNCT IB_SYNC

Block number FC 24 FC 25 FC 27 FC 28

Block length (in bytes): 1226 1406 378 876

MC7 code length (in bytes): 1028 1202 250 700

Local data length (in bytes): 88 60 2 34

Bit memory bits, times and counters used:

None INTERNAL variable

None None

Data block used IBDB IBDB IBDB IBDB

Functions called : SFC 1 None None READ_FC and

WRITE_FC, each

according to parameters

Version: ≥ 1.2 ≥ 1.2 ≥ 1.2 ≥ 1.2

6076BC01 6-3

Page 132: 6076b1_e.pdf

IBS S7 400 ETH DSC SWD UM E

6-4 6076BC01

Page 133: 6076b1_e.pdf

Appendix A

A 1 List of Figures

Figure 2-1: Diagnostic status register .............................................2-5

Figure 2-2: Diagnostic parameter register ......................................2-6

Figure 2-4: Transferring the device number in thestandard function parameter register .........................2-11

Figure 2-5: Function execution without parameter transfer ..........2-12

Figure 2-6: Function execution with parameter transfer ...............2-13

Figure 4-1: Call structure in asynchronous mode ...........................4-7

Figure 4-2: Call structure in asynchronous withsynchronization pulse mode ........................................4-8

Figure 5-1: Example configuration .................................................5-6

6076BC01 A-1

Page 134: 6076b1_e.pdf

A-2 6076BC01

Page 135: 6076b1_e.pdf

Appendix A

A 2 List of Tables

Table 4-1: Bit entries of the CONFIGURATION parameter .........4-17

Table 4-2: Error numbers of FC INIT_IB in DBB56 of the IBDB ..4-18

Table 4-3: Error numbers of FC MEM_READ in DBW58of the IBDB .................................................................4-22

Table 4-4: Error numbers of FC MEM_WRIT in DBW60of the IBDB .................................................................4-26

Table 4-5: Error numbers of FC IB_SERV in DBW62of the IBDB .................................................................4-33

Table 4-6: Error numbers of FC IB_FUNCT in DBW82of the IBDB .................................................................4-36

Table 4-7: Error numbers of FC IB_SYNC in DBW86of the IBDB .................................................................4-38

Table 4-8: Data words of the INTERBUS data block IBDB..........4-39

6076BC01 A-3

Page 136: 6076b1_e.pdf

List of Tables

A-4 6076BC01

Page 137: 6076b1_e.pdf

Appendix A

A 3 Index

DDiagnostic register

Diagnostic parameter register............ 2-6

Diagnostic status register .................. 2-5

Driver functions

Call structure...................................... 4-7

Call structure in asynchronous mode 4-7

Call structure in the asynchronouswith synchronization pulsemode..................................... 4-8

FC 20 INIT_IB.................................. 4-11

FC 21 MEM_READ.......................... 4-20

FC 22 MEM_WRIT .......................... 4-24

FC 24 IB_DIAG................................ 4-28

FC 25 IB_SERV............................... 4-32

FC 27 IB_FUNCT ............................ 4-35

FC 28 IB_SYNC............................... 4-37

INTERBUS data block IBDB............ 4-39

Technical data ................................... 6-3

Driver software

Disk content ....................................... 4-4

Installation.......................................... 4-4

Tasks ................................................. 1-3

EExample applications

INTERBUS/control systemconfiguration ......................... 5-6

Introduction ........................................ 5-3

Short description................................ 5-4

Example applications (direct mode)

I/O data transport in asynchronousbus operating mode............ 5-10

I/O data transport inasynchronous withsynchronization pulse busoperating mode................... 5-12

Integration in the control system........ 5-7

PCP communication (FC 25)........... 5-16

PCP communication (FC 27)........... 5-26

Example applications (extended mode)

I/O data transport in asynchronousbus operating mode............ 5-33

I/O data transport inasynchronous withsynchronization pulse busoperating mode................... 5-36

Integration in the control system...... 5-31

PCP communication (FC 25)........... 5-40

PCP communication (FC 27)........... 5-50

IINTERBUS operating modes

Asynchronous mode.......................... 3-3

Asynchronous withsynchronization pulse mode . 3-3

SStandard register

Standard function parameter register2-11

Standard function start register ......... 2-9

Standard function status register..... 2-10

6076BC01 A-5

Page 138: 6076b1_e.pdf

Index

A-6 6076BC01

Page 139: 6076b1_e.pdf

We Are Interested in Your Opinion!

We would like to hear your comments and suggestions concerning this document.

We review and consider all comments for inclusion in future documen-tation.

Please fill out the form on the following page and fax it to us or send your comments, suggestions for improvement, etc. to the following address:

Phoenix Contact GmbH & Co.Marketing ServicesDokumentation INTERBUS32823 BlombergGERMANY

Phone +49 - (0) 52 35 - 3-00Telefax +49 - (0) 52 35 - 3-4 20 66E-Mail [email protected]

Page 140: 6076b1_e.pdf

FAX ReplyPhoenix Contact GmbH & Co. Date: Marketing ServicesDokumentation INTERBUS Fax No: +49 - (0) 52 35 - 3-4 20 66

From:

Company: Name:

Department:

Address: Job function:

City, ZIP code:

Phone:

Country: Fax:

Document:

Designation: Revision: Order No.:

My Opinion on the Document

Form Yes In part No

Is the table of contents clearly arranged?

Are the figures/diagrams easy to understand/helpful?

Are the written explanations of the figures adequate?

Does the quality of the figures meet your expectations/needs?

Does the layout of the document allow you to find information easily?

Contents Yes In part No

Is the phraseology/terminology easy to understand?

Are the index entries easy to understand/helpful?

Are the examples practice-oriented?

Is the document easy to handle?

Is any important information missing? If yes, what?

Other Comments: