8/3/2019 Cpu313c Gs Zaehlen en Us
1/16
SIMATIC S7-300 Getting Started - Commissioning a CPU 31xC: Counting ______________
______________
______________
______________
Introduction 1Preparation 2Learning units 3Further Information 4
SIMATICS7-300Getting Started - Commissioning aCPU 31xC: CountingGetting Started
12/2006A5E00105536-02
8/3/2019 Cpu313c Gs Zaehlen en Us
2/16
Safety Guidelines
This manual contains notices you have to observe in order to ensure your personal safety, as well as to preventdamage to property. The notices referring to your personal safety are highlighted in the manual by a safety alertsymbol, notices referring only to property damage have no safety alert symbol. These notices shown below aregraded according to the degree of danger.
Dangerindicates that death or severe personal injury will result if proper precautions are not taken.Warningindicates that death or severe personal injury may result if proper precautions are not taken.Cautionwith a safety alert symbol, indicates that minor personal injury can result if proper precautions are not taken.
Cautionwithout a safety alert symbol, indicates that property damage can result if proper precautions are not taken.
Noticeindicates that an unintended result or situation can occur if the corresponding information is not taken intoaccount.
If more than one degree of danger is present, the warning notice representing the highest degree of danger willbe used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating toproperty damage.
Qualified PersonnelThe device/system may only be set up and used in conjunction with this documentation. Commissioning andoperation of a device/system may only be performed by qualified personnel. Within the context of the safety notesin this documentation qualified persons are defined as persons who are authorized to commission, ground andlabel devices, systems and circuits in accordance with established safety practices and standards.
Prescribed UsageNote the following:
WarningThis device may only be used for the applications described in the catalog or the technical description and only inconnection with devices or components from other manufacturers which have been approved or recommended bySiemens. Correct, reliable operation of the product requires proper transport, storage, positioning and assemblyas well as careful operation and maintenance.
TrademarksAll names identified by are registered trademarks of the Siemens AG. The remaining trademarks in thispublication may be trademarks whose use by third parties for their own purposes could violate the rights of the
owner.
Disclaimer of LiabilityWe have reviewed the contents of this publication to ensure consistency with the hardware and softwaredescribed. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, theinformation in this publication is reviewed regularly and any necessary corrections are included in subsequenteditions.
Siemens AG
Automation and DrivesPostfach 48 4890437 NRNBERGGERMANY
Order No.: A5E00105536-02
01/2007
Copyright Siemens AG 2006.
Technical data subject to change
8/3/2019 Cpu313c Gs Zaehlen en Us
3/16
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 iii
Table of contents1 Introduction............................................................................................................................................. 1-12 Preparation............................................................................................................................................. 2-13 Learning units ......................................................................................................................................... 3-1
3.1 1. Step: Wiring the power supply and CPU ............................................................................... 3-1
3.2 2. Step: Installing the sample project......................................................................................... 3-3
3.3 3. Step: Setting parameters ....................................................................................................... 3-43.4 4. Step: Linking to the user program.......................................................................................... 3-5
3.5 5. Step: Trial run ........................................................................................................................ 3-6
4 Further Information......................................................................................................... ........................ 4-14.1 Further Information .................................................................................................................... 4-1
8/3/2019 Cpu313c Gs Zaehlen en Us
4/16
Table of contents
Getting Started - Commissioning a CPU 31xC: Countingiv Getting Started, 12/2006, A5E00105536-02
8/3/2019 Cpu313c Gs Zaehlen en Us
5/16
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 1-1
Introduction 1Contents of this Getting Started Manual
The sample in this Getting Started manual takes you through five steps, showing you how tocommission a fully functional counter application. You are going to familiarize yourself withthe basic hardware and software functions and learn how to operate the counting function.
The references to the manual will also help you to get a general overview of the information
it contains. Additional notes relating to the frequency-measurement and pulse-width-modulation applications are found on the sample project CD.
This process will take 1 to 2 hours, depending on your experience.
8/3/2019 Cpu313c Gs Zaehlen en Us
6/16
Introduction
Getting Started - Commissioning a CPU 31xC: Counting1-2 Getting Started, 12/2006, A5E00105536-02
8/3/2019 Cpu313c Gs Zaehlen en Us
7/16
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 2-1
Preparation 2Scope
This guide applies to the following CPUs:
As of versionPU Order no. SIMATIC Micro MemoryCard required for operation? Firmware312C 6ES7 312-5BE03-0AB0 Yes V2.0.12313C 6ES7 313-5BF03-0AB0 Yes V2.0.12
313C-2 PtP 6ES7 313-6BF03-0AB0 Yes V2.0.12
313C-2 DP 6ES7 313-6CF03-0AB0 Yes V2.0.12
314C-2 PtP 6ES7 314-6BG03-0AB0 Yes V2.0.12
314C-2 DP 6ES7 314-6CG03-0AB0 Yes V2.0.12
Prerequisites You have an S7-300 station comprising a power supply module and a CPU 31xC. STEP 7 as of V5.2 + SP 2 is correctly installed on your PG. You have the CD with the sample projects or you have downloaded the sample projects
from the Internet.
You have set up a project for the S7-300 station. The PG is connected to the CPU. You are set up with all the required accessories, e.g., front connector and wiring material. The CPU is correctly connected to a power supply.
WarningOperation of an S7-300 in plants or systems is defined by special set of rules andregulations, based on the relevant field of application. Please observe the current safetyregulations for the prevention of accidents, for example IEC 204 (EMERGENCY-OFFequipment).
Non-compliance with these regulations can result in serious injury and damage to bothmachinery and equipment.
8/3/2019 Cpu313c Gs Zaehlen en Us
8/16
Preparation
Getting Started - Commissioning a CPU 31xC: Counting
2-2 Getting Started, 12/2006, A5E00105536-02
Layout of the example1 2 3 4
5678
(1) For setting the line voltage
(2) Mode selector(3) Mounting rail
(4) Programming device with STEP 7 software(5) PG cable
(6) Connecting cable
(7) Clamp for strain relief
(8) Power supply ON/OFF
8/3/2019 Cpu313c Gs Zaehlen en Us
9/16
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 3-1
Learning units 33.1 1. Step: Wiring the power supply and CPU
WarningYou can come into contact with live wires if the PS 307 power supply module is turned on orthe power supply cable to the PS is connected to the main power supply. Perform any wiringwork on the S7-300 only when the power is off!
Procedure1. Fit the front connector to the CPU and tighten the securing screws.2. Wire the connections for the "Count 1 First Steps" sample project as follows:
Connector pin assignmentThe pin assignments described below relate only to the connectors relevant for thepositioning type.
CPU 312Cconnection: X1 Name/address Sample function2 DI+0.0 Pulse input
3 DI+0.1 Direction bit
4 DI+0.2 Hardware gate
8 DI+0.6 Latch input
12 2 M Reference potential of the supply voltage
13 1 L+ 24 V DC supply voltage
16 DO+0.2 Simulation: Pulse input -> connect to DI+0.0
17 DO+0.3 Simulation: Direction bit -> connect to DI+0.1
18 DO+0.4 Simulation: Hardware gate -> connect to DI+0.2
19 DO+0.5 Simulation: Latch input -> connect to DI+0.6
20 1 M Reference potential of the supply voltage
8/3/2019 Cpu313c Gs Zaehlen en Us
10/16
Learning units
3.1 1. Step: Wiring the power supply and CPU
Getting Started - Commissioning a CPU 31xC: Counting3-2 Getting Started, 12/2006, A5E00105536-02
PinCPU 313C-2 DP/PtP: X1CPU 313C, 314C-2DP/PtP: X2
Name/address Function
1 1 L+ 24 V power supply of the inputs
2 DI+0.0 Pulse input
3 DI+0.1 Direction bit
4 DI+0.2 Hardware gate
16 DI+1.4 Latch input
20 1 M Reference potential of the supply voltage
21 2 L+ 24 V power supply of the outputs
24 DO+0.2 Simulation: Pulse input -> connect to DI+0.0
25 DO+0.3 Simulation: Direction bit -> connect to DI+0.1
26 DO+0.4 Simulation: Hardware gate -> connect to DI+0.227 DO+0.5 Simulation: Latch input -> connect to DI+1.4
30 2 M Reference potential of the supply voltage
The figure shows, as an example, the CPU 314C with a standard plug arrangement forCPUs with two connectors (X1 and X2).
STOP
MRES
RUN
L+ M
ReferenceYou will find information on the remaining connectors in the documentation of the S7-300.
8/3/2019 Cpu313c Gs Zaehlen en Us
11/16
Learning units
3.2 2. Step: Installing the sample project
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 3-3
3.2 2. Step: Installing the sample projectIntroduction
When installing the sample project, you have the following options:
Installing from CD1. Start the installation program on the CD by double-clicking on the SETUP.EXE file in the
SETUP folder.
The installation program is started.
2. Now follow the instructions in the installation program.
Installing from the Internet1. Open the directory with the sample projects and start the installation program by double-
clicking on the SETUP.EXE file.
The installation program is started.
2. Now follow the instructions in the installation program.
8/3/2019 Cpu313c Gs Zaehlen en Us
12/16
Learning units
3.3 3 . Step: Setting parameters
Getting Started - Commissioning a CPU 31xC: Counting3-4 Getting Started, 12/2006, A5E00105536-02
3.3 3. Step: Setting parametersProcedure
1. Open your project in SIMATIC Manager.A window, divided into two parts, opens with the title of your project.
2. In your project, call the configuration table HW Config.
3. Double-click on the submodule "Counting".The "Counting properties" dialog opens.
4. Select channel 0 and "Infinite count" mode. Make the following settings in the parameterassignment screen forms (do not modify any other settings, as they are not required forcommissioning):
Input: Hardware gate Output reaction: Counter value Comparison value
5. Confirm your settings with "OK".The "Counting properties" dialog closes.
6. Save your configuration to your project with "Station > Save and compile".Your changes are now stored in your project.
7. When the CPU is in STOP, select "PLC > Load to module..." to download theconfiguration.
The data are now downloaded from the PG to the CPU.
8. Close HW Config with "Station > Close".You are returned to SIMATIC Manager.
8/3/2019 Cpu313c Gs Zaehlen en Us
13/16
Learning units
3.4 4. Step: Linking to the user program
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 3-5
3.4 4. Step: Linking to the user programProcedure
1. Open the project "ZEn26_02_TF_____31xC_Cnt" in the catalog\Siemens\STEP7\Examples via "File > Open... > Sample projects" in SIMATIC Manager.
A two-part window opens showing the title of the project.
2. Double-click on the S7 program "Count 1 First Steps".In the right-hand window, you can see the "Sources", "Blocks" and "Symbols" folders.
3. Double-click on the "Blocks" container.This displays all the blocks of the S7 program.
4. Copy all the blocks from this folder to your project in "SIMATIC 300 Station > CPU3xx >S7 Program > Blocks".
Chip Name (in the toolbar) DescriptionOB1 CYCLE_EXC Cyclic program
FB11 GETST_C Example 1: COUNT, first steps
DB11 DI_GETST_C Instance DB for GETST_C
SFB47 COUNT SFB COUNT
DB16 DI_COUNT Instance DB for SFB COUNT
VAT VAT_GETST_C Variable table
1. Copy the symbol table to your project in "SIMATIC 300 Station > CPU3xx > S7 Program".The symbol table is stored in your project.
2. In SIMATIC Manager, select "SIMATIC 300 Station > CPU3xx > S7 Program > Functionblocks".
This displays all the blocks of the S7 program.
3. Download all of the S7 blocks it contains to your CPU via "PLC > Download" (CPU inSTOP mode).
The program and configuration are downloaded from the PG to the CPU.
8/3/2019 Cpu313c Gs Zaehlen en Us
14/16
Learning units
3.5 5 . Step: Trial run
Getting Started - Commissioning a CPU 31xC: Counting3-6 Getting Started, 12/2006, A5E00105536-02
3.5 5. Step: Trial runProcedure
1. In the "Function blocks" directory, double-click on the variable table "VAT_GETST_C" inyour project.
The variable table for monitoring and modifying is displayed.
2. Go online with "PLC > Connect to > Configured CPU".At the bottom right, you will see that the CPU is set to "Stop" mode.
3. Activate monitoring with "Variable > Monitor".The current values of the addresses are displayed in the "Status Value" column.
4. Switch the CPU to RUN.At the bottom right, you will see that the CPU is set to "RUN" mode.
5. In the variable S_IMP_H of the VAT, select the count pulse source: S_IMP_H = 0:
The pulse source is a programmed SW clock generator. Its frequency is adjustable viathe T_PULSE variable. The clock is connected to the pulse input via a digital output.
S_IMP_H = 1:Specify the count pulses by manually setting and resetting the S_IMP_T variable in theVAT.
6. You can perform the following tests:Starting/stopping the counter: Start the counter by setting the variables
SW_GATE (SFB parameter SW gate) andS_HWT (simulation of HW gate) in the VAT to1 (logical AND).
Stop the counter by resetting S_HWT orSW_GATE to zero.
You can monitor the actual counter value at theSFB output parameter COUNTVAL. You canview the status of the SW or HW gate in thevariables STS_GATE or STS_STRT.
Loading a count value to the counter: JOB_ID = 01 hex ("Write counter directly") JOB_VAL = Count value (-231 to +231-1) JOB_REQ = 1,
Job initiates at the positive edge
You can view the loaded count value at the SFBoutput parameter COUNTVAL. If no load errorhas occurred, the status at the output
parameters is JOB_DONE = 1 and JOB_ERROR= 0.
8/3/2019 Cpu313c Gs Zaehlen en Us
15/16
Getting Started - Commissioning a CPU 31xC: CountingGetting Started, 12/2006, A5E00105536-02 4-1
Further Information 44.1 Further InformationDiagnostics/Correction of Errors
Incorrect operator input, faulty wiring or inconsistent configuration data may lead to errors.
For information on how to analyze such errors and messages, refer to the S7-300documentation.
Example:The "ZEn26_02_TF_____31xC_Cnt" project contains further samples you can use fororientation. You can customize all samples according to your personal applications.
8/3/2019 Cpu313c Gs Zaehlen en Us
16/16
Further Information
4.1 Further Information
Getting Started - Commissioning a CPU 31xC: Counting4-2 Getting Started, 12/2006, A5E00105536-02