Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the...

10
Manual of a Demo Project which demonstrates the Unsolicited Data Transfer between S7-PLC and S7A Driver in S7A version 7.50 Build 102 Author: Jürgen Stähler Version 0.91 (draft) Date: 18.03.2013

Transcript of Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the...

Page 1: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Manual

of a

Demo Project

which demonstrates the

Unsolicited Data Transfer

between S7-PLC and S7A Driver

in

S7A version 7.50 Build 102

Author: Jürgen StählerVersion 0.91 (draft)Date: 18.03.2013

Page 2: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 2

1. Configuration of a S7 connection in Step7 NetPro:

Step 1:Open NetPro, select the CPU, open the context menu and select Insert new Connection.

Step 2:Select Unspecified for the Partner station and S7 connection as Connection type.

Page 3: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 3

Step 3:Uncheck „Establish an active connection“ and enter the IP address of the PC on which theS7A driver is running. Click Button Address Details....

Step 4:Select the next unused Local Connencion Resource. Set the Partner Rack/Slot to 0/0and select 10 for the Partner Connection Resource.

Page 4: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 4

Step5: Save, compile and download the Netzwork Configuration to the PLC CPU.

Page 5: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 5

2. Required configuration in the S7A Power Tool

Step 1:Add a new S7A channel with communication way S7 TCP/IP. From the Conn. Typecombo box select Projected

Page 6: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 6

.Step 2:Add a new Device. Set Rack and Slot to the same values as shown in the NetProAddress Details for the Local Partner. Enter as decimal value!! The Conn. resource asselected for the NetPro Local Partner Connection resource. Check the Receive unsolicited check box.

Page 7: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 7

Step 3:Add three data blocks with the Starting Addresses “100.0", “101.0" and “102.0" eachwith a No. Of Elements “600". The Primary Rate has to be set to “Disabled” and theAllow unsolicited check box has to be checked.

Now the driver is ready to receive unsolicited data for these three data blocks. It ispossible to add further data blocks to this device which have to be polled.

Page 8: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 8

3. The PLC Program

The following picture shows the program and data block structure of the Step7 demoproject for unsolicited data transfer.

Note: This demo runs on any S7-300 CPU as well as on the ET200S-CPUs. For S7-400CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced bySFB12 (BSEND) and SFB13 (BRCV)!

Page 9: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 9

3.1 Function Blocks

3.1.1 FB 4 (S7A_UNSOL_SEND)

This FB transfers a data block area addresses by its input parameter SOURCE to the S7Adriver. It use the function block BSEND (FB12) to send the data to the S7A driver and ituse the function block BRCV (FB13) to receive the confirmation from the S7A driver.

Parameters of FB 4

Name Declaration Type Description

INIT

Input

Bool Initialize/Reset the function block.

BUFFER_DB Input Block_DB The number of the data block which is

used as send buffer for BSEND and

receive buffer for BREC. This DB should

have a size of 1033 bytes.

SOURCE

Input ANY Any pointer to the data area which has

to be transfered. The current version of

the S7A driver only support area type

“DB”. The maximum size of the data

area defined by this pointer is 1024

bytes.

Example: P#DB101.DBX0.0 BYTE 600

Area: DB (Data block)

Starting address: DB101.DBX0.0

Data type: BYTE

Number of elements of the specified

type: 600

TRIGGER Input Bool The rising edge of this signal starts the

data transfer to the S7A driver

ID Input W ord The ID of the S7 connection which is

used for the BSEND and BRCV function

block.

R_ID Input DW ord Address parameter R_ID is responsible

for sub-addressing within an S7

connection.

Thsi parameter is currently not used and

has to be est to DW #16#0

RTC Output W ord The parameter RTC indicates an

occured error. RTC = 0 means no error.

LAST_TICKET* InOut DW ord Is the last(highest) ticket number issued.

This parameter is incremented within

the FB when a data transfer request is

finished.

CURRENT_

TICKET

InOut Dword Is the current ticket number in-process.

* The parameter pair LAST_TICKET and CURRENT_TICKET is used to synchronize multiple

instances of this FB when they are using the same S7 connection.

Page 10: Manual - Incosolincosol.de/WP_Downloads/Demo_Project_S7A_Unsolicited.pdf · For S7-400 CPUs the function blocks FB12 (BSEND) and FB13 (BRCV) have to be replaced by SFB12 (BSEND) and

Demo Project - Unsolicited Data Transfer

between S7PLC and S7A Driver Page 10

3.1.2 FB5 (S7A_UNSOL_SEND_CONTAINER)

This FB is used to group multiple instances of the FB4 which are using the sameS7 connection to transfer data.

Parameters of FB 5

Name Declaration Type Description

INIT Input Bool This signal is forwarded to all instances

of FB 4.

Initialize/Reset the function block.

TRIGGER Input Bool This signal is forwarded to all instances

of FB 4.

The rising edge of this signal starts the

data transfer to the S7A driver.

RTC Output W ord This signal is forwarded to all instances

of FB 4.

The parameter RTC indicates an

occured error. RTC = 0 means no error.

LAST_TICKET* InOut DW ord This signal is forwarded to all instances

of FB 4. It can be assigned to a flag

DW ord (e.g. MD100) or a data block

Dword (e.g. DB2.DBD0)

CURRENT_

TICKET

InOut Dword This signal is forwarded to all instances

of FB 4. It can be assigned to a flag

DW ord (e.g. MD100) or a data block

Dword (e.g. DB2.DBD0)

* The parameter pair LAST_TICKET and CURRENT_TICKET is used to synchronize multiple

instances of this FB when they are using the same S7 connection.

3.2 Data Blocks

3.2.1 DB 1

Is the buffer data block which is used in BSEND (FB12) and BRCV (FB13) to send the data to the

S7A driver and receive the confirmation.from the S7A driver. It’s size is 1031 bytes (7 bytes header

+ 1024 bytes user data).

3.2.2 DB 5

Is the instance data block of the function block FB5. It contains all statically declared data of all

instances of the FB5 function block.

3.2.3 DB 12

Is the instance data block of the function block FB12 (BSEND).

3.2.4 DB 13

Is the instance data block of the function block FB13 (BRCV).

3.2.5 DB100 - DB102

Are data blocks for user data. These three blocks will be (partly) send by the three instances of FB

4 witin the container FB 5.