GS341_E.PDF

(106 KB) Pobierz
CP 341
SIMATIC
CP 341
Getting Started Guide
First Steps
153809038.001.png
This Guide uses a real-life example to take you through the four steps for setting up a fully functional
application that will enable you to transfer data via the serial interface and to familiarize yourself with
and test the basic hardware and software features of your CP 341. The cross-references tell you
where to find more detailed information on specific topics in the operating manual.
It will take you between one and two hours to work your way through the example, depending on your
prior experience.
Preconditions
These are the preconditions for this example:
STEP 7 (
V5.0) is correctly installed on your programming device.
You have configured a project for the S7-300 station.
The programming device is connected to the CPU.
You have a CP 341 module complete with the appropriate configuration package and connecting
cable.
You have prepared your connection partner for serial data transfer. If you are using a CP 341 with
RS232/V.24 interface, your programming device running the “Hyper Terminal” program can func-
tion as the connection partner. You will find “Hyper Terminal” in Windows under Start
"
Programs
"
Accessories
"
Hyper Terminal . The procedure for starting the program is described below.
Installing the Configuration Package on your Programming Device
The configuration package consists of a parameterization tool for the CP 341, a library containing
function blocks, and a demo program.
Start the installation program on the CD by double-clicking the file called SETUP.EXE.
Follow the instructions issued by the installation program.
Installing the CP 341, Connecting to the Communication Partner
Plug the bus connection supplied with the CP 341 into the CPU’s bus port. Hook the CP 341 over the
rail, lower the bottom edge into position and install the securing screws.
Connect your power supply’s L+ and M terminals to the corresponding terminals on the CP.
Use the connecting cable to interconnect the CP 341 and your connection partner. The pin assign-
ment of the interface adapter is detailed in Appendix B of the operating manual.
Test: Apply line voltage to the power supply module.
When the initialization phase completes, the SF LED on the CP 341 is on.
Parameterizing the CP 341
Open your project in SIMATIC Manager.
In your project, call up the HW Config configuration table.
In the hardware catalog, select the CP 341 with the correct order number and drag it to the appro-
priate slot.
Double-click the CP 341 to open the “Properties CP 341” form.
Note the module address under “Address” (in the demo this address is 256
"
100 hex). You will need
this value when you set up the link to your user program.
Click the Parameters button and select the “ASCII” protocol. Double-click the Envelope .
Click the OK button to accept the parameterization defaults: 9600 bit/s, 8 data bits, 1 stop bit, even
parity.
Select File
"
Save to save your parameterization settings and exit the form with File
"
Exit . In the
“Properties CP 341” form, click the OK button.
Save the configuration in your project by selecting Station
Save and Compile .
Transfer the configuration with the CPU in STOP by selecting PLC
"
Load to module .
The data are transferred directly to the CPU and the CP 341. The SF LED goes out to indicate that
loading was successful.
Select Station
"
"
Exit to close HW Config.
-2
You have an S7-300 station, consisting of power supply module and CPU.
153809038.002.png
Projects and double-click the
sub-project called “CP341Protocol 3964” (suitable for ASCII protocols, despite the name).
Open the S7 program of the CPU in this project. Double-clock the “Blocks” container.
Copy all the blocks except the system data from this container to your project under SIMATIC 300
Station
"
Open...
"
"
CPU3xx
"
S7 Program
"
Blocks .
FC21
FC with SEND
FC22
FC with RECEIVE
DB21, DB22
Instance DBs for the standard FBs
DB40, DB41
Work DBs for the standard FBs
DB42
The source DB for send
DB43
The destination DB for received data
OB1
Cyclic OB
OB100
Restart (warm start) OB
VAT1
Variables table
FB7, FB8
Standard FBs for RECEIVE, SEND
SFC 58, 59 SFCs for the standard FBs
In your project, double-click FC22 to open it and in the first line of Network 1, change the module ad-
dress ”LADDR” from “272” to “256”.
Save the blocks by selecting File
"
"
Exit .
In SIMATIC Manager, select SIMATIC 300 Station
"
CPU3xx
"
S7 Program
"
Blocks .
Load .
Switch the CPU to RUN. The CP 341 starts to send data cyclically via the serial interface (the “TxD”
LED flashes).
Data you send from your communication partner are received by the CP 341 in DB 43. The destina-
tion is entered in the “DB_NO” and “DBB_NO” parameters of FB7 (P_RCV_RK) in FC22.
"
-3
Linking to the User Program
The demo project “CP340_41” was installed in the \Siemens\STEP7\Examples catalog when you in-
stalled the configuration package.
In SIMATIC Manager, open this project by selecting File
Save .
No other changes have to be made to the FCs, so select File
Load all the S7 blocks to your CPU (CPU in STOP mode) with PLC
153809038.003.png
Test: Double-click VAT1 in the “Blocks” directory in your project to observe data transfer:
Go online by selecting PLC
"
Set up connection to
"
configured CPU .
Monitor .
The “DB42.DBW0” operand (send counter) indicates the number of transfers. The counterpart
counter for incoming data is “DB41.DBW18” (receive counter).
"
If you use your programming device as connection partner, you can receive data and send data to the
CP 341 using the “Hyper Terminal” program. Double-click the file called “Getting.ht” (in \Sie-
mens\STEP7\s7fptp\Terminal\....) to start “Hyper Terminal” with the appropriate settings. The data
sent by the CP 341 are displayed. Press a key on your keyboard to send the corresponding character
to the CP 341.
Diagnosis
Operator mistakes, incorrect wiring of the serial interface or parameterization conflicts can cause er-
rors.
Possible errors and the diagnosis messages are described in Section 8 of the operating manual.
Siemens AG
Bereich Automatisierungs- und Antriebstechnik
Geschaeftsgebiet Industrie-Automatisierungssysteme
Postfach 4848, D-90327 Nuernberg
Siemens AG 1999
Technical data subject to change
Siemens Aktiengesellschaft
C79000-Z7076-C341
Printed in the Fed. Rep. of Germany
-4
Go to observe mode by selecting Variable
153809038.004.png
Zgłoś jeśli naruszono regulamin