You are on page 1of 1

 Internet  Register  Log in

Industry Online Support


Product Support

 Industry Online Support International  Language  Contact  Help  Support Request  Site Explorer Search in Online Support 

 Home  Product Support Product Support Services Forum mySupport

Entry type: FAQ Entry ID: 27864874, Entry date: 03/16/2009


     (18) 
 Rate

How do you determine the frequency of a pulse sequence and speeds? Share this Page: 
Entry Associated product(s)
mySupport Cockpit

 Add to mySupport favorites


Description:  Add to mySupport documentation
The S7-200 provides the option of counting pulse trains using high-speed counters. Using the attached "Frequency" library, the frequency of the pulse train  Favorites
is calculated from the counter signal, from which the speed of stepper motors, for example, can be determined after relevant conversion.
 My requests
Overview:  CAx downloads
The task is split into the following 3 steps.  My Products / Clipboard
1. Define a high-speed counter to capture the pulse train frequency
2. Create the program code
3. Convert the frequency determined into a speed
Product information
1. Define a fast counter to capture the pulse train frequency
First, using the STEP 7 Micro/WIN Instruction Wizard you must generate a high-speed counter that counts the external pulses.
Presales info
Table 01 shows which high-speed counters the S7-200 provides, which inputs these use and the maximum measurable frequency. Catalog and ordering system online
Technical info
High-speed counters Clock input Max. input frequency CPUs
Support
HC0 E0.0 30 kHz 221, 222, 224, 224XP, 224XPsi, 226
Service offer
©HC1
Siemens AG 2009-2020 - Imprint E0.6 policy
Privacy 30policy
Cookie kHz Terms of use 221, 222, 224, 224XP, 224XPsi, 226
Digital ID 0.0.0.0
Training
HC2 E1.2 30 kHz 221, 222, 224, 224XP, 224XPsi, 226
Contact & partners
HC3 E0.1 30 kHz 221, 222, 224, 224XP, 224XPsi, 226

HC4 E0.3 200 kHz 224XP, 224XPsi


HC5 E0.4 200 kHz 224XP, 224XPsi Related links
Table 01
 Compatibility Tool
Procedure:  Register your SINAMICS Drive
 Visit our Converting Community
 Get help with the Digital Assistant
No. Description  How to use the chatbot
1 Open the Instruction Wizard via the "Tools" menu in STEP 7 Micro/WIN.

Fig. 01
2 There you select the high-speed counter "HSC" from the configuration catalog.
Then click on "Next >".

Fig. 02
3 Leave the mode set to "0" for single-phase up/down counting and select a counter (e.g. "HC4").

Fig. 03
Note:
Please refer to Table 01 for selecting the high-speed counter.
4 Leave the settings for the subprograms, counter presettings, counter value and counting direction.
Click on "Next".

Fig. 04
5 In the next window, also leave the presetting,
and do not set a check mark for "Interrupt on Current Value equal Preset Value (CV = PV)".

Fig. 05
6 Close the Instructions Wizard with the "Finish" button.

Fig. 06
Table 02

2. Create the program code

No. Description
1 In network 1 of the operation block use the initialization bit SM0.1 to call the initialization block generated by the Instructions Wizard for the high-speed
counter.

Fig. 07
2 In network 2 you cyclically call (SM0.0) the "Frequency" block from the library with the same name in the list.

Fig. 08
Enable the function via the connection of the "Active" input (when disabled, the "Hz" parameter outputs the value "0").
Address the "Counter" with the counter selected with the Instructions Wizard.
Address the IN-OUT parameter "Hz" with a free double-word (Format: REAL) for displaying the frequency measured in Hertz.
The "Trigger" output provides a pulse signal for optional recording of the frequency characteristic via the Data Log function (see Step 5).
3 The "Frequency" library needs 16 bytes in the global variable memory. For this you specify an address via "File" -> "Library Memory Allocation...".

Fig. 09
4 Via the "Symbol Table" view you get to symbolic addressing of the "Frequency" library. The "Time_interval" symbol defines the measuring interval in
seconds for the frequency calculation. The default setting is an interval time of 1 second, but you can change this.

Fig. 10
5 As an option, in network 3 of the sample project "Frequency", the Data Log function is incorporated for capturing the frequency time on a memory
module. Via the AND operation of the "Active" and "Trigger" signals, when you activate the "Frequency" block, each frequency is recorded at the
intervals of the "Time_interval" set.

Fig. 11
Note:
The Data Log function is executed via the Data Log Wizard and the values recorded can be read out via the S7-200 Explorer.
More information on the Data Log function is available in the SIMATIC S7-200 Video Tutorial (Entry ID:  30839030 ).
Table 03

3. Convert the frequency determined into a speed


Apply the following formula to obtain a speed:

n = 60 * f / p
-1
n = Speed in minutes
f = Frequency in Hz
p = Number of pulses required for one motor revolution

Download:
The download "frequency.zip" contains the following files:

File Description
"frequency.mwl" library - contains the "Frequency" block (see Table 03, Step 2)
"frequency.mwp" project - sample project for this FAQ
"tspeed01.mwp" project - alternative implementation of this task via a cycle-independent time interrupt (setting range: 1 to 255 ms

Frequency.zip ( 11 KB )

Note:
Information on inserting libraries in STEP 7 Micro/WIN is available in Entry ID:  16689345

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and
continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a
concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.

Also available in the following languages:


 German
 French
 Italian
 Spanish
 Chinese

Entry belongs to product tree folder(s):


 Automation Technology  Automation Systems  Industrial Automation Systems SIMATIC  PLC  Basic Controller  S7-200  CPUs

 Automation Technology  Automation Systems  Industrial Automation Systems SIMATIC  Software for SIMATIC Controller  STEP 7 V5.x
 STEP7 basic software and editors  STEP 7 - Micro / WIN
 Automation Technology  Automation Systems  Industrial Automation Systems SIMATIC  Software for SIMATIC Controller  STEP 7 V5.x
 Options for programming and design  SIMATIC MicroComputing

Rate entry

     no rating Submit rating

Requests and feedback

What do you want to do?

You have a technical question / problem: Ask the Technical Support


 Create support request

You want to discuss in our forum and exchange experiences with other users
 Go to the Forum

You want to create CAx data for one or more products


 Go to the CAx download manager

You would like to send us feedback on this Entry


 Provide feedback

You might also like