Escolar Documentos
Profissional Documentos
Cultura Documentos
SIMATIC PCS 7
Note The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The Application
Examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for ensuring that
the described products are used correctly. These application examples do not
relieve you of the responsibility to use safe practices in application, installation,
operation and maintenance. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these
application examples and other Siemens publications e.g. Catalogs the
contents of the other documents have priority.
We do not accept any liability for the information contained in this document.
Any claims against us based on whatever legal reason resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
Siemens AG 2013 All rights reserved
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(wesentliche Vertragspflichten). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Copyright
Caution
The functions and solutions described in this article confine themselves to the
realization of the automation task predominantly. Please take into account
furthermore that corresponding protective measures have to be taken up in the
context of Industrial Security when connecting your equipment to other parts of the
plant, the enterprise network or the Internet. Further information can be found
under the item ID 50203404.
http://support.automation.siemens.com/WW/view/en/50203404
Table of contents
Warranty and liability ............................................................................................... 2
1 Task................................................................................................................. 4
1.1 Task .................................................................................................. 4
1.2 Solution ............................................................................................. 5
1.3 Hardware and software components .................................................. 6
1.3.1 Validity .............................................................................................. 6
1.3.2 Components used ............................................................................. 6
2 Basic principles of the counter module ........................................................ 8
2.1 Hardware information ........................................................................ 8
2.2 "Pcs7Cnt1" driver block ..................................................................... 9
2.3 Gate function of the counter channels Activating, interrupting
and canceling a channel .................................................................. 10
2.3.1 Overview ......................................................................................... 10
2.3.2 Interrupting and canceling a counting mode ..................................... 11
2.3.3 Interrupting a measuring mode ........................................................ 12
2.4 Counting rages of the module channels ........................................... 13
2.5 Operating modes for the channels ................................................... 14
2.5.1 Introduction to counting.................................................................... 14
2.5.2 Continuous counting ........................................................................ 15
2.5.3 Single Counting ............................................................................... 16
Siemens AG 2013 All rights reserved
1 Task
1.1 Task
Every automated system involves counting, dosing, or measuring. Sensors and
actuators supply signals that are read and evaluated by an automation
system (AS).
Every CPU can load inputs and outputs into the internal memory when an
operation block (OB) is called. This internal memory is named process image.
When an OB is started, the process image output (PIQ) is outputted and the
process image input (PII) is updated before the processing of the code is starting.
The other way is to read the signals via the address range of the peripherals.
In this case, the module data is loaded and processed when the block or a function
is called. Just as with the inputs, the outputs can also be directly written via the
peripherals.
The advantage of peripheral addresses is that changes can also be processed
after the process image has been read.
Figure 11 shows the execution of an OB. It illustrates the writing of the outputs
(PIQ) and reading of the inputs into the PII at the start of the cycle. After this the
program code is edited for example by a function block (FB).
Siemens AG 2013 All rights reserved
If an input signal changes during program processing, this change is not applied
to the process image. For the called FB (Figure 11), this means that the block is
processed using the values from the process image.
If you use a peripheral address for the input, the input is read by the call of the FB,
and the function block will have the current value.
In tasks with very frequently edges, it is possible the edges get lost as a result of
an exceedingly long OB processing time.
In the case that a positive and a negative edge occurs during processing, this
fluctuation is very difficult to record even when using peripheral inputs. The AS has
to read the input whenever the signal changes.
The following figure illustrates how a changing input signal provides the same
measurement result every time the input is read.
1.2 Solution
One possibility for the measurement of signals is the use of the SIMATIC FM 350-2
counter module. With its integration you can realize the following tasks for process
automation:
Siemens AG 2013 All rights reserved
Delimitation
The following components of the FM 350-2 counter module and the accompanying
driver are not covered in this application:
Dosing counter
Triggering hardware interrupts
Rotary encoder
Substitute values
Hardware components
Table 11: Hardware components used
Component No. Order no. Note
FM 350-2 1 6ES7 350-2AH00-0AE0 Alternatively, newer versions
of the module can be used.
CPU 417-4 H with 1 6ES7 417-4HT14-0AB0 The CPU was not used
CP 443-1 6GK7 443-1EX20-0XE0 redundantly, but rather as an
individual automation station
for the test environment.
ET 200M 1 6ES7 153-2BA01-0XB0 Test environment component
Software components
Table 12: Software components used
Component No. Order no. Note
SIMATIC PCS 7 1 6ES7658-5AX08-0YA5 V8.0 SP1
V8.0
FM Configuration 1 - The configuration interface is
Package supplied with the counter
module or can be found in the
following entry:
http://support.automation.si
emens.com/WW/view/en/6
0237759
Siemens AG 2013 All rights reserved
Copyright
Note Further information about the FM 350-2 counter module can be found in the
"S7-300 Counter Module FM 350-2" manual.
The link to the entry in the Industry Online Support is as follows:
http://support.automation.siemens.com/WW/view/en/1105178
The inputs for direction, hardware gate and output are optional and do not need to
be connected.
Counter channel
data connection
Feedback for
Software gate module channel
state
Load value
Comparison value
Output measured
value
Connection
to upstream
diagnostic block
Copyright
NOTICE If you do not assign the Connect input, the compiler of the CFC editor generates
an error.
In order to compile and load your project, you must assign this input.
The configuration instructions for this can be found in chapter 3.5.
In order to activate the function of a counter module channel, the internal gate must
be set. The internal gate consists of a software gate and a hardware gate that are
connected by a logical AND. The software gate is an interface of the "Pcs7Cnt1"
driver block, and the hardware gate is a digital input on the module.
The hardware gate is deactivated in the basic setting and can be separately
activated for each channel in the hardware configuration.
The software gate does not have a deactivation function similar to the one
available for the hardware gate.
Figure 23: Digital logic with function table for the gate function
Siemens AG 2013 All rights reserved
Copyright
Note The configuration instructions for activating the hardware gate can be found in
chapter 3.6.4.
The operating modes for counting are: continuous, single and periodic counting.
These modes are active as long as the internal gate setting is TRUE. By default,
the counting modes are canceled when the internal gate is set to FALSE.
When the gate is set to FALSE, the function of the channel is canceled by default.
Canceled means that the value currently being counted is overwritten by the start
value when the channel is re-activated. The default start value is 0.
It is possible to set the properties to interrupt instead of cancel in the configuration
interface. This only applies to the counting functions.
If the setting is configured to interrupt, then counting will continue from the existing
value in the counter when a reactivation occurs.
Table 21: Overview of counter behavior when the internal gate is set and the hardware
gate has not been activated in the configuration.
Configuration SW gate Internal Behavior
gate
The start value is loaded. Counting begins
Canceling
Set to from this value.
Siemens AG 2013 All rights reserved
TRUE
Interrupting Counting continues from the current count.
= positive edge
If you wish to also use the hardware gate, there is an anomaly in the canceling
behavior of the counter channel. Here, the current count is only overwritten
if a positive edge causes the internal gate to be set at the hardware gate.
Copyright
Table 22: Overview of counter behavior when the internal gate is set. The hardware gate
has been activated in the configuration.
Configuration SW gate HW gate Internal Behavior
gate
Counting continues from
1 the current count.
Canceling
The start value is loaded.
1 Counting begins from this value.
Set to
TRUE
1
Counting continues from
Interrupting
the current count.
1
- positive edge
The operating modes for measuring are: frequency, rotational speed and time
period measurement.
A measurement is activated as long as the internal gate is active. When the
internal gate is set to FALSE, the channel is deactivated. The driver block's
measurement output provides the old measured value until the next activation
of the channel.
Here, the selection of interrupt or cancel is not possible.
Note In the first measuring cycle, the measured value output is "-1". The reason for
this feature is so that the first measuring cycle can be differentiated from the real
system values that are either "0" or greater.
Siemens AG 2013 All rights reserved
Copyright
Note The instructions for the configuration can be found in chapter 3.6.9
In the default setting, all four channels are assigned to a WORD data area.
It is possible to combine two channels that have a WORD data format in one
DWORD channel. This configuration option is available for channels 0 and 2.
For example, if you assign channel 0 to a DWORD data area, you can no longer
use channel 1. The reason for this is that channel 0 blocks the process image data
area that was reserved for channel 1. The same thing applies to channel 2 with
respect to channel 3.
Channels 4-7
Channels 4-7 are read via the peripheral input words and counted in the DWORD
area.
Here, configurations of the counter range similar to those for channels 0-3 are not
possible.
In the sections below, the following counting functions are explained in greater
detail:
Continuous counting
Single count
Periodic counting
Each time a positive edge is registered by the counter module, the module
increases the value by a count of one. If the count direction "down" is selected,
it decreases the value by one.
Below you can see a diagram with the input signal and the counter reading.
This is an example intended to illustrate that irregular signals can also be present.
In the following chapters, the count will be portrayed using regular signals.
Figure 24: Behavior of the counter reading in relation to the input signal
Siemens AG 2013 All rights reserved
Copyright
In this mode, the FM 350-2 counter module counts continuously starting at the
current counter reading. The default start value is 0. The start value can be
changed by loading a value.
If the counter reaches the high count limit when counting up and another count
pulse is received, it jumps to the low count limit and continues to count from
there without any pulse losses.
If the counter reaches the low count limit and another count pulse is received,
it jumps to the high count limit and continues to count from there without any
pulse losses.
In this mode, the counter module performs the following counts once when the
internal gate is activated:
Between 0 and the assigned end value in the main count direction "up."
Between the assigned start value and 0 in the main count direction "down."
Once the count process has been completed, it is only repeated when the internal
gate is set again.
Figure 26: Time diagram for single counting, backward and forward
Siemens AG 2013 All rights reserved
Copyright
In this mode, the FM 350-2 counter module counts the pulses received within
a predetermined time window. This is then used to calculate the frequency.
It is important to note that the calculated value is only available and able to be
output after the first measuring cycle. During the first time window, the output is -1.
The reason for this feature is so that the first measuring cycle can be differentiated
from the real system values that are either "0" or greater.
The measured value is output in mHz at the driver block.
In this mode, the counter module measures the exact time between two positive
edges of the count signal by counting pulses of an internal reference frequency
(1 MHz) with quartz accuracy. The measured value is only written to the output
after the assigned time in the second cycle of the time window.
The driver block outputs the measured value in ms.
3 Configuration
3.1 Requirements for configuring the counter module
Overview
In order to configure the FM 350-2 counter module in the SIMATIC Manager, you
must install a configuration package. This package is provided with the counter
module and can be downloaded from the Industry Online Support Portal.
The link to the entry in the Industry Online Support Portal is as follows:
http://support.automation.siemens.com/WW/view/en/1105178.
Close the dialog window for the file extraction by clicking on the "Close" button.
6. Select the setup language and then click the "Next >" button.
Figure 3-5
Copyright
7. Read the installation instructions and then click the "Next >" button.
Figure 3-6
Siemens AG 2013 All rights reserved
8. Read the product notes in the readme file and click the "Next >" button.
9. Read the license agreement. If you agree to the conditions, select the check
box and click the "Next >" button.
10. Select the check box for the FM 350-2 counter module from the list and then
click the "Next >" button.
Installation begins.
Copyright
1. Once the installation has been successfully completed, click the "Finish"
button.
Procedure
Note The hardware pictured below may differ from your own.
5. In the "PCS7_V80" profile of the hardware catalog, search for the FM 350-2
counter module.
6. Drag the FM 350-2 counter module from the catalog to the next free slot of the
ET 200M.
Note If the following window is displayed when you open the configuration interface for
the FM 350-2 counter module, click the "OK" button:
When you click the "OK" button, the configuration is saved and the configuration
interface opens.
If you click "Cancel," the interface does not open.
Addressing channels
The channels in the process image are addressed as described in the online help
for the "Pcs7Cnt1" driver block (FB1833). In the following example, the start
address 512 is used.
Note You can find information on the use of DWORD data formats in chapter 3.6.9.
The following applies for the addressing of these channels (4-7): start address of
the counter module + channel number.
Procedure
2. Open the component view of your project.
3. Select the S7 program of your automation system.
Note The contents of your symbol table may be different from the contents pictured.
Procedure
1. In the "File" menu, select the "Open" command.
The "Open Project" dialog box is displayed.
2. Open the "Libraries" tab.
3. Select the "PCS 7 AP Library V80" library and your master data library from the
list.
4. Click the "OK" button. The libraries are opened in the component view.
5. In the tree view, select the entry labeled "PCS 7 AP Library V80\Blocks +
Templates\Blocks".
6. In the menu bar, select the "View" menu and the "Details" menu command.
Figure 321
Siemens AG 2013 All rights reserved
7. Select the "Pcs7Cnt1" driver block (FB 1833) and "SelST16" (FC 369).
8. Open the context menu by right clicking the selection and select the "Copy"
menu command.
9. In your master data library, switch to the folder labeled "S7 program(1)/Blocks".
10. Open the context menu by right clicking the selection and select the "Paste"
menu command.
Procedure
1. Open the technology view of your project.
2. Optional: Generate your CFC chart for the driver block if it does not already
exist.
3. Open the CFC chart in which the driver block is to be used.
4. In the catalog, switch to the "Libraries" tab.
5. In the navigation pane, open the "S7 Program (1)/Blocks/Channel" folder in
your project library.
6. Drag the "Pcs7Cnt1" driver block to the desired location in the CFC chart.
Siemens AG 2013 All rights reserved
Note In the default setting, OB30 through OB38 are recommended for the use of the
"Pcs7Cnt1" driver block.
7. Open the context menu by right-clicking the "Connect" terminal and select the
"Interconnection to Address..."
8. Select the data area of the channel you wish to interconnect with the driver
block.
9. Compile your CFC chart. If the connection was successful, you will not receive
any error messages and additional interconnections will be created as pictured
below.
Note If the new interconnections are not immediately displayed, refresh the CFC chart
using the "F5" button.
Copyright
Note If you receive an error message stating that the FM_DATA connection cannot be
interconnected by your driver block, check your data area again and save and
compile your hardware settings for the FM 350-2 counter module.
Siemens AG 2013 All rights reserved
10. Once the compilation has been successfully completed, load the CFC chart to
Copyright
Requirements
The FM 350-2 counter module has been added in the HW Config.
The driver block is connected to a channel.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
Figure 3-30: Configuration interface for the counter module Channel selection
Siemens AG 2013 All rights reserved
NOTICE In order to use the gate function, both the software gate (channel driver)
and the hardware gate (digital input of the module) must be activated.
Copyright
Result
You have configured an FM 350-2 counter module channel for continuous
counting. The signals at the counter module will be processed in the channel.
You can monitor the counter reading on the driver module at the PV1 output.
Requirements
The FM 350-2 counter module has been added in the HW Config.
The driver block is connected to a channel.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
8. The text box for the start and end value is now enabled and ready for
parameter assignment. The default value is the high count limit.
Note When you assign the main count direction "up, the start value is 0 and you
define the end value.
Copyright
When you assign the main count direction "down, you define the start value and
the end value is 0.
10. Save the changes to the configuration of the FM 350-2 counter module
and close the window.
NOTICE In order to use the gate function, both the software gate (channel driver)
and the hardware gate (digital input of the module) must be activated.
Result
The FM 350-2 channel is configured for single or periodic counting. The function's
start/end value has been assigned. The count value can be read out via the PV1
output.
3.6.3 Measurements
Requirements
The FM 350-2 counter module has been added in the HW Config.
The driver block is connected to a channel.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
8. The text box for the signal sampling time becomes active and can be
configured.
Note Note that the first measured value is only calculated after the sampling time has
passed. In the first measuring cycle,the measured value output is "-1".
Copyright
10. Save the changes to the configuration of the FM 350-2 counter module
and close the window.
NOTICE In order to use the gate function, both the software gate (channel driver)
and the hardware gate (digital input of the module) must be activated.
Result
You have configured a channel with a measurement function. You can read off
the counted input signals at the PV1 output on the driver block. The PV2 output
provides the measured value.
Requirements
The FM 350-2 counter module has been added in the HW Config.
The driver block is connected to a channel.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
Result
You have activated the channel's hardware gate. Now, the channel will only be
activated if the software and hardware gates are active.
Siemens AG 2013 All rights reserved
Copyright
Requirements
The FM 350-2 counter module has been added in the HW Config.
The driver block is connected to a channel.
You have configured one of the counting functions on the channel.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
Result
You have configured the behavior of the counter channel. When the internal gate
is set again, the current value will continue to be used or the start value will be
reloaded, depending on your configuration.
Note An overview of the behavior of the counter module channels can be found in
chapter 2.3.2.
Siemens AG 2013 All rights reserved
Copyright
Introduction
For each channel, the FM 350-2 counter module has a digital input that determines
the count direction. The channel counts down for TRUE and up for FALSE.
Not connecting this input is equivalent to a FALSE signal, and the FM 350-2
counter module will count up. In this chapter, you will find the configuration
instructions for inverting this input.
Note The "Pcs7Cnt1" driver block does not have an input at which you can can
change the count direction.
Requirements
The counter module has been added in the HW Config.
The driver block is connected to a channel.
You have configured one of the counting functions on the channel.
Siemens AG 2013 All rights reserved
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
Result
You have negated the channel's direction input. The channel counts down for
FALSE and up for TRUE.
Siemens AG 2013 All rights reserved
Copyright
Requirements
The counter module has been added in the HW Config.
The driver block is connected to a channel.
You have configured one of the counting functions on the channel.
Note If one of the three measurement modes has been configured, then it is not
possible to load values.
Procedure
1. Open the CFC chart with the "Pcs7Cnt1" driver block.
2. Enter the desired value at the "LoadPV1_" input.
Note If the value exceeds the assigned counter limit, then the value is changed to the
negative or positive value.
Siemens AG 2013 All rights reserved
Result
You have entered your load value at the corresponding input. Whenever you
send a positive edge to the "LoadDir" input, the current counter reading will be
overwritten by the load value. Counting resumes starting at this value in your
counter channel configuration.
Siemens AG 2013 All rights reserved
Copyright
Requirements
The counter module has been added in the HW Config.
The driver block is connected to a channel.
You have configured one of the counting functions on the channel.
Note If one of the three measurement modes has been configured, then it is not
possible to load values.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
Result
You have assigned the comparison parameter for the channel's output. The output
provides a TRUE if the comparison is true. Otherwise, the output provides
a FALSE. You can monitor this on the driver block at the "CmpVal0" output.
Note If you haven not assigned a comparison parameter for the output, the output will
be permanently set to TRUE.
Note This chapter refers to the extension of the counting range of channel 0 and
channel 2. For more information, please see chapter 2.4 of this document.
Requirements
The counter module has been added in the HW Config.
For the counter limit extension of channel 0, channel 1 must be unassigned.
For the counter limit extension of channel 2, channel 3 must be unassigned.
Procedure
1. Open the SIMATIC Manager.
2. Open your PCS 7 project/multiproject
6. If you wish to extend the counting range for channel 0, set "User_Type1" to
DWord. For channel 2, set "User_Type2" to DWord.
15. Change the input words (EW) of the channels on which you extended the
counting range into input double word (ED). Accordingly, delete the EW of the
blocked channel, e. . if you have extended the counting range of channel 0
(EW520). Change EW520 to ED520 and delete EW522.
16. Save the symbol table and close the symbol editor.
17. Open the CFC chart with the driver block.
Copyright
18. Left-click the "Connect" input and select the "Interconnection to Address..."
menu command.
19. Select the changed address from the list in accordance with the channel.
20. Compile your CFC chart.
Copyright
Note If you do not delete the necessary EW, or if it is still interconnected with
a channel driver, then the CFC compiler will generate an error during
compilation.
Siemens AG 2013 All rights reserved
Copyright
21. Once the compilation has been successfully completed, load the CFC chart to
your automation system.
Result
You have switched the counting range from Word to DWord. You have extended
the data area of the driver block in the symbol table. You have connected the new,
larger data area to the driver block. A larger data area is now available to the
channel for counting.
Siemens AG 2013 All rights reserved
Copyright
4 Related literature
Table 4-1
Subject area Title
\1\ Reference to the http://support.automation.siemens.com/WW/view/en/83146298
article
\2\ SIMATIC PCS 7 http://support.automation.siemens.com/WW/view/en/63481413
overview
(collection of links
for FAQ, manuals,
compendium,
forum, application
examples and
multimedia)
\3\ Manual http://support.automation.siemens.com/WW/view/en/1105178
FM 350-2 Counter
module
\4\ FM Configuration http://support.automation.siemens.com/WW/view/en/60237759
Package
Siemens AG 2013 All rights reserved
5 History
Table 5-1
Version Date Modifications
V1.0 12/2013 First edition
Copyright