Sie sind auf Seite 1von 140

INTERBUS

User Manual
Controller Board Software for Siemens SIMATIC S7-400

Designation:

IBS S7 400 ETH DSC SWD UM E

Revision:

BC01

Order No.:

27 43 99 6

This manual is valid for:


IBS S7 400 ETH DSC/I-T

Phoenix Contact 03/2001

6076BC01

Order No. 27 31 10 2

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

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

Table of Contents
1 Driver Software Tasks.......................................................................................1-3
2 INTERBUS Standard and Diagnostic Registers ...............................................2-3
2.1

2.2

2.3

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

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


2.2.2

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

2.2.3

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

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

6076BC01

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

IBS S7 400 ETH DSC SWD UM E

4.6

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

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

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

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.5

ii

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

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

Linking the Examples in Your Control System


(Extended Operating Mode)..................................................... 5-31

6076BC01

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

IBS S7 400 ETH DSC SWD UM E

iv

6076BC01

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

1-2

6076BC01

Driver Software Tasks

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

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

Section 2
This section informs you about
INTERBUS standard and diagnostic registers.

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


2.1

2.2

2.3

6076BC01

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

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


2.2.2

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

2.2.3

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

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

2-1

2-2

6076BC01

INTERBUS Standard and Diagnostic Registers

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

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

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.
n + 1
n

7 6
0

5 4

3 2 1 0
U S E R
P F

P e r ip h e r a l fa u lt

B U S
C T R L

B u s e rro r
E r r o r o n c o n tr o lle r b o a r d /h a r d w a r e fa u lt

D E T E C T
R U N

D ia g n o s tic r o u tin e is a c tiv e


D a ta tr a n s m is s io n is a c tiv e

A C T IV E

S e le c te d c o n fig u r a tio n is r e a d y - to - o p e r a te

R E A D Y

5 4

C o n tr o lle r b o a r d is r e a d y - to - o p e r a te

n + 1

3 2 1 0 7
B S A
S T O P
R E S U L T
S Y -R E S U L T
D C -R E S U L T

W A R N IN G
Q U A L IT Y
S D S I

U s e r e rro r

0
B u s s e g m e n t a b o rte d
C P U in S T O P s ta te
S ta n d a r d fu n c tio n n e g a tiv e ly p r o c e s s e d
S y n c h r o n iz a tio n e r r o r o c c u r r e d
F a u lty d a ta c y c le s
D e fin e d w a itin g tim e e x c e e d e d
D e fin e d e r r o r d e n s ity e x c e e d e d
M e s s a g e fo r c o n tro l s y s te m

is p e n d in g
6 0 7 6 A 0 0 4

Figure 2-1

6076BC01

Diagnostic status register

2-5

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

E r S r ot r r l u o n c g a st i o o r n t

the error location (in the case of bus errors)


n
7

n + 1
7

S e g m e n t n u m b e r

P o s itio n in s e g m e n t

E x a m p le : d e v ic e n u m b e r 3 .1
5 7 5 7 B 0 1 1

E rro r c o d e

or the error code.


n
7

n + 1
7

E rro r n u m b e r
E x a m p le : a d d r e s s o v e r la p , c o d e 0 A 5 0

h e x

5 2 6 0 B 0 4 7

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.

2-6

6076BC01

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.
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:

6076BC01

Device number of a local bus device


(e.g., 1.3: Bus segment 1. Device 3)

For additional information, please refer to the


IBS SYS DIAG DSC UM E Diagnostics Guide.

2-7

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:
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

** Depending on messages given by the device (see device data sheet or


user manual).

2-8

6076BC01

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:
1 5

8 7

M u s t n o t b e s e t
to "1 " b y th e u s e r

Figure 2-3

5 4

0
S ta rt th e IN T E R B U S
S to p th e b u s s y s te m
a n d s e le c t a s to r e d c
C le a r d ia g n o s tic d is p
D is c o n n e c t th e s e g m
C o n n e c t th e s e g m e n
B y p a s s d e v ic e 2 )
C a n c e l d e v ic e b y p a s

s y s te m
, re s e t o u tp u ts
1 )
o n fig u r a tio n
la y
2 )
e n t
2 )
t
s in g

2 )
6 0 7 6 A 0 0 1

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.
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 segment
Byte n+1 (bits 0 ... 7): Position in the segment (see Figure 2-4)

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.

6076BC01

2-9

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.
Standard function RESULT bit = 1: Function not completed successfully
Standard function RESULT bit = 0: Function completed 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.

2-10

6076BC01

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).
Example:

Device number 2.3


Bus segment:

2dec

00000010bin

Position in the segment:

3dec

00000011bin

B it p o s itio n
7

0 0 0 0 0 0 1 0

0 0 0 0 0 0 1 1

B u s s e g m e n t

P o s itio n in th e s e g m e n t
5 4 6 9 A 0 1 2

Figure 2-4

6076BC01

Transferring the device number in the standard function


parameter register

2-11

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)

S ta n d a r d fu n c tio n
s ta r t b it

O u tp u t b it
Q 2 6 1 .0

S ta n d a r d fu n c tio n
s ta tu s b it

In p u t b it
I 2 6 5 .0

S ta n d a r d fu n c tio n
r e s u lt b it

In p u t b it
I 2 5 6 .2
5 7 5 7 A 0 0 2

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).

2-12

6076BC01

INTERBUS Standard and Diagnostic Registers

2.3.2

Execution of a Standard Function With Parameter


Transfer (Example: Disconnect Bus Segment)

S ta n d a r d fu n c tio n
s ta r t b it

O u tp u t b it
Q 2 6 1 .3

S ta n d a r d fu n c tio n
s ta tu s b it

In p u t b it
I 2 6 5 .3

S ta n d a r d fu n c tio n
r e s u lt b it

In p u t b it
Q 2 5 6 .2

S ta n d a r d fu n c tio n
p a r a m e te r r e g is te r

P a ra m e te r

O u tp u t w o rd
Q W 2 6 2

5 7 5 7 A 0 0 3

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.

6076BC01

2-13

IBS S7 400 ETH DSC SWD UM E

2-14

6076BC01

Section 3
This section informs you about
INTERBUS operating modes.

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

6076BC01

3.1

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

3.2

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

3-1

3-2

6076BC01

INTERBUS Operating Modes

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

IBS S7 400 ETH DSC SWD UM E

3-4

6076BC01

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.6

6076BC01

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

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

4-1

4-2

6076BC01

Description of the Function Blocks

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

IBS S7 400 ETH DSC SWD UM E

4.1
Disk content

(Drive):

The Driver Software Floppy Disk


\IBSWD412.EXE

Self-extracting file with driver blocks for


the IBS S7 400 ETH DSC/I-T controller
board

\README.TXT

Function block description

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.

4-4

6076BC01

Description of the Function Blocks


File structure on the
hard disk

(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

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

6076BC01

4-5

IBS S7 400 ETH DSC SWD UM E

Description of the
file structure

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

IOASYIMP.S7P

PCPFC25.S7P
PCPFC27.S7P
IOASYNCH.BG4
IOASYIMP.BG4

PCPFC25.BG4
PCPFC27.BG4
FC20.TXT
FC21.TXT
FC22.TXT
FC24.TXT
FC25.TXT
FC27.TXT
FC28.TXT

Asynchronous
Asynchronous with
synchronization pulse

S7 project files for


PCP communication

Via FC 25

IBS CMD files for


I/O data transport
in the bus operating
modes

Asynchronous

IBS CMD files for


PCP communication

Via FC 27

Asynchronous with
synchronization pulse
Via FC 25
Via FC 27

Description of the driver functions

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.,:
- INTERBUS.S7
\S7_400 \ENGLISH\IBSWD412 \IBSWD412 \IBSWD412.S7P
3. Double-click on the desired project file (IBSWD412.S7P).

4-6

6076BC01

Description of the Function Blocks

4.2

Call Structure of the Driver Functions

Call structure for


asynchronous mode

O B

1 0 0

F C 2 0
IN IT _ IB

O B

F C 2 4
IB _ D IA G

F C 2 1
M E M _ R E A D

IB D B

IB D B

IB D B

A p p lic a tio n
p ro g ra m

F C 2 5
IB _ S E R V

F C 2 7
IB _ F U N C T

F C 2 2
M E M _ W R IT

IB D B

IB D B

IB D B

5 7 5 7 A 0 0 5

Figure 4-1

Call structure in asynchronous mode

Key:
IBDB = INTERBUS data block

6076BC01

4-7

IBS S7 400 ETH DSC SWD UM E

Call structure for


asynchronous with
synchronization
pulse mode

O B 1

F C 2 8

O B

4 0

F C 2 8

F C 5 0

IB _ S Y N C

IB _ S Y N C

F C 2 1

IB D B

M E M _
R E A D

F C 5 1

F C 2 2

IB D B

M E M _
W R IT

IB D B

O B

4 0

F C 2 8
IB _ S Y N C

5 7 5 7 A 0 1 2

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.

4-8

6076BC01

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

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

Description of the Function Blocks

4.5
4.5.1
Task

Description of the Driver Functions


FC 20 INIT_IB

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

6076BC01

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

4-11

IBS S7 400 ETH DSC SWD UM E

Call structure in
direct mode
AN M10.0
S M10.0
CALL FC 20
IBDB
COM_ADR

:= DB20
:= 512

//
//
//
//

DIAG_STATE

:= 244

//

DIAG_PARA

:= 246

//

FKN_START

:= 248

//

FKN_PARA

:= 250

//

FKN_STATE

:= 250

//

MEM_READ
MEM_WRITE
LOAD

:= 0
:= 0
:= 0

//
//
//

BOOT
MODE

:= 0
:= 0

//
//

TIMER_NR
SOURCE

:= T1
:= 0

//
//

CONFIGURATION := DW#16#F //

RET
BUSY

4-12

:= M10.1
:= M10.0

//
//

Set activation bit


Initialization driver call
INTERBUS data block
S7 base address of the
communication register,
which was parameterized in
STEP 7
S7 address of the
diagnostic status register
S7 address of the
diagnostic parameter
register
S7 address of the standard
function start register
S7 address of the standard
function parameter register
S7 address of the standard
function status register
Not used
Not used
Setting:
loading the configuration
INTERBUS startup
Controller board operating
mode
Timer used
Parameterization data block
number
Configuration of the block,
controller board operating
in direct mode.
Result bit
Activate function

6076BC01

Description of the Function Blocks


Call structure in
extended mode
AN M10.0
S M10.0
CALL FC 20
IBDB
COM_ADR

:= DB20
:= 512

//
//
//
//

DIAG_STATE
DIAG_PARA
FKN_START
FKN_PARA
FKN_STATE
MEM_READ
MEM_WRITE

:=
:=
:=
:=
:=
:=
:=

//
//
//
//
//
//
//

LOAD

:= 0

//

BOOT
MODE

:= 0
:= 0

//
//

TIMER_NR
SOURCE

:= T1
:= 0

//
//

0
0
0
0
0
21
22

CONFIGURATION := DW#16#8 //
000000F
RET
BUSY

6076BC01

:= M10.1
:= M10.0

//
//

Set activation bit


Initialization driver call
INTERBUS data block
S7 base address of the
controller board
Not used
Not used
Not used
Not used
Not used
Number of the "read" driver
Number of the "write"
driver
Setting:
loading the configuration
INTERBUS startup
Controller board operating
mode
Timer used
Parameterization data block
number
Configuration of the block,
controller board operating
in extended mode.
Result bit
Activate function

4-13

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".
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.

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

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".

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).

4-14

6076BC01

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.
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

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.

LOAD

Abbrev.

FLASH

Description
Loads the configuration from the parameterization
memory

6076BC01

APPLIC Loads the configuration with function blocks of


the application.

CMD_IB Loads the configuration with a CMD file and data


blocks.

In preparation

Prerequisite: Configuration with IBS CMD/


parameterization memory

4-15

IBS S7 400 ETH DSC SWD UM E


BOOT

The value of the BOOT parameter controls


INTERBUS startup.

BOOT

Description

Starts the bus system from the configuration.

Starts the bus system with configuration frame 1 using the


initialization driver.

MODE

This parameter sets the operating mode of the


controller board.

MODE

Operating
Mode

Abbrev.

Asynchronous

A_SYN

Description
The INTERBUS cycle on the
controller board runs
asynchronously to the control
system.
Setting in IBS CMD:
asynchronous

4-16

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

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.

6076BC01

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.

W o rd 1

W o rd 0
n + 2

n + 1
n

R e s e
C T
B U
U S
P

0 / 1

rv e d
R L
S
E R
F

n + 3

2 4 2 3

3 1

1 6 1 5

7
4

2
1

6 0 7 6 A 0 0 3

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 2 (BUS) Bit 1 (USER)

Bit 0 (PF)

Value

6076BC01

Bit entries of the CONFIGURATION parameter


Description

Using FC IB_DIAG, peripheral fault (PF) entries are


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

No entry of error data in IBDB through FC IB_DIAG.

Using FC IB_DIAG, user error (USER) entries are


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

No entry of error data in IBDB through FC IB_DIAG.

Using FC IB_DIAG, bus error (BUS) entries are assigned


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

No entry of error data in IBDB through FC IB_DIAG.

4-17

IBS S7 400 ETH DSC SWD UM E


Table 4-1

Bit entries of the CONFIGURATION parameter

Bit 31 Bit 4 Bit 3 (CTRL)

Value

Description

Using FC IB_DIAG, controller error (CTRL) entries are


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

No entry of error data in IBDB through FC IB_DIAG.

0/1

Reserved

Controller board direct mode

Controller board extended mode

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.
RET

Description

The function was executed without errors.

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

4-18

Description

Timeout

Negative result for "Stopping the bus system,


resetting outputs and requesting a new
configuration"

6076BC01

Description of the Function Blocks


Table 4-2

Error numbers of FC INIT_IB in DBB56 of the IBDB

Error Number

Description

Negative result for "Start_Data_Transfer"

Invalid LOAD parameter

Communication register cannot be addressed


(incorrect base address, hardware error, etc.)

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

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

6076BC01

To activate FC 20, set this bit memory bit on a


positive edge. After processing, the function resets
the bit.

4-19

IBS S7 400 ETH DSC SWD UM E

4.5.2
Task

FC 21 MEM_READ

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
AN M11.0
S M11.0
CALL FC 21

Parameter
descriptions

4-20

IBDB
MODE

:= DB20
:= 1

SOURCE
DEST_AREA
DEST_AREA_NR
DEST_OFFSET

:=
:=
:=
:=

DEST_LENGTH
RET
BUSY

:= 0
:= M11.1
:= M11.0

IBDB

0
0
0
0

// Driver call to read input


data
// INTERBUS data block
// Operating mode of the
function, here: read data
records
// Data source (INTERBUS)
// Data destination area
// Data block number
// Start address in the
destination area
// Number of words to be read
// Result bit
// Activate function

This global INTERBUS data block with a length of


840 words is stored as DB20 on the driver disk in the
user manual.

6076BC01

Description of the Function Blocks


MODE

This parameter defines the operating mode of


FC MEM_READ.

MODE

Description

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

SOURCE

Data source in the INTERBUS system.

MODE
0

Source Area/SOURCE Parameter Entries


Address in the INTERBUS buffer

1 - 4, 5 - 9,
10

0, not used

DEST_AREA

DEST_AREA

6076BC01

The destination area of the read data is set here.


Only relevant if MODE = 0.
Data Destination

No input data storage

P area (I/O address area)

I area (process image - inputs)

Q area (process image - outputs)

M area (bit memory bits)

DB area (data blocks)

4-21

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

"DB 0" has been entered as the destination in the


DEST_AREA_NR parameter.

A destination area that is not permitted has been


entered in the DEST_AREA parameter.

An operating mode that is not permitted has been


specified in the MODE parameter.

An invalid CR number (number of a PCP-compatible


INTERBUS device) has been entered in the
SOURCE parameter.

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

Description of the Function Blocks


BUSY

6076BC01

To call FC 21, set this bit memory bit on a positive


edge. After processing, the function resets the bit.

4-23

IBS S7 400 ETH DSC SWD UM E

4.5.3
Task

FC 22 MEM_WRIT

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
AN M12.0
S M12.0
CALL FC 22
IBDB
MODE

:= DB20
:= 1

SOURCE_AREA
:= 0
SOURCE_AREA_NR := 0
SOURCE_OFFSET := 0

Parameter
descriptions

4-24

SOURCE_LENGTH

:= 0

DESTINATION
RET
BUSY

:= 0
:= M12.1
:= M12.0

IBDB

// Driver call to write output


data
// INTERBUS data block
// Operating mode of the
function, here: write data
records
// Data source area
// Data block number
// Start address in data
source area
// Number of words to be
written
// Data destination (INTERBUS)
// Result bit
// Activate function

This global INTERBUS data block with a length of


840 words is stored as DB20 on the driver disk in the
user manual.

6076BC01

Description of the Function Blocks


MODE

This parameter defines the operating mode of


FC MEM_WRIT.

MODE

Description

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

The source area of the data to be written is set here.


Only relevant if MODE = 0.

SOURCE_AREA

Data Source

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


operation)

P area (I/O address area)

I area (process image - inputs)

Q area (process image - outputs)

M area (bit memory bits)

DB area (data blocks)

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.

6076BC01

4-25

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.

MODE
0

Destination Area/DESTINATION Parameter Entries


Address in the INTERBUS buffer

1 - 4, 5 - 9,
10

0, not used

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.

Table 4-4

Error numbers of FC MEM_WRIT in DBW60 of the IBDB

Error Number

4-26

Description

"DB0" has been entered as a source in the


SOURCE_AREA_NR parameter.

A source area that is not permitted has been entered


in the SOURCE_AREA parameter.

An operating mode that is not permitted has been


specified in the MODE parameter.

An invalid CR number (number of a PCP-compatible


INTERBUS device) has been entered in the
DESTINATION parameter.

6076BC01

Description of the Function Blocks


Table 4-4

Error numbers of FC MEM_WRIT in DBW60 of the IBDB

Error Number

Description

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.

BUSY

6076BC01

To call FC 22, set this bit memory bit on a positive


edge. After processing, the function resets the bit.

4-27

IBS S7 400 ETH DSC SWD UM E

4.5.4
Task

FC 24 IB_DIAG

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

Description of the Function Blocks


Call structure

Parameter
descriptions

CALL FC 24
IBDB
ACTIVATE
AUTO_START
RUN
PF
BUS_QUALITY

:=
:=
:=
:=
:=
:=

DB20
I4.0
M100.0
M100.1
M100.2
M100.3

//
//
//
//
//
//
//

DETECTION

:= M100.4

//

BUSY_STATE
RET
START_UP

:= M100.5
:= M100.6
:= M100.7

//
//
//

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.

AUTO_START

6076BC01

Diagnostic driver call


INTERBUS data block
Acknowledgment button
Automatic restart
Message: INTERBUS active
Peripheral fault
Transmission
quality
Searching for bus
error
Function active
Result bit
INTERBUS start after
control system startup
(OB100)

Description

Only the ACTIVATE or Start_UP parameters can be


used to activate the function of bits 0 or 2.

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).

4-29

IBS S7 400 ETH DSC SWD UM E


RUN

The bit memory bit of the RUN parameter indicates


the operating state of INTERBUS.
RUN

Description

INTERBUS is in the STOP state.

INTERBUS is in the RUN state.

PF

This bit memory bit indicates errors in the


INTERBUS I/O.
PF

Description

INTERBUS is not indicating a peripheral fault.

INTERBUS is indicating a peripheral fault. The device


number is stored in the diagnostic parameter register.

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

4-30

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.

6076BC01

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

IBS S7 400 ETH DSC SWD UM E

4.5.5
Task

FC 25 IB_SERV

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

4-32

CALL FC 25
IBDB
SOURCE_DB_NR

:= DB20
:= 10

SOURCE_DW_NR

:= 0

CR_NR
DEST_DB_NR

:= 2
:= 11

DEST_DW_NR

:= 0

TOGGLE
RET
BUSY
INTERNAL

:=
:=
:=
:=

M0.7
M10.1
M10.0
MW60

// IB_SERV driver call


// INTERBUS data block
// Number of the send data
block
// Start address in send data
block
// CR number of the PCP device
// Number of the receive data
block
// Start address in receive
data block
// Seconds bit
// Result bit
// Activate function
// Internal buffer

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).

6076BC01

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.

Table 4-5

Error numbers of FC IB_SERV in DBW62 of the IBDB

Error Number

BUSY

6076BC01

Description

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

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.

Negative result. For example, a service was


parameterized incorrectly or a system function was
processed negatively.
To call FC 25, set this bit memory bit on a positive
edge. After processing, the function resets the bit.

4-33

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

Description of the Function Blocks

4.5.6
Task

FC 27 IB_FUNCT

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
A I4.1
FP M40.0
S M11.0
CALL FC 27
IBDB
TIMER_NR
RET
START
STATE
RESULT
BUSY
Parameter
descriptions

6076BC01

:=
:=
:=
:=
:=
:=
:=

DB20
T 2
M11.1
DB3.DBX4.0
DB2.DBX4.0
DB2.DBX5.0
M11.0

//
//
//
//
//
//
//
//

IB_FUNCT driver call


INTERBUS data block
Timer used
Result bit
User function start bit
User function status bit
User function result bit
Activate function

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).

4-35

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.

Table 4-6

Error numbers of FC IB_FUNCT in DBW82 of the IBDB

Error Number

Description

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

The user function was not executed successfully. The


RESULT parameter was set to "1".
Check the parameterization of your user function.

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.

4-36

6076BC01

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

CALL FC 28
IBDB
READ_FC

:= DB20
:= FC50

WRITE_FC

:= FC51

CYCLE_OB
RET

:= TRUE
:= M10.1

// IB_SYNC driver call


// INTERBUS data block
// Function call to read input
data
// Function call to write
output data
// Call identification
// Result bit

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.
TRUE : FC 28 was called in OB 1.
FALSE : FC28 was called in the alarm OB.

6076BC01

4-37

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.

Table 4-7

Error numbers of FC IB_SYNC in DBW86 of the IBDB

Error Number

Description

The MODE parameter in FC INIT_IB was not set to


"2". Check the value of the MODE parameter.

The last data cycle was not executed successfully.


The function uses the data from the last error-free
data cycle.

Example for an FC 50 read function:


:AN
M10.0
:S
M10.0
CALL FC 21
IBDB := DB20
:
:
:
:
:BE

//
//
// Call FC MEM_READ
// INTERBUS data block
:
:

Example for an FC 51 write function:


:AN
M10.0
:S
M10.0
CALL FC 22
IBDB := DB20
:
:
:
:
:BE

//
//
// Call FC MEM_WRIT
// INTERBUS data block
:
:

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-38

6076BC01

Description of the Function Blocks

4.6
Table 4-8
Data
Word

6076BC01

Description of the INTERBUS Data Block


IBDB
Data words of the INTERBUS data block IBDB
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

4-39

IBS S7 400 ETH DSC SWD UM E


Table 4-8

4-40

Data words of the INTERBUS data block IBDB

Data
Word

Parameter

Description

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

...

...

...

6076BC01

Description of the Function Blocks


Table 4-8

Data words of the INTERBUS data block IBDB

Data
Word

Parameter

Description

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

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).

6076BC01

4-41

IBS S7 400 ETH DSC SWD UM E

4-42

6076BC01

Section

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

6076BC01

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

5-1

5-2

6076BC01

Application Examples

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

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:

STEP 7 :

5.1.2

IOASYNCH.BG4
IOASYNCH.S7P

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:

5-4

IBS CMD SWT G4:

IOASYIMP.BG4

STEP 7:

IOASYIMP.S7P

6076BC01

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:

STEP 7 :

5.1.4

PCPFC25.BG4
PCPFC25.S7P

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:

STEP 7 :

PCPFC27.BG4
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

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.

IB S S 7 4 0 0 E T H

D S C -T
IN
IB S

T E R
S 7

4 0 0

U S
E T H

D S C /I- T

O rd .N o .: 2 7 3 1 1 0 2

0
1
2

4
5

P S

C P U

6
7

IN
0

1
2

3
4
5

6
7

S T O P

R S 2 3 2

R E M O T E

IN T E R B U S
5

R S 2 3 2
1

U L
C C
B A

S e r ia l I /O M o d u le
IB S T 2 4 V .2 4
O rd . N o .: 2 7 2 5 4 8 0

T R
R x D /
T x D
U s

R S 4 8 5 /4 2 2

B u s te r m in a l
m o d u le

1 6 d ig ita l
in p u ts

1 6 d ig ita l
o u tp u ts

V .2 4 m o d u le

IB S T 2 4 B K -T
ID : 8 (8 h )

IB S T 2 4 D I 1 6 /4
ID : 1 9 0 (B E h )

IB S T 2 4 D O 1 6 /3
ID : 1 8 9 (B D h )

IB S T V .2 4
ID : 2 2 0 (D C h )
6 0 7 6 A 0 0 2

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.

5-6

6076BC01

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):
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

4. Format the parameterization memory and then save your configuration


on the parameterization memory.

6076BC01

5-7

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:
Entry

S7
Address

S5
Address

Length

Part
of PI

Coupling
Area

124

128

128

124

256

128

384

128

124

512*

252

P/Q

The address of the communication register must be outside the process


image.

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.

5-8

6076BC01

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

6076BC01

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.

5-9

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.

5-10

AN M10.0
S M10.0
R M10.1
CALL FC 20
IBDB
COM_ADR

:= DB 20
:= 512

DIAG_STATE

:= 244

DIAG_PARA

:= 246

FKN_START

:= 248

FKN_PARA

:= 250

FKN_STATE

:= 250

MEM_READ
MEM_WRITE
LOAD

:= 0
:= 0
:= 0

BOOT

:= 0

// Initialization function call


// INTERBUS data block
// S7 base address of the
communication register
// S7 address of the diagnostic
status register
// S7 address of the diagnostic
parameter register
// S7 address of the standard
function start register
// S7 address of the standard
function parameter register
// S7 address of the standard
function status register
// Not used
// Not used
// Parameterization of INTERBUS
using the parameterization
memory
// INTERBUS start from the
parameterization memory

6076BC01

Application Examples

MODE
TIMER_NR
SOURCE
CONFIGURATION

:=
:=
:=
:=

0
T1
0
DW#16#F

RET

:= M10.1

BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1

:= M10.0

//
//
//
//

Operating mode: asynchronous


Timer used by this function
Not used
The controller board is
operating in direct operating
mode, additional error data is
stored in the IBDB.
// Fault during function
processing.
// Function is active.
// Setting the START_UP bits.
// If FC 20 has not been
// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

Call Structure in OB 1
Call the FC 24 diagnostic driver. The FC 24 evaluates the status register
and acknowledges any errors that may have occurred.

6076BC01

CALL FC 24
IBDB
ACTIVATE

:= DB20
:= I0.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// In the event of an error,
INTERBUS is restarted after
the control system has been
reset.

5-11

IBS S7 400 ETH DSC SWD UM E

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

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
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
IBDB
COM_ADR

5-12

:= DB 20
:= 512

// Initialization function call.


// INTERBUS data block
// S7 base address of the
communication register

6076BC01

Application Examples

DIAG_STATE

:= 244

DIAG_PARA

:= 246

FKN_START

:= 248

FKN_PARA

:= 250

FKN_STATE

:= 250

MEM_READ
MEM_WRITE
LOAD

:= 0
:= 0
:= 0

BOOT

:= 0

MODE

:= 2

TIMER_NR
SOURCE
CONFIGURATION

:= T1
:= 0
:= DW#16#F

RET

:= M10.1

BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1

:= M10.0

// S7 address of the diagnostic


status register
// S7 address of the diagnostic
parameter register
// S7 address of the standard
function start register
// S7 address of the standard
function parameter register
// S7 address of the standard
function status register
// Not used
// Not used
// Parameterization of INTERBUS
using the parameterization
memory
// INTERBUS start from the
parameterization memory
// Operating mode: asynchronous
with synchronization pulse
// Timer used by this function
// Not used
// The controller board is
operating in direct operating
mode, additional error data is
stored in the IBDB.
// Fault during function
processing.
// Function is active.
// Setting the START_UP bits.
// If the FC 20 has not been
// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

6076BC01

5-13

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
IBDB
ACTIVATE

:= DB20
:= I0.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// 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
IBDB
READ_FC

:= DB20
:= FC 50

WRITE_FC

:= FC 51

CYCLE_OB

:= TRUE

RET

:= M14.0

// IB_SYNC driver call


// INTERBUS data block
// Function for reading the input
data
// Function for writing the
output data
// Default: FC 28 is called from
OB 1.
// Fault during function
processing.

You can now program your application.

5-14

6076BC01

Application Examples

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

Call Structure in OB 40
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
IBDB
READ_FC

:= DB20
:= FC 50

WRITE_FC

:= FC 51

CYCLE_OB
RET

:= FALSE
:= M12.0

// IB_SYNC driver call


// INTERBUS data block
// Function for reading the input
data
// Function for writing the
output data
// FC 28 called by OB 40
// 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

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.
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:

Transparent
9600 baud
8 bits, even parity
RS-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 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.

5-16

6076BC01

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.

6076BC01

AN M10.0
S M10.0
R M10.1
CALL FC 20
IBDB
COM_ADR

:= DB 20
:= 512

DIAG_STATE

:= 244

DIAG_PARA

:= 246

FKN_START

:= 248

FKN_PARA

:= 250

FKN_STATE

:= 250

MEM_READ
MEM_WRITE
LOAD

:= 0
:= 0
:= 0

BOOT

:= 0

MODE
TIMER_NR
SOURCE
CONFIGURATION

:=
:=
:=
:=

RET

:= M10.1

BUSY
AN M100.7

:= M10.0

0
T1
0
DW#16#F

// Initialization function call.


// INTERBUS data block
// S7 base address of the
communication register
// S7 address of the diagnostic
status register
// S7 address of the diagnostic
parameter register
// S7 address of the standard
function start register
// S7 address of the standard
function parameter register
// S7 address of the standard
function status register
// Not used
// Not used
// Parameterization of INTERBUS
using the parameterization
memory
// INTERBUS start from the
parameterization memory
// Operating mode: asynchronous
// Timer used by this function
// Not used
// The controller board is
operating in direct operating
mode, additional error data is
stored in the IBDB.
// Fault during function
processing.
// Function is active.
// Setting the START_UP bits.

5-17

IBS S7 400 ETH DSC SWD UM E

S M100.7
AN M10.0
AN M10.1

// If the FC 20 has not been


// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

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
IBDB
ACTIVATE

:= DB20
:= I0.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// 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
IBDB
MODE
SOURCE
DEST_AREA
DEST_AREA_NR

5-18

:=
:=
:=
:=
:=

DB 20
10
0
0
0

// Calling the driver for


executing the handshake
// INTERBUS data block
// Handshake operation
// Not used
// Not used
// Not used

6076BC01

Application Examples

DEST_OFFSET
DEST_LENGTH
RET

:= 0
:= 0
:= M10.1

BUSY

:= M10.0

// Not used
// Not used
// Fault during function
processing.
// 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.

6076BC01

A I0.1
FP M40.0
S M11.0
CALL FC 25
IBDB
SOURCE_DB_NR

:= DB 20
:= 10

SOURCE_DW_NR

:= 0

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

TOGGLE

:= M0.7

RET

:= M11.1

BUSY
INTERNAL

:= M11.0
:= MW60

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.
// Data word in which the first
word of the service to be sent
is entered.
// CR number of the PCP device
that should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.
// Internal bit memory bit,
creates a second clock.
// Fault during function
processing.
// Function is active.
// Internal bit memory word
required for every CR.

5-19

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
IBDB
SOURCE_DB_NR

:= DB 20
:= 10

SOURCE_DW_NR

:= 10

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

TOGGLE

:= M0.7

RET

:= M12.1

BUSY
INTERNAL

:= M12.0
:= MW60

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.
// Data word in which the first
word of the service to be sent
is entered.
// CR number of the PCP device
that should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.
// Internal bit memory bit,
creates a 1/2 second clock.
// Fault during function
processing.
// Function is active.
// 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
IBDB
SOURCE_DB_NR

5-20

:= DB 20
:= 10

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.

6076BC01

Application Examples

SOURCE_DW_NR

:= 40

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

TOGGLE

:= M0.7

RET

:= M13.1

BUSY
INTERNAL

:= M13.0
:= MW60

// Data word in which the first


word of the service to be sent
is entered.
// CR number of the PCP device
which should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.
// Internal bit memory bit,
creates a second clock.
// Fault during function
processing.
// Function is active.
// 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.

6076BC01

A I0.4
FP M40.3
S M14.0
CALL FC 25
IBDB
SOURCE_DB_NR

:= DB 20
:= 10

SOURCE_DW_NR

:= 60

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.
// Data word in which the first
word of the service to be sent
is entered.
// CR number of the PCP device
that should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.

5-21

IBS S7 400 ETH DSC SWD UM E

TOGGLE

:= M0.7

RET

:= M14.1

BUSY
INTERNAL

:= M14.0
:= MW60

// Internal bit memory bit,


creates a 1/2 second clock.
// Fault during function
processing.
// Function is active.
// 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
IBDB
MODE
SOURCE_AREA
SOURCE_AREA_NR
SOURCE_OFFSET
SOURCE_LENGTH
DESTINATION
RET

:=
:=
:=
:=
:=
:=
:=
:=

DB 20
10
0
0
0
0
0
M15.1

BUSY

:= M15.0

// Driver call for executing the


handshake
// INTERBUS data block
// Handshake operation
// Not used
// Not used
// Not used
// Not used
// Not used
// Fault during function
processing.
// Function is active.

Description of the DB 10 Data Block


Address Parameter
DBW0
DienstCode INI

5-22

Length Value
WORD W#16#8B

ParaCountINI

WORD

W#16#2

CR_NummerINI

WORD

W#16#0

IndexINI

WORD

W#16#0

reserviert

WORD

W#16#0

Description
Service code for establishing the
connection to the V.24 module
(initiate request)
Number of initiate request
parameters
CR number of the PCP device. This
parameter is written by FC 25.
Index for initializing the
connection establishment
Reserved

6076BC01

Application Examples

Address Parameter
DBW10 DienstCodeINIT_TABLE

6076BC01

Length Value
WORD W#16#82

Description
Service code for configuring the
V.24 module (write request)
W#16#10
Number of write request parameters
W#16#0
CR number of the PCP device. This
parameter is written by FC 25.
W#16#5FFF Index for configuring the V.24
module
B#16#0
The parameter defines which
standard configuration settings
should be revised. (in the example:
00 = revision of all settings).
B#16#14
Volume of data to be modified. If
all data is to be modified, enter
14hex here.

ParaCountINIT_TABLE
CR_NummerINIT_TABLE

WORD
WORD

IndexINIT_TABLE

WORD

SubIndexINIT_TABLE

BYTE

LengthINIT_TABLE

BYTE

Protokoll

BYTE

B#16#0

Baud_Rate

BYTE

B#16#7

Datenbreite

BYTE

B#16#2

reserviert1
reserviert2
Error_Pattern

BYTE
BYTE
BYTE

B#16#0
B#16#0
B#16#24

First_Delimiter

BYTE

B#16#D

Second_Delimiter

BYTE

B#16#A

Prioritaet

BYTE

B#16#0

Ausgangstyp

BYTE

B#16#0

DTR_Steuerung

BYTE

B#16#0

Umlauf_Schalter
XON_Pattern
XOFF_Pattern
reserviert3
reserviert4

BYTE
BYTE
BYTE
WORD
WORD

B#16#0
B#16#11
B#16#13
W#16#0
W#16#0

Transmission protocol (in


the example: 00 = transparent)
Transmission rate (in
the example: 07 = 9600 baud)
Data width (in
the example: 02 = 8 bits, even
parity)
Reserved
Reserved
Character that is written to the
buffer if an error occurs while
receiving a V.24 character.
End character for dual buffer and
end-to-end protocol (CR)
End character for dual buffer and
end-to-end protocol (LF)
3964R priority (in
the example: 00 = low)
Output type (in
the example: 00 = RS-232)
DTR control (in
the example: 00 = automatic)
(in the example: 00 = no rotation)
Control character for XON/XOFF
protocol
Reserved
Reserved

5-23

IBS S7 400 ETH DSC SWD UM E

Address Parameter
reserviert5

Length Value
WORD W#16#0

DBW40

DienstCodeWRITE

WORD

ParaCountWRITE
CR_NummerWRITE

WORD
WORD

IndexWRITE
SubIndexWRITE

WORD
WORD

data0
data1
data2
data3
data4
data5
data6
data7
data8

CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
WORD

Service code for sending V.24 data


(write request)
W#16#8
Number of write request parameters
W#16#0
CR number of the PCP device. This
parameter is written by FC 25.
W#16#5FE0 Index for sending V.24 data
W#16#A
Volume of data to be sent (in
the example: 10 characters)
T
E
R
M
I
N
A
L
W#16#A0D

DienstCodeREAD1

WORD

W#16#81

ParaCountREAD1
CR_NummerREAD1

WORD
WORD

IndexREAD1
SubIndexREAD1

WORD
WORD

DBW60

5-24

Description
Reserved

W#16#82

Service code for receiving the V.24


data (read request)
W#16#3
Number of read request parameters
W#16#0
CR number of the PCP device. This
parameter is written by FC 25.
W#16#5FE0 Index for receiving V.24 data
W#16#0
The parameter defines that all data
is to be read.

6076BC01

Application Examples
Description of DB 11 Data Block
Address Parameter
DBW0
ConfirmationCode
Para_Count

6076BC01

Length Value
WORD
WORD

CR_Nummer

WORD

Result
data1
:
data13

WORD
WORD
WORD
WORD

Description
Code of the received confirmation
Number of parameters of the
received confirmation
CR number of the received
confirmation
Result of the received confirmation

5-25

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.
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:

Transparent
9600 baud
8 bits, even parity
RS-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.

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.

5-26

6076BC01

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.

6076BC01

AN M10.0
S M10.0
R M10.1
CALL FC 20
IBDB
COM_ADR

:= DB 20
:= 512

DIAG_STATE

:= 244

DIAG_PARA

:= 246

FKN_START

:= 248

FKN_PARA

:= 250

FKN_STATE

:= 250

MEM_READ
MEM_WRITE
LOAD

:= 0
:= 0
:= 0

BOOT

:= 0

MODE
TIMER_NR
SOURCE
CONFIGURATION

:=
:=
:=
:=

RET

:= M10.1

BUSY
AN M100.7

:= M10.0

0
T1
0
DW#16#F

// Initialization function call.


// INTERBUS data block
// S7 base address of the
communication register
// S7 address of the diagnostic
status register
// S7 address of the diagnostic
parameter register
// S7 address of the standard
function start register
// S7 address of the standard
function parameter register
// S7 address of the standard
function status register
// Not used
// Not used
// Parameterization of INTERBUS
using the parameterization
memory
// INTERBUS start from the
parameterization memory
// Operating mode: asynchronous
// Timer used by this function
// Not used
// The controller board is
operating in direct operating
mode, additional error data is
stored in IBDB.
// Fault during function
processing.
// Function is active.
// Setting the START_UP bits.

5-27

IBS S7 400 ETH DSC SWD UM E

S M100.7
AN M10.0
AN M10.1

// If FC 20 has not been


// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

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
IBDB
ACTIVATE

:= DB20
:= I0.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// 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

Application Examples

CALL FC 27
IBDB
TIMER_NR
RET

:= DB 20
:= T2
:= M11.1

//
//
//
//

START

:= Q8.0

//

STATE

:= I8.0

//

RESULT

:= I9.0

//

BUSY

:= M11.0

//

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
Start bit of the user function
parameterized in IBS CMD.
Status bit of the user
function parameterized in
IBS CMD.
Result bit of the user
function parameterized in
IBS CMD.
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
IBDB
TIMER_NR
RET

:= DB 20
:= T2
:= M12.1

//
//
//
//

START

:= Q8.1

//

STATE

:= I8.1

//

RESULT

:= I9.1

//

BUSY

:= M12.0

//

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
Start bit of the user function
parameterized in IBS CMD.
Status bit of the user
function parameterized in
IBS CMD.
Result bit of the user
function parameterized in
IBS CMD.
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

6076BC01

// IB_FUNCT driver call

5-29

IBS S7 400 ETH DSC SWD UM E

IBDB
TIMER_NR
RET

:= DB 20
:= T2
:= M13.1

START

:= Q8.2

STATE

:= I8.2

RESULT

:= I9.2

BUSY

:= M13.0

// INTERBUS data block


// Timer used by this function
// Fault during function
processing.
// Start bit of the user function
parameterized in IBS CMD.
// Status bit of the user
function parameterized in
IBS CMD.
// Result bit of the user
function parameterized in
IBS CMD.
// Function is active.

Start a user function ("V.24 RECEIVE" service) by means of input 0.4 to


receive V.24 data.

5-30

A I0.4
FP M40.3
S M14.0
CALL FC 27
IBDB
TIMER_NR
RET

:= DB 20
:= T2
:= M14.1

//
//
//
//

START

:= Q8.3

//

STATE

:= I8.3

//

RESULT

:= I9.3

//

BUSY

:= M14.0

//

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
Start bit of the user function
parameterized in IBS CMD.
Status bit of the user
function parameterized in
IBS CMD.
Result bit of the user
function parameterized in
IBS CMD.
Function is active.

6076BC01

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":
Record

Area

Data Block

Offset

Length

Input area

DB

DB 2

0 bytes

10 bytes
DBB0 - DBB9

Output
area

DB

DB 3

0 bytes

10 bytes
DBB0 - DBB9

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.

6076BC01

5-31

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.
Input data word:
Output data word:

DB2.DBW0
DB3.DBW0

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

5-32

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

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.

6076BC01

AN M10.0
S M10.0
R M10.1
CALL FC 20
IBDB
COM_ADR

:= DB 20
:= 512

DIAG_STATE
DIAG_PARA
FKN_START
FKN_PARA
FKN_STATE
MEM_READ
MEM_WRITE
LOAD

:=
:=
:=
:=
:=
:=
:=
:=

BOOT

:= 0

MODE
TIMER_NR

:= 0
:= T1

0
0
0
0
0
21
22
0

// Initialization function call


// INTERBUS data block
// S7 base address of the
controller board
// Not used
// Not used
// Not used
// Not used
// Not used
// Number of the "read" driver
// Number of the "write" driver
// Parameterization of INTERBUS
using the parameterization
memory
// INTERBUS start from the
parameterization memory
// Operating mode: asynchronous
// Timer used by this function

5-33

IBS S7 400 ETH DSC SWD UM E

SOURCE
CONFIGURATION

RET
BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1

:= 0
// Not used
:= DW#16#80 // The controller board is
00000F
operating in extended
operating mode, additional
error data is stored in IBDB.
:= M10.1
// Fault during function
processing.
:= M10.0
// Function is active.
// Setting the START_UP bits.
// If FC 20 has not been
// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

Call Structure in OB 1
Call FC 24 diagnostic driver. FC 24 evaluates the status register and
acknowledges any errors that may have occurred.

5-34

CALL FC 24
IBDB
ACTIVATE

:= DB20
:= I4.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// In the event of an error,
INTERBUS is restarted after
the control system has been
reset.

6076BC01

Application Examples

Reading the first data record parameterized under IBS CMD.


AN M11.0
S M11.0
CALL FC 21
IBDB
MODE
SOURCE
DEST_AREA
DEST_AREA_NR
DEST_OFFSET
DEST_LENGTH
RET

:=
:=
:=
:=
:=
:=
:=
:=

BUSY

:= M11.0

DB 20
1
0
0
0
0
0
M11.1

//
//
//
//
//
//
//
//
//

Driver call to read input data


INTERBUS data block
Data record 1
Not used
Not used
Not used
Not used
Not used
Fault during function
processing.
// 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

6076BC01

IBDB
MODE
SOURCE_AREA
SOURCE_AREA_NR
SOURCE_OFFSET
SOURCE_LENGTH
DESTINATION
RET

:=
:=
:=
:=
:=
:=
:=
:=

DB 20
1
0
0
0
0
0
M12.1

BUSY

:= M12.0

// Driver call to write output


data
// INTERBUS data block
// Data record 1
// Not used
// Not used
// Not used
// Not used
// Not used
// Fault during function
processing.
// Function is active.

5-35

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.

5-36

AN M10.0
S M10.0
R M10.1
CALL FC 20
IBDB
COM_ADR

:= DB 20
:= 512

DIAG_STATE
DIAG_PARA
FKN_START
FKN_PARA
FKN_STATE
MEM_READ
MEM_WRITE
LOAD

:=
:=
:=
:=
:=
:=
:=
:=

0
0
0
0
0
21
22
0

// Initialization function call.


// INTERBUS data block
// S7 base address of the
controller board
// Not used
// Not used
// Not used
// Not used
// Not used
// Number of the read driver
// Number of the write driver
// Parameterization of INTERBUS
using the parameterization
memory

6076BC01

Application Examples

BOOT
MODE
TIMER_NR
SOURCE
CONFIGURATION

RET
BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1

:= 0

// INTERBUS start from the


parameterization memory
:= 2
// Operating mode: asynchronous
with synchronization pulse
:= T1
// Timer used by this function
:= 0
// Not used
:= DW#16#80 // The controller board is
00000F
operating in extended
operating mode, additional
error data is stored in IBDB.
:= M10.1
// Fault during function
processing.
:= M10.0
// Function is active.
// Setting the START_UP bits.
// If FC 20 has not been
// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

Call Structure in OB 1
Call FC 24 diagnostic driver. FC 24 evaluates the status register and
acknowledges any errors that may have occurred.

6076BC01

CALL FC 24
IBDB
ACTIVATE

:= DB20
:= I4.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// In the event of an error,
INTERBUS is restarted after
the control system has been
reset.

5-37

IBS S7 400 ETH DSC SWD UM E

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
IBDB
READ_FC

:= DB20
:= FC 50

WRITE_FC

:= FC 51

CYCLE_OB

:= TRUE

RET

:= M14.0

// IB_SYNC driver call


// INTERBUS data block
// Function for reading the input
data
// Function for writing the
output data
// Default: FC 28 is called from
OB 1.
// Fault during function
processing.

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

Call Structure in OB 40
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, 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
IBDB
READ_FC

:= DB20
:= FC 50

WRITE_FC

:= FC 51

CYCLE_OB
RET

:= FALSE
:= M12.0

// IB_SYNC driver call


// INTERBUS data block
// Function for reading the input
data
// Function for writing the
output data
// FC 28 was called by OB 40.
// Fault during function
processing.

BE

5-38

6076BC01

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
IBDB
MODE
SOURCE
DEST_AREA
DEST_AREA_NR
DEST_OFFSET
DEST_LENGTH
RET
BUSY
BE

:=
:=
:=
:=
:=
:=
:=
:=

DB20
1
0
0
0
0
0
M10.1

:= M10.0

//
//
//
//
//
//
//
//
//

Driver call to read input data


INTERBUS data block
Data record 1 to be read in
Not used
Not used
Not used
Not used
Not used
Fault during function
processing.
// Function is active.

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

6076BC01

IBDB
MODE
SOURCE_AREA
SOURCE_AREA_NR
SOURCE_OFFSET
SOURCE_LENGTH
DESTINATION
RET

:=
:=
:=
:=
:=
:=
:=
:=

DB20
1
0
0
0
0
0
M11.1

BUSY
BE

:= M11.0

// Driver call to write output


data
// INTERBUS data block
// Data record 1 to be written
// Not used
// Not used
// Not used
// Not used
// Not used
// Fault during function
processing.
// Function is active.

5-39

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.
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:

Transparent
9600 baud
8 bits, even parity
RS-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.

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.

5-40

6076BC01

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
IBDB
COM_ADR
DIAG_STATE
DIAG_PARA
FKN_START
FKN_PARA
FKN_STATE
MEM_READ
MEM_WRITE
LOAD
BOOT
MODE
TIMER_NR
SOURCE
CONFIGURATION

RET
BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1

// Initialization function call.


:= DB 20
// INTERBUS data block
:= 512
// S7 base address of the
controller board
:= 0
// Not used
:= 0
// Not used
:= 0
// Not used
:= 0
// Not used
:= 0
// Not used
:= 21
// Number of the read driver
:= 22
// Number of the write driver
:= 0
// Parameterization of INTERBUS
using the memory card
:= 0
// INTERBUS start from the
parameterization memory
:= 0
// Operating mode: asynchronous
:= T1
// Timer used by this function
:= 0
// Not used
:= DW#16#80 // The controller board is
00000F
operating in extended
operating mode, additional
error data is stored in IBDB.
:= M10.1
// Fault during function
processing.
:= M10.0
// Function is active.
// Setting the START_UP bits.
// If FC 20 has not been
// processed correctly, the
program may be stopped here.

BEC
CALL SFC 46

6076BC01

5-41

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
IBDB
ACTIVATE

:= DB20
:= I4.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// 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

5-42

IBDB
MODE
SOURCE
DEST_AREA
DEST_AREA_NR
DEST_OFFSET
DEST_LENGTH
RET

:=
:=
:=
:=
:=
:=
:=
:=

DB 20
10
0
0
0
0
0
M10.1

BUSY

:= M10.0

// Driver call for executing the


handshake
// INTERBUS data block
// Handshake operation
// Not used
// Not used
// Not used
// Not used
// Not used
// Fault during function
processing.
// Function is active.

6076BC01

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
IBDB
SOURCE_DB_NR

:= DB 20
:= 10

SOURCE_DW_NR

:= 0

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

TOGGLE

:= M0.7

RET

:= M11.1

BUSY
INTERNAL

:= M11.0
:= MW60

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.
// Data word in which the first
word of the service to be sent
is entered.
// CR number of the PCP device
which should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.
// Internal bit memory bit,
creates a second clock.
// Fault during function
processing.
// Function is active.
// 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
IBDB
SOURCE_DB_NR

6076BC01

:= DB 20
:= 10

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.

5-43

IBS S7 400 ETH DSC SWD UM E

SOURCE_DW_NR

:= 10

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

TOGGLE

:= M0.7

RET

:= M12.1

BUSY
INTERNAL

:= M12.0
:= MW60

// Data word in which the first


word of the service to be sent
is entered.
// CR number of the PCP device
which should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.
// Internal bit memory bit,
creates a second clock.
// Fault during function
processing.
// Function is active.
// 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.

5-44

A I4.3
FP M40.2
S M13.0
CALL FC 25
IBDB
SOURCE_DB_NR

:= DB 20
:= 10

SOURCE_DW_NR

:= 40

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.
// Data word in which the first
word of the service to be sent
is entered.
// CR number of the PCP device
which should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.

6076BC01

Application Examples

TOGGLE

:= M0.7

RET

:= M13.1

BUSY
INTERNAL

:= M13.0
:= MW60

// Internal bit memory bit,


creates a second clock.
// Fault during function
processing.
// Function is active.
// 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
IBDB
SOURCE_DB_NR

:= DB 20
:= 10

SOURCE_DW_NR

:= 60

CR_NR

:= 2

DEST_DB_NR

:= 11

DEST_DW_NR

:= 0

TOGGLE

:= M0.7

RET

:= M14.1

BUSY
INTERNAL

:= M14.0
:= MW60

// IB_SERV driver call


// INTERBUS data block
// Data block in which the
service to be sent is entered.
// Data word in which the first
word of the service to be sent
is entered.
// CR number of the PCP device
which should receive the
service.
// Data block in which the
received confirmation is
entered.
// Data word in which the first
word of the received
confirmation is entered.
// Internal bit memory bit,
creates a second clock.
// Fault during function
processing.
// Function is active.
// 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

IBS S7 400 ETH DSC SWD UM E

AN M15.0
S M15.0
CALL FC 22
IBDB
MODE
SOURCE_AREA
SOURCE_AREA_NR
SOURCE_OFFSET
SOURCE_LENGTH
DESTINATION
RET

:=
:=
:=
:=
:=
:=
:=
:=

DB 20
10
0
0
0
0
0
M15.1

BUSY

:= M15.0

// Driver call for executing the


handshake
// INTERBUS data block
// Handshake operation
// Not used
// Not used
// Not used
// Not used
// Not used
// Fault during function
processing.
// Function is active.

Description of DB 10 Data Block


Address Parameter
DBW0
DienstCodeINI

DBW10

5-46

Length Value
WORD W#16#8B

ParaCountINI

WORD

W#16#2

CR_Nummer INI

WORD

W#16#0

IndexINI

WORD

W#16#0

reserviert

WORD

W#16#0

DienstCodeINIT_TABLE

WORD

W#16#82

ParaCountINIT_TABLE
CR_NummerINIT_TABLE

WORD
WORD

IndexINIT_TABLE

WORD

SubIndexINIT_TABLE

BYTE

Description
Service code for establishing the
connection to the V.24 module
(initiate request)
Number of initiate request
parameters
CR number of the PCP device. This
parameter is written by FC 25.
Index for initializing the
connection establishment
Reserved

Service code for configuring the


V.24 module (write request)
W#16#10
Number of write request parameters
W#16#0
CR number of the PCP device. This
parameter is written by FC 25.
W#16#5FFF Index for configuring the V.24
module
B#16#0
The parameter defines which
standard configuration settings
should be modified (in the example:
00 = modification of all settings).

6076BC01

Application Examples

Address Parameter
LengthINIT_TABLE

DBW40

6076BC01

Length Value
BYTE B#16#14

Description
Volume of data to be modified. If
all data is to be modified, enter
14hex here.

Protokoll

BYTE

B#16#0

Baud_Rate

BYTE

B#16#7

Datenbreite

BYTE

B#16#2

reserviert1
reserviert2
Error_Pattern

BYTE
BYTE
BYTE

B#16#0
B#16#0
B#16#24

First_Delimiter

BYTE

B#16#D

Second_Delimiter

BYTE

B#16#A

Prioritaet

BYTE

B#16#0

Ausgangstyp

BYTE

B#16#0

DTR_Steuerung

BYTE

B#16#0

Umlauf_Schalter
XON_Pattern
XOFF_Pattern
reserviert3
reserviert4
reserviert5

BYTE
BYTE
BYTE
WORD
WORD
WORD

B#16#0
B#16#11
B#16#13
W#16#0
W#16#0
W#16#0

Transmission protocol (in


the example: 00 = transparent)
Transmission rate (in
the example: 07 = 9600 baud)
Data width (in
the example: 02 = 8 bits, even
parity)
Reserved
Reserved
Character that is written to the
buffer if an error occurs while
receiving a V.24 character.
End character for dual buffer and
end-to-end protocol (CR)
End character for dual buffer and
end-to-end protocol (LF)
3964R priority (in
the example: 00 = low)
Output type (in
the example: 00 = RS-232)
DTR control (in
the example: 00 = automatic)
(in the example: 00 = no rotation)
Control character for XON/XOFF
protocol

DienstCodeWRITE

WORD

W#16#82

ParaCountWRITE
CR_NummerWRITE

WORD
WORD

IndexWRITE
SubIndexWRITE

WORD
WORD

Reserved
Reserved
Reserved

Service code for sending V.24 data


(write request)
W#16#8
Number of write request parameters
W#16#0
CR number of the PCP device. This
parameter is written by FC 25.
W#16#5FE0 Index for sending V.24 data
W#16#A
Volume of data to be sent (in
the example: 10 characters)

5-47

IBS S7 400 ETH DSC SWD UM E

Address Parameter

DBW60

5-48

Length Value

data0
data1
data2
data3
data4
data5
data6
data7
data8

CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
CHAR
WORD

T
E
R
M
I
N
A
L
W#16#A0D

DienstCodeREAD1

WORD

W#16#81

ParaCountREAD1
CR_NummerREAD1

WORD
WORD

IndexREAD1
SubIndexREAD1

WORD
WORD

Description

Service code for receiving V.24


data (read request)
W#16#3
Number of read request parameters
W#16#0
CR number of the PCP device. This
parameter is written by FC 25.
W#16#5FE0 Index for receiving V.24 data
W#16#0
The parameter defines that all data
is to be read.

6076BC01

Application Examples
Description of DB 11 Data Block
Address Parameter
DBW0
ConfirmationCode
Para_Count

6076BC01

Length Value
WORD
WORD

CR_Nummer

WORD

Result
data1
:
data13

WORD
WORD
WORD
WORD

Description
Code of the received confirmation
Number of parameters of the
received confirmation
CR number of the received
confirmation
Result of the received confirmation

5-49

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.
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:

Transparent
9600 baud
8 bits, even parity
RS-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.

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.

5-50

6076BC01

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
IBDB
COM_ADR
DIAG_STATE
DIAG_PARA
FKN_START
FKN_PARA
FKN_STATE
MEM_READ
MEM_WRITE
LOAD

BOOT
MODE
TIMER_NR
SOURCE
CONFIGURATION

RET
BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1

6076BC01

// Initialization function call.


:= DB 20
// INTERBUS data block
:= 512
// S7 base address of the
controller board
:= 0
// Not used
:= 0
// Not used
:= 0
// Not used
:= 0
// Not used
:= 0
// Not used
:= 21
// Number of the read driver
:= 22
// Number of the write driver
:= 0
// Parameterization of INTERBUS
using the parameterization
memory
:= 0
// INTERBUS start from the
parameterization memory
:= 0
// Operating mode: asynchronous
:= T1
// Timer used by this function
:= 0
// Not used
:= DW#16#80 // The controller board is
00000F
operating in extended
operating mode, additional
error data is stored in IBDB.
:= M10.1
// Fault during function
processing.
:= M10.0
// Function is active.
// Setting the START_UP bits.
// If FC 20 has not been
// processed correctly, the
program may be stopped here.

5-51

IBS S7 400 ETH DSC SWD UM E

BEC
CALL SFC 46

Call Structure in OB 1
Call FC 24 diagnostic driver. The FC 24 evaluates the status register and
acknowledges any errors that may have occurred.
CALL FC 24
IBDB
ACTIVATE

:= DB20
:= I4.0

AUTO_START
RUN
PF
BUS_QUALITY
DETECTION

:=
:=
:=
:=
:=

BUSY_STATE
RET

:= M100.5
:= M100.6

START_UP

:= M100.7

M100.0
M100.1
M100.2
M100.3
M100.4

// Diagnostic driver call


// INTERBUS data block
// Error acknowledgment using an
external activation button
// Autostart after an error
// INTERBUS in RUN
// Peripheral fault indicated
// Quality exceeded.
// Controller board searching for
an error.
// Standard function is active.
// Fault during function
processing.
// 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.

5-52

AN M10.0
S M10.0
CALL FC 21
IBDB
MODE
SOURCE
DEST_AREA
DEST_AREA_NR
DEST_OFFSET
DEST_LENGTH
RET

:=
:=
:=
:=
:=
:=
:=
:=

BUSY

:= M10.0

DB 20
1
0
0
0
0
0
M10.1

//
//
//
//
//
//
//
//
//

Driver call to read input data


INTERBUS data block
Data record 1
Not used
Not used
Not used
Not used
Not used
Fault during function
processing.
// Function is active.

6076BC01

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
IBDB
TIMER_NR
RET

:= DB 20
:= T2
:= M11.1

START

:= DB3.DBX4.0

STATE

:= DB2.DBX4.0

RESULT

:= DB2.DBX5.0

BUSY

:= M11.0

//
//
//
//

//

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
// Start bit of the user
function parameterized in
IBS CMD.
// Status bit of the user
function parameterized in
IBS CMD.
// Result bit of the user
function parameterized in
IBS CMD.
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
IBDB
TIMER_NR
RET
START

6076BC01

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
:= DB3.DBX4.1 // Start bit of the user
function parameterized in
IBS CMD.

:= DB 20
:= T2
:= M12.1

//
//
//
//

5-53

IBS S7 400 ETH DSC SWD UM E

STATE

RESULT

BUSY

:= DB2.DBX4.1 // Status bit of the user


function parameterized in
IBS CMD.
:= DB2.DBX5.1 // Result bit of the user
function parameterized in
IBS CMD.
:= 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
IBDB
TIMER_NR
RET

:= DB 20
:= T2
:= M13.1

START

:= DB3.DBX4.2

STATE

:= DB2.DBX4.2

RESULT

:= DB2.DBX5.2

BUSY

:= M13.0

//
//
//
//

//

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
// Start bit of the user
function parameterized in
IBS CMD.
// Status bit of the user
function parameterized in
IBS CMD.
// Result bit of the user
function parameterized in
IBS CMD.
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
IBDB
TIMER_NR
RET
START

5-54

IB_FUNCT driver call


INTERBUS data block
Timer used by this function
Fault during function
processing.
:= DB3.DBX4.3 // Start bit of the user
function parameterized in
IBS CMD.

:= DB 20
:= T2
:= M14.1

//
//
//
//

6076BC01

Application Examples

STATE

RESULT

BUSY

:= DB2.DBX4.3 // Status bit of the user


function parameterized in
IBS CMD.
:= DB2.DBX5.3 // Result bit of the user
function parameterized in
IBS CMD.
:= M14.0
// Function is active.

Writing the first output data record parameterized under IBS CMD.
AN M15.0
S M15.0
CALL FC 22

6076BC01

IBDB
MODE
SOURCE_AREA
SOURCE_AREA_NR
SOURCE_OFFSET
SOURCE_LENGTH
DESTINATION
RET

:=
:=
:=
:=
:=
:=
:=
:=

DB 20
1
0
0
0
0
0
M15.1

BUSY

:= M15.0

// Driver call to write output


data
// INTERBUS data block
// Data record 1 to be written
// Not used
// Not used
// Not used
// Not used
// Not used
// Fault during function
processing.
// Function is active.

5-55

IBS S7 400 ETH DSC SWD UM E

5-56

6076BC01

Section

This section informs you about


the technical data for the driver software.

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

6076BC01

6-1

6-2

6076BC01

Technical Data for the Driver Functions

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

Timer, depending
on the parameter

None

None

Data block used:

IBDB

IBDB

IBDB

Functions called :

SFC 47

SFC 59

SFC 58

1.2

1.2

1.2

Bit memory bits, times and counters


used:

Version:

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

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

IBS S7 400 ETH DSC SWD UM E

6-4

6076BC01

Appendix A

A 1 List of Figures

6076BC01

Figure 2-1:

Diagnostic status register .............................................2-5

Figure 2-2:

Diagnostic parameter register ......................................2-6

Figure 2-4:

Transferring the device number in the


standard 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 with


synchronization pulse mode ........................................4-8

Figure 5-1:

Example configuration .................................................5-6

A-1

A-2

6076BC01

Appendix A

A 2 List of Tables

6076BC01

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 DBW58


of the IBDB .................................................................4-22

Table 4-4:

Error numbers of FC MEM_WRIT in DBW60


of the IBDB .................................................................4-26

Table 4-5:

Error numbers of FC IB_SERV in DBW62


of the IBDB .................................................................4-33

Table 4-6:

Error numbers of FC IB_FUNCT in DBW82


of the IBDB .................................................................4-36

Table 4-7:

Error numbers of FC IB_SYNC in DBW86


of the IBDB .................................................................4-38

Table 4-8:

Data words of the INTERBUS data block IBDB..........4-39

A-3

List of Tables

A-4

6076BC01

Appendix A

A 3 Index
D

Example applications (direct mode)


I/O data transport in asynchronous
bus operating mode............ 5-10

Diagnostic register
Diagnostic parameter register............ 2-6

Call structure...................................... 4-7

I/O data transport in


asynchronous with
synchronization pulse bus
operating mode................... 5-12

Call structure in asynchronous mode 4-7

Integration in the control system........ 5-7

Call structure in the asynchronous


with synchronization pulse
mode..................................... 4-8

PCP communication (FC 25)........... 5-16

Diagnostic status register .................. 2-5


Driver functions

PCP communication (FC 27)........... 5-26


Example applications (extended mode)

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

I/O data transport in asynchronous


bus operating mode............ 5-33

FC 21 MEM_READ.......................... 4-20
FC 22 MEM_WRIT .......................... 4-24

I/O data transport in


asynchronous with
synchronization pulse bus
operating mode................... 5-36

FC 24 IB_DIAG................................ 4-28
FC 25 IB_SERV............................... 4-32
FC 27 IB_FUNCT ............................ 4-35

Integration in the control system...... 5-31

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

PCP communication (FC 25)........... 5-40

INTERBUS data block IBDB............ 4-39

PCP communication (FC 27)........... 5-50

Technical data ................................... 6-3


Driver software
Disk content ....................................... 4-4
Installation.......................................... 4-4

I
INTERBUS operating modes
Asynchronous mode.......................... 3-3

Tasks ................................................. 1-3

Asynchronous with
synchronization pulse mode . 3-3

E
Example applications
INTERBUS/control system
configuration ......................... 5-6
Introduction ........................................ 5-3
Short description................................ 5-4

6076BC01

S
Standard register
Standard function parameter register2-11
Standard function start register ......... 2-9
Standard function status register..... 2-10

A-5

Index

A-6

6076BC01

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 documentation.
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 Services
Dokumentation INTERBUS
32823 Blomberg
GERMANY
Phone +49 - (0) 52 35 - 3-00
Telefax +49 - (0) 52 35 - 3-4 20 66
E-Mail tecdoc@phoenixcontact.com

FAX Reply
Phoenix Contact GmbH & Co.
Marketing Services
Dokumentation INTERBUS

Date:
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

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
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:

Das könnte Ihnen auch gefallen