Beruflich Dokumente
Kultur Dokumente
User Manual
Controller Board Software for Siemens SIMATIC S7-400
Designation:
Revision:
BC01
Order No.:
27 43 99 6
6076BC01
Order No. 27 31 10 2
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
6076BC01
Table of Contents
1 Driver Software Tasks.......................................................................................1-3
2 INTERBUS Standard and Diagnostic Registers ...............................................2-3
2.1
2.2
2.3
2.1.2
2.1.3
2.2.3
2.3.2
3.2
6076BC01
4.1
4.2
4.3
4.4
4.5
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.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
5 Application Examples........................................................................................5-3
5.1
5.1.1
5.1.2
5.1.3
5.1.4
5.2
5.3
5.4
5.5
ii
5.4.1
5.4.2
5.4.3
5.4.4
6076BC01
Table of Contents
5.6
5.6.2
5.6.3
5.6.4
6076BC01
iii
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.
6076BC01
1-1
1-2
6076BC01
6076BC01
1-3
1-4
6076BC01
Section 2
This section informs you about
INTERBUS standard and diagnostic registers.
2.2
2.3
6076BC01
2.1.2
2.1.3
2.2.3
System Control..........................................................................2-12
2.3.1
2.3.2
2-1
2-2
6076BC01
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.
6076BC01
2-3
2.1
2-4
6076BC01
2.1.1
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
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
2-5
2.1.2
E r S r ot r r l u o n c g a st i o o r n t
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
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
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
2.1.3
BUS = 1:
6076BC01
2-7
USER = 1:
2-8
6076BC01
2.2
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
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
2)
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
2.2.2
2-10
6076BC01
2.2.3
2dec
00000010bin
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
2-11
2.3
System Control
2.3.1
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
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
2.3.2
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
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
2-14
6076BC01
Section 3
This section informs you about
INTERBUS operating modes.
6076BC01
3.1
3.2
3-1
3-2
6076BC01
3.1
Asynchronous Mode
3.2
6076BC01
3-3
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.
4.2
4.3
4.4
4.5
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
4-1
4-2
6076BC01
6076BC01
4-3
4.1
Disk content
(Drive):
\README.TXT
4-4
6076BC01
\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
Description of the
file structure
File
Description
IBSWD412.S7P
IOASYNCH.S7P
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
Via FC 25
Asynchronous
Via FC 27
Asynchronous with
synchronization pulse
Via FC 25
Via FC 27
4-6
6076BC01
4.2
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
Key:
IBDB = INTERBUS data block
6076BC01
4-7
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
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
4.3
6076BC01
4-9
4.4
4-10
6076BC01
4.5
4.5.1
Task
The initialization function (FC 20) is called during the control system startup
(OB 100). Its task is to synchronize the control system and the controller
board. In addition, this driver controls the startup behavior of the controller
board and parameterizes the software drivers (e.g., transfer of base
addresses). It also enters data in the INTERBUS data block that is required
by other functions. The controller board can also be parameterized using a
parameterization data block created by IBS CMD, which contains the boot
configuration.
Once the controller board and the INTERBUS system have been started,
the function will be terminated.
To start FC 20 in OB 100, an activation bit must be set (BUSY parameter).
This parameter remains set as long as the function is active. After the
controller board has been parameterized and the INTERBUS system has
been started, the function resets the activation bit (BUSY = 0). The result
is displayed in the RET bit. If RET = 0, the INTERBUS system has been
started and is ready to operate. If the RET bit is set (RET = 1), an error has
occurred and, in the following examples, the control system is set to STOP.
The diagnostic display, the diagnostic register and IBS CMD SWT G4
indicate the cause.
Depending on the operating mode (direct or extended), in which you would
like to operate the controller board, different inputs must be made in FC 20.
For additional information, please refer to the IBS SYS DIAG DSC UM E
Diagnostics Guide.
Preconditions
6076BC01
4-11
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
//
//
6076BC01
:= 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
//
//
4-13
IBDB
Extended Mode
COM_ADR
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".
4-14
6076BC01
Extended Mode
MEM_READ
= 0, not used
MEM_WRITE
= 0, not used
LOAD
LOAD
Abbrev.
FLASH
Description
Loads the configuration from the parameterization
memory
6076BC01
In preparation
4-15
BOOT
Description
MODE
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
TIMER_NR
SOURCE
6076BC01
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
Bit 0 (PF)
Value
6076BC01
4-17
Value
Description
0/1
Reserved
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
Description
Table 4-2
Error Number
4-18
Description
Timeout
6076BC01
Error Number
Description
6076BC01
4-19
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
6076BC01
MODE
Description
1-4
5-9
Reserved
10
Handshake operation
SOURCE
MODE
0
1 - 4, 5 - 9,
10
0, not used
DEST_AREA
DEST_AREA
6076BC01
4-21
DEST_OFFSET
DEST_LENGTH
RET
Table 4-3
Error Number
Description
> 10
4-22
6076BC01
6076BC01
4-23
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
6076BC01
MODE
Description
1-4
5-9
Reserved
10
Handshake operation
SOURCE_AREA
SOURCE_AREA
Data Source
6076BC01
4-25
SOURCE_LENGTH
DESTINATION
MODE
0
1 - 4, 5 - 9,
10
0, not used
RET
Table 4-4
Error Number
4-26
Description
6076BC01
Error Number
Description
> 10
BUSY
6076BC01
4-27
4.5.4
Task
FC 24 IB_DIAG
4-28
6076BC01
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
ACTIVATE
AUTO_START
AUTO_START
6076BC01
Description
4-29
Description
PF
Description
BUS_QUALITY
DETECTION
4-30
6076BC01
RET
START_UP
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
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
IBDB
SOURCE_DB_NR
SOURCE_DW_NR
6076BC01
DEST_DB_NR
DEST_DW_NR
TOGGLE
RET
Table 4-5
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.
4-33
4-34
6076BC01
4.5.6
Task
FC 27 IB_FUNCT
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
//
//
//
//
//
//
//
//
IBDB
TIMER_NR
4-35
Table 4-6
Error Number
Description
Timeout.
The execution time of the user function (10 s) was
exceeded. Check your parameterization.
START
STATE
RESULT
BUSY
4-36
6076BC01
4.5.7
FC 28 IB_ SYNC
Task
Preconditions
Call structure
Parameter
descriptions
CALL FC 28
IBDB
READ_FC
:= DB20
:= FC50
WRITE_FC
:= FC51
CYCLE_OB
RET
:= TRUE
:= M10.1
IBDB
READ_FC
WRITE_FC
CYCLE_OB
6076BC01
4-37
Table 4-7
Error Number
Description
//
//
// Call FC MEM_READ
// INTERBUS data block
:
:
//
//
// Call FC MEM_WRIT
// INTERBUS data block
:
:
4-38
6076BC01
4.6
Table 4-8
Data
Word
6076BC01
Description
DBW56
ERR_Nr_INIT
DBW58
ERR_Nr_READ
DBW60
ERR_Nr_WRITE
DBW62
ERR_Nr_IB_SERV
DBW74
IB_INIT_ERR_PAR_
CODE
DBW76
IB_INIT_ERR_DIAG
_STATE
DBW78
IB_INIT_ERR_DIAG
_PARA
DBW82
ERR_Nr_IB_FUNCT
DBW86
ERR_NR_IB_SYNC
DBW96
UPDATE_TIMER
4-39
4-40
Data
Word
Parameter
Description
DBW98
UPDATE_TIME
DBW168
DIAG_PARA_2
DBW190
INTERRUPT_CNT
DBW200
Error_Counter_
BUS_ERR
DBD202
DATE_BUS_ERR
DBD206
TIME_BUS_ERR
DBW210
BUS_ERR_1
...
...
...
DBW248
BUS_ERR_20
DBW250
Error_Counter_
CTRL_ERR
DBD252
DATE_CTRL_ERR
DBD256
TIME_CTRL_ERR
DBW260
CTRL_ERR_1
...
...
...
6076BC01
Data
Word
Parameter
Description
DBW278
CTRL_ERR_10
DBW280
Error_Counter_
USER_ERR
Number of user/parameterization
errors (USER)
DBD282
DATE_USER_ERR
DBD286
TIME_USER_ERR
DBW290
USER_ERR_1
...
...
...
DBW308
USER_ERR_10
DBW310
Error_Counter_
PF_ERR
DBD312
DATE_PF_ERR
Date of PF
DBD316
TIME_PF_ERR
Time of PF
DBW320
PF_ERR_1
...
...
...
DBW830
PF_ERR_256
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
4-42
6076BC01
Section
6076BC01
Example Applications..................................................................5-4
5.1.1
5.1.2
5.1.3
5.1.4
5.2
5.3
5.4
5.4.2
5.4.3
5.4.4
5.5
5.6
5.6.2
5.6.3
5.6.4
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.
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
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
STEP 7 :
5.1.2
IOASYNCH.BG4
IOASYNCH.S7P
5-4
IOASYIMP.BG4
STEP 7:
IOASYIMP.S7P
6076BC01
Application Examples
5.1.3
STEP 7 :
5.1.4
PCPFC25.BG4
PCPFC25.S7P
STEP 7 :
PCPFC27.BG4
PCPFC27.S7P
6076BC01
5-5
5.2
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
Ensure that:
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
I244
I246
I248
Q248
I250
Q250
6076BC01
5-7
S7
Address
S5
Address
Length
Part
of PI
Coupling
Area
124
128
128
124
256
128
384
128
124
512*
252
P/Q
S7 address
S5 address
Length
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
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
5.4
5.4.1
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
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
//
//
//
//
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
5-11
5.4.2
5-12
:= DB 20
:= 512
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
BEC
CALL SFC 46
6076BC01
5-13
:= 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
:= DB20
:= FC 50
WRITE_FC
:= FC 51
CYCLE_OB
:= TRUE
RET
:= M14.0
5-14
6076BC01
Application Examples
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
BE
6076BC01
5-15
5.4.3
INIT_TABLE
Transparent
9600 baud
8 bits, even parity
RS-232
V.24 RECEIVE
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
5-17
S M100.7
AN M10.0
AN M10.1
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
5-18
:=
:=
:=
:=
:=
DB 20
10
0
0
0
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
5-19
:= 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
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
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
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
5-21
TOGGLE
:= M0.7
RET
:= M14.1
BUSY
INTERNAL
:= M14.0
:= MW60
:=
:=
:=
:=
:=
:=
:=
:=
DB 20
10
0
0
0
0
0
M15.1
BUSY
:= M15.0
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
5-23
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
DienstCodeREAD1
WORD
W#16#81
ParaCountREAD1
CR_NummerREAD1
WORD
WORD
IndexREAD1
SubIndexREAD1
WORD
WORD
DBW60
5-24
Description
Reserved
W#16#82
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
5.4.4
INIT_TABLE
Transparent
9600 baud
8 bits, even parity
RS-232
V.24 RECEIVE
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
5-27
S M100.7
AN M10.0
AN M10.1
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
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
//
:= DB 20
:= T2
:= M12.1
//
//
//
//
START
:= Q8.1
//
STATE
:= I8.1
//
RESULT
:= I9.1
//
BUSY
:= M12.0
//
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
5-29
IBDB
TIMER_NR
RET
:= DB 20
:= T2
:= M13.1
START
:= Q8.2
STATE
:= I8.2
RESULT
:= I9.2
BUSY
:= M13.0
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
//
6076BC01
Application Examples
5.5
Ensure that:
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
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
5.6.1
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
5-33
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
6076BC01
Application Examples
:=
:=
:=
:=
:=
:=
:=
:=
BUSY
:= M11.0
DB 20
1
0
0
0
0
0
M11.1
//
//
//
//
//
//
//
//
//
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
5-35
5.6.2
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
6076BC01
Application Examples
BOOT
MODE
TIMER_NR
SOURCE
CONFIGURATION
RET
BUSY
AN M100.7
S M100.7
AN M10.0
AN M10.1
:= 0
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
5-37
:= DB20
:= FC 50
WRITE_FC
:= FC 51
CYCLE_OB
:= TRUE
RET
:= M14.0
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
BE
5-38
6076BC01
Application Examples
:=
:=
:=
:=
:=
:=
:=
:=
DB20
1
0
0
0
0
0
M10.1
:= M10.0
//
//
//
//
//
//
//
//
//
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
5-39
5.6.3
INIT_TABLE
Transparent
9600 baud
8 bits, even parity
RS-232
V.24 RECEIVE
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
BEC
CALL SFC 46
6076BC01
5-41
:= 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
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
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
6076BC01
:= DB 20
:= 10
5-43
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
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
6076BC01
Application Examples
TOGGLE
:= M0.7
RET
:= M13.1
BUSY
INTERNAL
:= M13.0
:= MW60
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
6076BC01
5-45
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
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
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
DienstCodeWRITE
WORD
W#16#82
ParaCountWRITE
CR_NummerWRITE
WORD
WORD
IndexWRITE
SubIndexWRITE
WORD
WORD
Reserved
Reserved
Reserved
5-47
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
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
5.6.4
INIT_TABLE
Transparent
9600 baud
8 bits, even parity
RS-232
V.24 RECEIVE
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
5-51
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
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
//
//
//
//
//
//
//
//
//
6076BC01
Application Examples
:= DB 20
:= T2
:= M11.1
START
:= DB3.DBX4.0
STATE
:= DB2.DBX4.0
RESULT
:= DB2.DBX5.0
BUSY
:= M11.0
//
//
//
//
//
6076BC01
:= DB 20
:= T2
:= M12.1
//
//
//
//
5-53
STATE
RESULT
BUSY
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
//
//
//
//
//
5-54
:= DB 20
:= T2
:= M14.1
//
//
//
//
6076BC01
Application Examples
STATE
RESULT
BUSY
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
5-55
5-56
6076BC01
Section
6076BC01
6-1
6-2
6076BC01
Block Name
INIT_IB
MEM_READ
MEM_WRIT
Block number
FC 20
FC 21
FC 22
2706
1912
2396
2360
1608
2052
82
74
88
Timer, depending
on the parameter
None
None
IBDB
IBDB
IBDB
Functions called :
SFC 47
SFC 59
SFC 58
1.2
1.2
1.2
Version:
Block Name
IB_DIAG
IB_SERV
IB_FUNCT
IB_SYNC
Block number
FC 24
FC 25
FC 27
FC 28
1226
1406
378
876
1028
1202
250
700
88
60
34
None
INTERNAL
variable
None
None
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
6-4
6076BC01
Appendix A
A 1 List of Figures
6076BC01
Figure 2-1:
Figure 2-2:
Figure 2-4:
Figure 2-5:
Figure 2-6:
Figure 4-1:
Figure 4-2:
Figure 5-1:
A-1
A-2
6076BC01
Appendix A
A 2 List of Tables
6076BC01
Table 4-1:
Table 4-2:
Table 4-3:
Table 4-4:
Table 4-5:
Table 4-6:
Table 4-7:
Table 4-8:
A-3
List of Tables
A-4
6076BC01
Appendix A
A 3 Index
D
Diagnostic register
Diagnostic parameter register............ 2-6
FC 20 INIT_IB.................................. 4-11
FC 21 MEM_READ.......................... 4-20
FC 22 MEM_WRIT .......................... 4-24
FC 24 IB_DIAG................................ 4-28
FC 25 IB_SERV............................... 4-32
FC 27 IB_FUNCT ............................ 4-35
FC 28 IB_SYNC............................... 4-37
I
INTERBUS operating modes
Asynchronous mode.......................... 3-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
FAX Reply
Phoenix Contact GmbH & Co.
Marketing Services
Dokumentation INTERBUS
Date:
Fax No:
From:
Company:
Name:
Department:
Address:
Job function:
City, ZIP
code:
Phone:
Country:
Fax:
Document:
Designation:
Revision:
Order No.:
Yes
In part
No
Yes
In part
No
Other Comments: