Freelance Distributed Control System
Help File
PROFIBUS DP communication between Freelance Control System
and Siemens S7-300 PLC
Summary
The purpose of this document is to provide a viable solution for customers that wish to connect Siemens S7-300 PLC with
Freelance Control System via PROFIBUS DP Communication. This document will guide users how to integrate with
Freelance control system and Siemens S7-300 PLC via PROFIBUS DP communication efficiently.
Pre-Requisites
This document is intended for those who have a basic understanding of Freelance, PROFIBUS and Siemens. This help file is
not a replacement for the Freelance or Siemens documentation and should only be used in conjunction with the manuals.
Recommended Reading
Freelance
Item Name of Document Document Number
1 Engineering Manual, 3BDD012515R0701
communication and fieldbuses
2 Engineering Manual, 3BDD012503R0801
system configuration
3 Mounting and installation 3BDD012501R0801
instructions, AC800F
4 Introduction, getting started 3BDD02560R0701
Table 1-1
Siemens S7-300 PLC
Item Name of Document Document Number
1 STEP 7 Getting Start 6ES7810-4CA07-8BW0
2 S7-CPs for PROFIBUS Configuring Release 06/2005
and Commissioning C79000-G8976-C181-02
Table 1-2
Hardware
The following components are required before establishing the PROFIBUS DP communication between Freelance Control
System and Siemens S7-300 PLC with CP 342-5 Communication Module:
- Freelance Control System with Control Builder F Version 8.2 or above
- Siemens S7-300 CPU 314C-2DP hardware with Step 7 V5.4 software
- CP 342-5 PROFIBUS DP Communication Module
Architecture
The architecture of the hardware will be set up similar to the following diagram:
AC 800F with FI830 Architecture
PROFIBUS
CPU 314C-2DP with CP 342-5
Figure 1-1
General Process
Below diagram shows the basic steps involved in establishing the communication between Freelance controller and
Siemens controller via PROFIBUS DP.
3. Configuration 4. Inport .gsd file
1. Planning Data 2. Configuration
of I/O data area in Control 5. Edit I/O
Communication Buffer of Profibus DP
and FC Builder F Channels
Area Interface
Programming Software
1|P ag e
Interaction between the CPU and PROFIBUS CP in the DP Slave Mode
Below chart shows the whole communication process, it is divided into two parts as below:
Part A: Periodic Data Communication between DP Master and DP Slave
DP Master and DP Slave data exchange in accordance with the DP polling cycle. The exchanged data stored in the
PROFIBUS DP module’s Send and Receive buffer area. DP Master starts the data exchange task and transmit output data,
and at the same time to receive input data.
Part B: Data exchange between CPU and PROFIBUS CP module
Data exchange between the CPU and the PROFIBUS CP module based on DP_RECV and DP_SEND function block (FCs) and
CPU call cycle time.
Figure 1-2
Programming Method in DP Slave Mode
Normally we use below two FCs in application programming interface:
- DP_RECV: receive DP data from DP Master
- DP_SEND: send DP data to DP Master
Common used function blocks as shown below:
FC FC Meaning
Can be used with:
DP Master DP Slave
DP_SEND (FC1) X X For sending data
DP_RECV (FC2) X X For receiving data
DP_DIAG (FC3) X - For diagnostic functions initiated by the DP master
DP_CTRL (FC4) X - For control functions
2|P ag e
Description of Function Blocks
1) FC1 DP_SEND
Definition of the Function Block:
Parameter Declaration Type Possible Remarks
Values
CPLADDR INPUT WORD Module base address
When you configure the CP with STEP 7
hardware configuration, the module start
address is displayed in the configuration table.
Specify this address here.
SEND INPUT ANY Specifies the address and length.
(as VARTYPE The address of the DP data area refers to one of
only BYTE, with the following:
FC1 V3 and - Process image area
higher: BYTE - Bit memory
With FC1 up to - Data block area
V2.x: BTYE, The length must be set for
WORD and - DP master: 1 to 240
DWORD) - DP slave: 1 to 86
The following applies to new
modules (see CP manual):
- DP master: 1…2160
- DP slave: 1…240
DONE OUTPUT BOOL 0: - This parameter indicates whether or not the job
1: new data was executed without errors.
For the meaning of this parameter in conjunction
with the ERROR and STATUS parameters, refer to
the following table.
ERROR OUTPUT BOOL 0: - For the meaning of this parameter in conjunction
1: error with the DONE and STATUS parameters, refer to
the follow table.
STATUS OUTPUT WORD See following Status code
table For the meaning of this parameter in conjunction
with the DONE and ERROR parameters, refer to
the following table 8-1.
3|P ag e
Common error status information description:
DONE ERROR STATUS Meaning
0 0 8180H Startup:
The DP service was started but data acceptance is not yet possible.
Normal operation:
Data transfer active.
With newer CP types, the following meaning is possible (see
/2/):
DP has not been started, due to CP STOP or “no parameter
assignment” (occurs here instead of code 0, 1, 8183H!).
1 0 0000 H New data transferred without error.
0 1 8183 H No configuration or the DP service has not yet started on the PROFIBUS DP.
0 1 8184 H System error or bad parameter type.
0 1 8F22 H Area length error reading a parameter (e.g. DB too short).
0 1 8F23 H Area length error writing a parameter (e.g. DB too short).
0 1 8F24 H Area error reading a parameter.
0 1 8F25 H Area error writing a parameter.
0 1 8F28 H Alignment error reading a parameter.
0 1 8F29 H Alignment error writing a parameter.
0 1 8F30 H Parameter is in the write-protected 1st act. data block.
nd
0 1 8F31 H Parameter is in the write-protected 2 act. data block.
0 1 8F32 H Parameter contains a DB number that is too high.
0 1 8F33 H DB number error.
0 1 8F42 H Timeout reading a parameter from the I/O area.
0 1 8F43 H Timeout writing a parameter to the I/O area.
0 1 8F44 H Address of the parameter to be read is disabled in the access track.
0 1 8F45 H Address of the parameter to be written is disabled in the access track.
0 1 8F7F H Internal error, e.g. illegal ANY reference.
0 1 8090 H No module with this address exists.
0 1 8091 H Logical base address not at a double word boundary.
0 1 80A1 H Negative a acknowledgment writing to the module.
0 1 80B0 H The module does not recognize the data record.
0 1 80B1 H The specified data record length is incorrect.
Master mode:
The length of the source area in the SEND parameter is greater than the
length configured on the PROFIBUS CP for output data.
Slave mode:
The length of the source area specified in the SEND parameter is greater
than the maximum length specified in the product information bulletin /
manual /2/.
With newer CP types, the following applies to the DP
master and DP slave modes (see /2/):
The number of data to be sent exceeds the upper limit for
this service.
0 1 80C0 H The data record cannot be read.
0 1 80C1H The specified data record is currently being processed.
0 1 80C2 H There are too many jobs pending.
0 1 80C3 H Resources occupied (memory)
0 1 80C4 H Communication error (occurs temporarily, it is usually best to repeat the
job in the user program).
0 1 80D2 H Logical base address incorrect.
4|P ag e
ANY data type using instruction
ANY: applied to the actual parameters of unknown type or use any data type occasions. Specific information can
refer to the following sections:
“Format of the Parameter Type ANY”
“Using the Parameter Type ANY”
Example:
ANY 10 Bytes Is used when the data type of the current parameter is
unknown.
Format:
P#M50.0 BYTE 10 ANY format for data types
P#M100.0 WORD 5
L#1COUNTER 10 ANY format for
Parameter type
Definition data area to ANY parameter:
Not only ANY parameter can be appointed the detail address (e.g. MW100), but also can be appointed the data
area.
Detail format as below:
P# Area ID Byte.Bit Data Type Area Length
data type can be appointed all data types, if data type is not BOOL, it must use address mode (x.0).
Example:
Actual Parameter Description
P# M 50.0 BYTE 10 Specifies 10 bytes in the byte memory area:
MB50 to MB59.
P# DB 10.DBX5.0 S5TIME 3 Specifies 3 units of data of the data type S5TIME,
that are located in DB10:
DB byte 5 to DB byte 10.
P# Q 10.0 BOOL 4 Specifies 4 bits in the output area:
Q 10.0 to Q 10.3.
5|P ag e
2) FC2 DP_RECV
Definition of the Function Block:
Parameter Declaration Type Possible Remarks
Values
CPLADDR INPUT WORD Module base address
When you configure the CP with STEP 7
hardware configuration, the module start
address is displayed in the configuration table.
Specify this address here.
RECV INPUT ANY Specifies the address and length.
(as VARTYPE The address of the DP data area refers to
only BYTE, with - Process image area
FC1 V3 and - Bit memory
higher: - Data block area
BYTE The length must be set for
with FC1 up to - DP master: 1 to 240
V2.x: BYTE, - DP slave: 1 to 86
WORD and - DP master; only read status byte: 255
DWORD)
The following applies to new
modules (see CP manual):
- DP master: 1…2160
- DP slave: 1 to 240
- DP master; only read status byte: 1
NDR OUTPUT BOOL 0: - This parameter shows if new data were
1: new data accepted. Status code
accepted For the meaning of this parameter in conjunction
with the DONE and ERROR parameters, refer to
the following table 8-2.
ERROR OUTPUT BOOL 0: - Error code
1: error For the meaning of this parameter in conjunction
with the NDR and STATUS parameters, refer to
the following table 8-2.
STATUS OUTPUT WORD See following Status code
table For the meaning of this parameter in conjunction
with the NDR and ERROR parameters, refer to
the following table 8-2.
DPSTATUS OUTPUT Byte For coding, see DP status code
below under
DPSTATUS
(Table 8-3)
6|P ag e
Common error status information description:
DONE ERROR STATUS Meaning
0 0 8180 H Startup:
The DP service was started but data acceptance is not yet possible.
Normal operation:
Data acceptance active.
With newer CP types, the following meaning is possible (see
/2/):
DP has not been started due to CP STOP or “no parameter
assignment” (occurs here instead of code 0, 1, 8183H!).
1 0 0000 H New data accepted without error.
0 1 8183 H No configuration or the DP service has not yet started on the PROFIBUS CP.
0 1 8184 H System error or bad parameter type.
0 1 8F22 H Area length error reading a parameter (e.g. DB too short).
0 1 8F23 H Area length error writing a parameter (e.g. DB too short).
0 1 8F24 H Area error reading a parameter.
0 1 8F25 H Area error writing a parameter.
0 1 8F28 H Alignment error reading a parameter.
0 1 8F29 H Alignment error writing a parameter.
0 1 8F30 H Parameter is in the write-protected 1st act. data block.
nd
0 1 8F31 H Parameter is in the write-protected 2 act. data block.
0 1 8F32 H Parameter contains a DB number that is too high.
0 1 8F33 H DB number error.
0 1 8F3A H Destination area not loaded (DB).
0 1 8F42 H Timeout reading a parameter from the I/O area.
0 1 8F43 H Timeout writing a parameter to the I/O area.
0 1 8F44 H Address of the parameter to be read is disabled in the access track.
0 1 8F45 H Address of the parameter to be read is disabled in the access track.
0 1 8F7F H Internal error, e.g. illegal ANY reference.
0 1 8090 H No module with this address exists.
0 1 8091 H Logical base address not at a double word boundary.
0 1 80A0 H Negative acknowledgment writing to the module.
0 1 80B0 H The module does not recognize the data record.
0 1 80B1 H The specified data record length is incorrect.
Slave mode: the length of the destination area specified in the RECV
parameter is greater than the maximum length specified in the CP product
information bulletin / manual /2/.
Master mode: The length of the destination area specified in the RECV
parameter is greater than the length of the input data configured on the
PROFIBUS DP.
With newer CP types, the following applies to the DP
master and DP slave modes (see /2/):
The number of data to be received exceeds the upper limit
for this service.
0 1 80C0 H The data record cannot be read.
0 1 80C1 H The specified data record is currently being processed.
0 1 80C2 H There are too many jobs pending.
0 1 80C3 H Resources occupied (memory).
0 1 80C4 H Communication error (occurs temporarily, it is usually best to repeat the
job in the user program).
0 1 80D2 H Logical base address incorrect.
7|P ag e
Configuration on Siemens Slave
Siemens PROFIBUS DP communication interface setting
Assume we have opened SIMATIC Manager and “Getting Started” project. Open SIMATIC 300 Station folder, and double-
click hardware icon.
Figure 1-3
Select and Insert objects:
1) Insert S7-300 device
a. S7-300 Rail
b. Insert the objects into corresponding slots
c. Usually insert the S7-300 CPU into the second slot, please choose the correct CPU from the equipment
selection list.
Figure 1-4
2) Insert CP342-5 module
a. Usually insert CP342-5 into slot 4. (please refer STEP 7 manual)
b. Select insert equipment
c. Choose S7-300 station\CP 300\PROFIBUS\CP342-5\, and choose the corresponding protocol module and the
correct version.
d. Configure the DP communication interface parameter
e. Double-click CP342-5 slot, popup the interface parameter configuration dialog:
8|P ag e
Figure 1-5
Main configuration works:
Set the Interface communication basic parameter, In General table’s Interface area, select “Properties” button,
popup the below setting dialog:
Figure 1-6
Choose “Parameters” table, set Address, and choose “New” button, set communication network.
9|P ag e
Figure 1-7
Based on DP Master’s communication speed to set Transmission Rate. Select correct Subnet, usually we select to
use DP. Click “OK”, confirm and exit.
3) Set Interface Operating Mode
Select “Operating Mode” table as below, and then please select “DP slave” mode, choose “Test, commissioning,
routing”.
Figure 1-8
4) Programming of function block
Insert FC1 DP_SEND function block and make the connection to corresponding pins. Details please refer above the
communication schematic diagram and definition of function block.
10 | P a g e
Programming as below:
Figure 1-10
CPLADDR: function block connects with real physical hardware.
Choose “CPLADDR” pin, and then right-click mouse, select “Connection”, choose the corresponding physical
hardware in the popup dialog-box, click “OK”. Now the function block is connected with real physical hardware.
Figure 1-12
Figure 1-11
And then insert FC2 DP_RECV function block to repeat the same process, and finish the all STEP 7 programming
work.
11 | P a g e
Configuration on Freelance Control Builder F
1) Import .GSD file.
Figure 1-13
2) Import .GSD file for CP342-5 module, file name is “siem80d6.gsd”.
Figure 1-14
3) PROFIBUS slave can be seen in hardware structure of Control Builder F.
Figure 1-15
12 | P a g e
4) Check detail information of the slave version.
Figure 1-16
5) Basic communication parameter of slave can be found under “Definition” tab.
Bus address: configure the same address as in Siemens STEP 7 software (e.g. address: 6).
Watchdog Timeout: use Default value.
Figure 1-17
6) Insert PROFIBUS slave module.
Right click and insert as shown in screenshot.
13 | P a g e
Figure 1-18
IO selection can be found as below.
Figure 1-19
7) Insert IO components from the IO editor as shown.
Figure 1-20
14 | P a g e
8) Save as template
If there are more than one similar type of slave in same configuration, save it as a template as shown in the picture. In
this way, step 1 to 7 configuration can be skipped for additional PROFIBUS slaves. This will save time to do repeated
configuration in slave parameter.
Figure 1-21
Establishing communication
After the configuration steps are done, data can be sent from Freelance controller to Siemens controller via PROFIBUS.
Below diagram shows the function blocks configured in Siemens STEP 7 software.
In the picture Network 2: Send function block. P#Q 30.0 BYTE 16 will be sending data to Freelance.
In the picture Network 3: Receive function block. P#I 30.0 BYTE 16 will be receiving data from Freelance.
Refer to the description of Function blocks table from page 3 to 7 to understand detail of each of output function. (E.g.
DONE, ERROR, STATUS, END)
Figure 1-22
15 | P a g e