This manual describes
the counter module with
order no. 6AT1 735-0AA01-0AA0
Product Overview
Function Description
Commissioning
Operating Modes
Data Communication with the
CM35
Pulse Counter Operating Mode
Period Duration Measurement
Operating Mode
Timer Operating Mode
Positioning Operating Mode
1
2
3
4
5
6
7
8
(4) J31069-D0416-U001-A5-7618
Appendices
Literature
EC Declaration of Conformity
Glossary
A
B
Release 06/2000
Page 3
Notes on safety
!
!
!
This manual contains notes which you must adhere to for your own personal safety and to
avoid property damage. These notes are highlighted with a warning triangle showing the
degree of danger as shown below.
Danger
Means death, severe personal injury or significant property damage will occur when the
appropriate precautionary measures are not taken.
Warning
Means death, severe personal injury or significant property damage may occur when the
appropriate precautionary measures are not taken.
Caution
Means minor personal injury or property damage may occur when the appropriate precautionary measures are not taken.
Note
Highlights important information about the product, its handling or a particular portion of
the documentation which requires special attention.
Qualified
personnel
Use as intended
!
Brands
Passing on tothird parties, reproduction, utilization and revelation of
this document is not permitted without express permission.Violators
will be liable for damages.All rights are reserved, in particular rights
created by a patent grant or registration of a utility model or design.
Siemens AG
Automation and Drives
Motion Control Systems
Frauenauracher Strasse 80
D-91056 Erlangen
Siemens Aktiengesellschaft
Only qualified personnel may commission and operate the device. For the purpose of the
safety notes in this manual, qualified personnel are those persons who are authorized to commission, ground and tag devices, systems and electrical circuits in accordance with safety
standards.
Adhere to the following.
Warning
The device may only be used for the individual applications included in the catalog and
technical description. When used with devices and components of other manufacturers,
these devices and components must be approved or recommended by Siemens.
Correct and safe operation of the product is dependent on proper transportation, storage,
setup and installation and careful operator control and maintenance.
SIMATICR is a registered brand of SIEMENS AG.
The other designations in this publication may be brands whose use by third parties may
violate the rights of the owners.
Disclaimer of liabilityCopyright E Siemens AG 1997--2000, All rights reserved
Although we have checked the contents of this manual for agreement with the hardware and software described, full agreement cannot be guaranteed. The information in this manual is checked at
regular intervals and necessary corrections included in the next
release.Your ideas and suggestions are welcome.
E Siemens AG 1997--2000
Subject to change without prior notice
Page 4
Foreword
Purpose of this
manual
Contents of this
manual
Target readers
Area of validity of
this manual
Hardware and software prerequisites
for this manual
This manual describes all steps required for the effective use of the CM35
counter module. It presents the functionality of the CM35 concisely and logically while you are familiarizing yourself with the module.
This manual describes the hardware and software of the CM35. It provides an
introduction and can also be used as a reference work.
This manual has been written for the following circles of readers.
S Maintenance personnel
S Programmers
S Commissioning personnel
S Service personnel
This manual describes the functions of the CM35 counter module as t hey
were at the time this manual was published. We reserve the right to modify
the functionality of the CM35. These c hanges will be described in product
information sheets.
This manual describes:
S The CM35 counter module (order no. 6AT1 735-0AA01-0AA0)
S The configuration package (order no. 6AT1 735-0DA01-0YA0)
If you are using the previous version of the CM35 counter module (order no.
6AT1 735-0AA00-0AA0), please use the configuration package with the order number 6AT1 735-0DA00-0YA0.
Caution:
The CM35 counter module (order no. 6AT1 735-0AA01-0AA0) is not com-
patible with the CM35 counter module (order no. 6AT1 735-0AA00-0AA0).
Additional source
of information
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
The appendix lists additional sources of information on the subject of
SIMATIC S7--300.
i
Page 5
For
eword
Aids to finding
information in this
manual
Standards
This manual offers the following aids to help you find the special information
you want.
S A comprehensive table of contents is located at the beginning of the
manual.
S All chapters provide a left--hand column with an overview of the contents
of the particular section.
S At the end of the manual, you will find a glossary defining important
terms as they are used in the manual.
The SIMATIC S7--300 programmable controller meets the requirements of
standard IEC 1131.
Contact your Siemens representative at your nearest Siemens office or the
SIMATIC hotline (telephone no. 0911/895-7000 or fax no. 0911/895-7002)
for questions on the products described in this manual for which you are unable to find answers.
For questions or comments on the manual itself, please fill out the response
sheet at the end of the manual, and return it to the address indicated. We
would also appreciate your including your personal opinion of the manual on
the response sheet.
We offer courses to make it easier to get started with the SIMATIC automation system. Please contact your regional training center or the central training center in Nuremberg (tel. no. 0911/895-3154).
The CM35 is a multi--channel counter module which can be used to implement various tasks in the following operating modes.
S Pulse counter
S Period duration measurement
With 8 channels
S Timer
S PositioningWith 4 axes
The selected operating mode applies to all channels of the CM35. The function parameters can be set separately for each channel.
The counter module has eight floating digital inputs and outputs which are
used for the inputs and outputs of the counting channels. The signals are led
out via two sub D sockets on the front.
When not used for the operating mode, the outputs can be used as desired by
the user program as process I/O.
The m odule can be used for position encoding and positioning as well as in
the following systems.
-- Proportioning systems
-- Filling systems
Use with programmable controllers
and automation
systems
-- Packaging systems
-- Sorting systems
-- Systems with defined time intervals
The counter module can be used centrally on the SIMATIC S7--300 and as
distributed I/O on the modular ET 200M I/O device on the SIMATIC S7 and
SIMATIC S5. The conventional configuration procedures of STEP 7 or
COM PROFIBUS (for SIMATIC S5) are used for the configuration.
1-2
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 12
r
oduct Overview
P
1.2Use on Programmable Controllers and Automation
Systems
Central integration
into the
SIMATIC S7-300
Distributed integration into the
SIMATIC S7
The full function scope of the module can be utilized. System function
SFC 55 is available for the parameterization. See reference manual /235/.
Possible
Modules
Example:
CPU 312 IFM
CPU 313
CPU 314
:
CPU 614
Sample Configuration
PS
CPU
CM35
The full function scope of the module can be utilized. Parameterization is
performed with system function SFC 55.
Possible
Modules
Master:
-- S7-CPU with
DP interface
-- CP 443-5 Ext.
-- IM 467
Sample Configuration
S7-300
CPU 315-2 DP
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
Slave:
-- IM 153-1
-- IM 153-2
PS
PROFIBUS-DP
ET 200M
PSCM35IM 153-1
1-3
Page 13
r
oduct Overview
P
Distributed integration into the
SIMATIC S5
Since no hardware interrupts are triggered on the SIMATIC S5 by
PROFIBUS--DP, the function scope is limited. Only the operating modes
²period duration measurement² and ²timer² can be used.
Parameterization is performed via I/O direct accesses.
Possible
Modules
Master:
-- P L C
S5-95U(-MA)
-- PLC S5-115U
-- PLC S5-135U
-- PLC S5-155U
via IM 308-C
Slave:
-- IM 153-1
-- IM 153-2
Sample Configuration
IM 308-C
S5-115U
PROFIBUS-DP
ET 200M
IM 153-1
PSCM35IM 153-1
Prerequisites for the coupling are an IM 153--1 (MLFB no. 6ES7
153--1AA02--0XB0 or later) and CM35 modules (MLFB no. 6AT1
735--0AA01--0AA0, release status 4 or later).
Up to 7 CM35 modules can be connected with each IM 153--1 interface.
Exception:Maximum of one CM35 per IM 153--1 when distributed
connection to a SIMATIC S5--95U/master DP is used
Maximum of 8 CM35s per IM 153--1 when distributed
connectiontoaSIMATICS7(CPU318--2DP,
CPU 417--4 DP, CP 443--5 Ext., IM 467) is used
1-4
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 14
r
oduct Overview
P
IM 153-2
SIMATIC S7-400H
and active backplane bus,
SIMATIC PCS 7
Prerequisites for the coupling are an IM 153--2 (MLFB no. 6ES7
153--2AA01--0XB0, release status 2 or later) and CM35 modules (MLFB no.
6AT1 735--0AA01--0AA0).
CM35 modules (MLFB no. 6AT1 735--0AA01--0AA0, release status 4 or
later) are required for the IM 153--2 interfaces (MLFB no. 6ES7
153--2AA02--0XB0, release status 5 or later).
Up to 7 CM35 modules can be connected to each IM 153--2 interface.
Exception:Maximum of one CM35 per IM 153--2 when distributed
connection to a SIMATIC S5--95U/master DP is used
Maximum of 8 CM35s per IM 153--2 when distributed
connectiontoaSIMATICS7(CPU318--2DP,
CPU 417--4 DP, CP 443--5 Ext., IM 467) is used.
The present version of the CM35 does not support:
S The setup with active bus modules for ET 200M
S Use on high--availability programmable controllers with redundant setup
(SIMATIC S7-400H)
S Use with SIMATIC PCS 7
For additional information, contact the SIMATIC hotline.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
1-5
Page 15
r
oduct Overview
P
1.3Hardware
View of the
module with
front door
closed
SF
CM35
Counter Module
x2
34
xxxxxxx
Module name
SF LED
Front door
Release status
Order number
(6AT1 735-0AA01-0AA0)
View of the
module with
front door
open
Figure 1-1View of the front with front door closed
SF
Digital inputs
25-- pin sub D socket
Digital outputs
15-- pin sub D socket
Figure 1-2View of the front with front door open
1-6
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 16
r
oduct Overview
P
Front plug
connector
SF LED
The CM35 is equipped with the following front plug connectors for connection of the process I/O.
S 25--pin sub D socket for connection of the input signals (digital inputs)
The inputs are individually isolated from one another and can be used
with a 5 V or 24 V signal level.
S 15--pin sub D socket with digit al outputs and the connection for the exter-
nal supply voltage for the digital outputs
The outputs are isolated against the module logic, but are not isolated
among one another. They are powered with a supply voltage of 24 V DC.
The red SF LED on the front indicates that the module is not ready for operation. This LED goes off when a valid parameterization was transferred to the
module after a warm restart or hot restart and the BASP/OD signal is no longer active.
The CM35 does not support diagnostic alarms and the STEP 7 diagnostic
information.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
1-7
Page 17
r
oduct Overview
P
1.4Software
Module
firmware
The firmware of the module offers four different operating modes.
S Pulse counter
Continuous counting with maximum counting frequencies of 10 kHz
S Period duration measurement
Measurement of period durations between 1 msec and 2.6 sec with a resolution of 1% on all 8 channels (reference frequencies: 100 kHz, 50 kHz,
25 kHz)
S Timer
8 separate switch--on times from 10 msec to 278 min
S Positioning
31
4 axes with a max. of 2
2kHz
The desired operating mode is selected via the configuration user interface.
Note
The following applies when the CM35 is used to acquire frequencies.
increments up to a top frequency of
S For lower frequencies: ²period duration measurement² operating mode is
recommended (the pe r iod duration can be converted to a frequency).
S For higher frequencies: ²pulse counting² operating mode is recom-
mended.
Software
Depending on use on the SIMATIC S7 or decentralized on the SIMATIC S5,
configuration of the module is performed with the ²SIMATIC Manager² or
with ²COM PROFIBUS.²
1-8
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 18
1.5Technical Data
r
P
oduct Overview
Digital inputs
TypePulse counter
Number8
SystemIncremental
Limit frequencyMax. of 10 kHz
Minimum pulse duration
(for high and low)
Signal levelS 24 Volt signals:
40 msec
--Signal
--Signal
²H²:15to30Volt
²L²:-3to+5Volt
S 5 Volt signals:
--Signal
--Signal
Input currentS For 24 V and ²H² signal
--Typical4.7 mA
²H²:2.4to6Volt
²L²: --0.6 to 0.8 Volt
S For 5 V and ²H² signal
--Typical10 mA
Potential isolationYes
Maximum signal rise timeFrom ²L² to ²H²: typ. 10 msec
From
²H² to ²L²: typ. 15 msec
Permissible cable length (shielded)For 24 V25 m
For 5 V5 m
Connection25--pin sub D socket
Digital outputs
Number8
Signal level24 Volt, P--switching
Output current (short--circuit proof)Per DO:Max. of 0.5 A
Total current:Max. of 4 A
Switching frequencyMax. of 10 Hz with ohmic load
8 Hz with lamp load
Max. of 0.5 Hz with inductive load
Cable lengthMax. of 100 m
Connection15--pin sub D socket
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
1-9
Page 19
r
oduct Overview
P
Other
MLFB no.
Input voltage+5 V via P bus
Current consumptionTyp. 0.150 A
UL/CSA/FMNo
CM 35 counter module:6AT1 735-0AA01-0AA0 or later
Configuration package:6AT1 735-0DA01-0YA0 or later
1-10
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 20
Function Description
2
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
2-1
Page 21
F
unction Description
2.1Function Overview
Table 2-1Operating modes
Operating
FunctionLimit
Mode
Pulse
counter
Counting up from
0 to 65535 with
comparison function
Counting down from
65535 to 0 with
comparison function
Period duration measurement
Measuring the time
between 2 falling
edges of the applied
signal
TimerOutputting the speci-
fied switching times
via the digital outputs
PositioningAcquiring the actual
position of axes via
incremental
encoder (track A/B)
and comparing it with
the setpoint
Fre-
quency
Control the
Digital
Outputs Via ...
Hardware
Interrupt
for ...
Use
on
S5 Master
or
Standard
Master
10 kHzOperating mode/
CPU control
Comparison
value
Not possible
is reached.
1kHzCPU control-Possible
-Operating mode/
CPU control
Expiration of
the
Possible
switch--on
time
2kHzOperating mode/
CPU control
Setpoint is
reached.
Not possible
2-2
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 22
2.2Pulse Counter
F
In this operating mode, the CM35 continuously counts up or down between 0
and 65535 when the counter is enabled.
-- When the counting value reaches the upper counting limit while
counting up and another pulse arrives, the counting value jumps to the
lower counting limit and counts from there without losing a pulse.
-- When the counting value reaches the lower counting limit while
counting down and another pulse arrives, the counting value j umps to
the upper counting limit and counts from there without losing a pulse.
2.3Period Duration Measurement
In this operating mode, the CM35 acquires low frequencies with the aid of
period duration measurement.
The CM35 measures the e xact time between two falling edges of the counting signal by counting the pulses of an internal, precision--quartz reference
frequency.
unction Description
2.4Timer
In timer operating mode, precisely defined switch-- on times of 10 milliseconds to 278 minutes can be implemented for every digital output.
2.5Positioning
In this operating mode, the CM35 supports controlled positioning with a
switch--off point.
Position acquisition is performed with an incremental encoder whose pulses
are acquired by the module with the correct sign in the traversing area from
–2,147,483,648 to +2,147,483,647.
Two digital outputs are available for each of the four channels. These outputs are addressed by the CM35 based on the direction.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
2-3
Page 23
F
unctionDescription
2-4
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 24
Commissioning
This chapter provides all the information you will need for commissioning,
including mounting, connection, configuration and parameterizati on.
3
General safety
notes
!
!
Adherence to these safety notes is mandatory. Non--adherence will void the
warranty!
Warning
Unqualified manipulations on the device/system or non--adherence to the
warnings on the cabinet of the device/system can cause severe personal injury or property damage. Only qualified personnel may perform work on this
device/system.
Note
This device has been developed, manufac tured, tested and documented in
accordance with pertinent safety standards. Under normal conditions, the
device does not endanger property or human health.
Caution
Commissioning is prohibited until it has been determined that the machine in
which these components are to be installed meets the regulations of guideline 89/392/EWG.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-1
Page 25
Commi
s
s
ioning
Note
The following rules must be adhered to ensure that EU guidelines
89/336/EWG have been met.
S The setup guidelines and safety notes in the manuals and supplementary
documentation must be adhered to for both the programmable controller
and the CM35.
S To achieve maximum EMC immunity, all signal lines to the CM35 must
be shielded and applied to a grounded shield retainer rail.
S On the CM35, the cable shield m ay not be applied to the sub D plug con-
nector.
3-2
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 26
3.1Installation of the CM35
s
s
3.1.1Mounting the CM35
Commi
ioning
Preparation
Slot
Before physical installation is begun, the appropriate safety precautions must
be taken and the following points complied with or clarified.
S Was the module still in its original packaging?
S Check the delivery for transportation damages.
S Check the delivery for completeness.
If you discover damages or deficiencies, please contact
your SIEMENS representative.
The S7 interface of the CM35 corresponds to the serial I/O bus (P bus) of
the SIMATIC S7-300.
All slots on the SIMATIC S7 which can be assigned to signal modules (SM)
are available to the CM35.
For additional information, see the manual of the SIMATIC S7--300.
The maximum numbe r of CM35 modules which can be installed on SIMATIC programmable cont rollers depends on the following fac tors.
S Maximum number of modules in the central rack/expansion unit or the
modular ET 200M I/O device
S Memory requirements of the S5/S7/C7 CPU
S Maximum permissible current consumption (5 V) from the S7 backplane
bus
Physical
setup
Installation
position
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
For information on possible physical setups and how to configure, see
manual /70/.
Horizontal installation is recommended. When vertical installation is used,
remember that environmental temperatures are restricted (max. of 40° C).
3-3
Page 27
100
0mA
A
ET200Mwit
h
p
DPmaste
r
Commi
s
s
Table 3-1Technical data of the SIMATIC
Type of SetupCentral SetupDistributed Setup
CPUWork memory of the
CPU 312 IFM68MODNo multi--row setup possible7 MOD per ET 200M
CPU 31312800 m
CPU 314248MOD8+8MOD1 · 8MOD
ioning
CPU
in Kbytes
(status 6/2000)
Number of Modules Which Can Be Installed on the Central Rack/Expansion Unit
Current (5 V) from the S7 Backplane Bus
1-row2-rowMax. of
4-row
Central rack IM 3651 · IM 360
3 · IM 361
ET 200M
CPU 314 IFM32
CPU 31548
CPU 315-2 DP64
CPU 316128
CPU 318-2 DP512,
of these max. of
256 for code
256 for data
CPU 31X-2 DP
CPU 41X-X DP
C7-6XX DP
S5-1X5U with
IM 308-C
MOD = CM35 modules
Depends on the CPU
being used
1200 mATo tal of
1100 mA
---
1 · 850 mA
plus
3 · 8MOD
3 · 800 mA
Exception:
With CPU
314 IFM:
Total of up t o
31 modules
Exceptions:
Max. of 8 MOD per
:
- CPU 318-2 DP
- CPU 417-4 DP
- CP 443-5 Ext.
- IM 467
Max. of 1 MOD per
ET 200M with:
SIMATIC S5-95U/
DP master
The number of slave
stations (ET 200M) per
CPU depends on the
CPU being used.
Example:
CPU 315-2 DP: Max.
of 32 slave stations
(ET 200M) per CPU
3-4
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 28
Commi
s
s
Table 3-2Requirements on the CM35 side
ioning
With Use ofCurrent requirements (5 V) from
S7 Backplane Bus
m · CM35m · 150 mA
m = Number of CM35 modules
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-5
Page 29
Commi
s
s
ioning
3.1.2Mounting and Demounting the CM35
Rules
Required tools
No special protective measures (ESD guidelines) are required for installation
of the CM35.
You will need a 4.5 mm screwdriver to mount and de mount the CM35.
Note
Make absolutely sure that cable installation meets EMC regulations (also
inside the cabinets).
Avoid installing cables next to power cables, and shield the cables in the
manner described above.
Two--sided shield application is usually recommended. When interference is
primarily low--frequency, one--sided shield application can be more advantageous.
Adhere to the grounding concept of the SIMATIC S7--300 to avoid problems
with potential.
The setup guidelines (AR) of the SIMATIC S7 (see manual on setting up
S7--300 programmable controllers and CPU data) must be adhered to during
all mounting steps, and the following instructions must be performed in the
order specified.
3-6
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 30
Commi
s
s
ioning
How to install
How to remove/
replace modules
For how to mount the modules on the system, see manual /70/ or /140/.
A simplified version of installation is given here.
1. Turn off all voltages on the SIMATIC S7, secure against switch--on, and
label.
2. Make protective conductor connection, or check it. See AR.
3. Mount shield connecting element (SAE).
-- The shield connecting element must be mounted directly under the
slot of the CM35 on the mounting rail.
-- Each cable to be connected to the CM35 requires a shield clamp on
the shield rail of the SAE.
4. Plug in bus connector. See AR.
-- A bus connector is supplied with each CM35. Insert the bus connector
on the module occupying the slot to the left of the CM35.
5. Hang in CM35. See AR.
6. Secure CM35 with screw. See AR.
7. Label CM35. See AR.
For how to set up/replace modules in the system, see manual /70/ or /140/.
A simplified version of removal is given here.
1. Switch the CPU to STOP.
2. Turn off the power supply.
3. Release the front plug connector, and disconnect it.
4. Release the mounting screw on the module.
5. Swivel the module out of the mounting rail, and re move it.
6. If necessary, install the new module.
For more information on removing the modules, see manuals /70/ and /140/.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-7
Page 31
Commi
s
s
ioning
3.2Wiring the CM35
Digital inputs
Digital outputs
Shield clamps
The 8 counting inputs (channels) of the CM35 are availa ble on a 25--pin sub
D socket on the front of the module.
Each counting input has separate connections for reference pote ntial
(ground), and 5 V and 24 V signals. To prevent malfunctions, only one of the
two signal voltages may be wired at a time.
The encoder must be powered by an external voltage source.
The 8 outputs of the CM35 are available on a 15--pin sub D socket on the
front of the module. A load power supply of 24 V DC must also be connected
there which is able to continuously supply the sum of the required output
currents.
The outputs are P switches which can handle a load current of 0.4 A. They
are protected against overload and short circuits.
The size of the shield clamp depends on the diameter of the cable.
To mount a cable with the shield clamp, bare the shield by cutting out
approximately 1.5 cm of the cable insulation at the appropriate location on
the cable.
2
Shield clamp
Shield rail
(fixed)
1
Figure 3-1Mounting the shield clamps
Caution
!
Do not damage the braiding of the shield when baring the cable.
When applying the shield to all cables connected to the CM35, remember to
leave enough cable between the shield connecting element and the CM35 so
that the CM35 can be removed with all cables connected.
3-8
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 32
Figure 3-2Shield connecting element
s
s
Commi
ioning
Shield connecting
element
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-9
Page 33
Commi
s
s
ioning
3.2.1Connection Allocation of the 25-- Pin Sub D Socket
Wiring of the operating modes pulse
counter,
period duration
measurement and
timer
13
25
14
1
The i nputs must be wired in accordance with table 3-3 for modes pulse
counter, period duration measurement and timer.
Table 3-3Wiring
Signal Voltage
5V1Counting pulse20
24 V1Counting pulse1
ChannelEncoder
Signal
Ground14
2Counting pulse2
Ground21
3Counting pulse9
Ground3
4Counting pulse16
Ground10
5Counting pulse23
Ground17
6Counting pulse5
Ground24
7Counting pulse12
Ground6
8Counting pulse19
Ground13
Ground14
2Counting pulse8
Ground21
3Counting pulse15
Ground3
4Counting pulse22
Ground10
5Counting pulse4
Ground17
6Counting pulse11
Ground24
7Counting pulse18
Ground6
8Counting pulse25
Ground13
Connection to Pin ...
3-10
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 34
Commi
s
s
ioning
Wiring for operating mode
positioning
13
25
14
1
When ²positioning² mode is used, the inputs must be wired in accordance
with table 3-4.
3.2.2Connection Allocation of the 15-- Pin Sub D Socket
Table 3-5Allocation of the 15 --pin sub D socket
15
14
Pin
1VCC1INLoad voltage 24 V
2VCC1INLoad voltage 24 V
3O1OUTDigital output 1Axis 1, forwards
4O2OUTDigital output 2Axis 1, backwards
8
1
5O3OUTDigital output 3Axis 2, forwards
6O4OUTDigital output 4Axis 2, backwards
7GND 2INGround load voltage for digital outputs
8GND 2INGround load voltage for digital outputs
9VCC1INLoad voltage 24 V
10VCC1INLoad voltage 24 V
11O5OUTDigital output 5Axis 3, forwards
12O6OUTDigital output 6Axis 3, backwards
13O7OUTDigital output 7Axis 4, forwards
14O8OUTDigital output 8Axis 4, backwards
15GND 2INGround load voltage for digital outputs
SignalInput/
Output
Pulse Counter,
Period Duration
Measurement,
Timer
Function for Mode
Positioning
The connections for 24 V load voltage and for ground load voltage are connected internally.
3-12
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 36
Commi
s
s
3.3Configuration and Parameterization
Configuration and parameterization of the CM35 depends on the system on
which the module is to be used.
Table 3-6Overview of configuration and parameterization
ioning
Central Integration into
the SIMATIC S7-300
Configuration toolSTEP 7, HW ConfigCOM PROFIBUS
Module addressDepends on slot or selecta-
ble as desired
(depends on CPU)
Setting the operating modeDuring configuration
ParameterizationWith SFC 55 “WR_PARM”Via I/O direct accesses
Configuration with
STEP 7
The object manager from the included data medium must be installed first
(see chapter 3.3.1) so that STEP 7 will be able to recognize the CM35 during
Distributed Integration
into the SIMATIC S7
Can be selected as desired
Distributed Integration
into the SIMATIC S5
configuration.
Configuration with
COM PROFIBUS
Parameterization
The current GSD files must be loaded to subdirectory GSD so that
COM PROFIBUS is able to recogniz e the CM35 during configuration.
Parameterization is performed by the user program and only refers to the operating mode which was set when the module was configured.The required
parameters depend on this operating mode.
The fundamentals of parameterization are described in chapter 4.2.
For details, see the de scriptions of the individual operating modes.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-13
Page 37
Commi
s
s
ioning
3.3.1Installation of the Object Manager for STEP 7
Prerequisites
Installing the
object manager
Configuring the
hardware
To install the object manager (OM), STEP 7 (starting with V3.2) must be
installed correctly on your PG/PC.
To install the object manager, proceed as shown below.
1. Make sure that no applications are open in Windows.
2. Insert the data medium.
3. Call the SETUP.EXE program.
The CM35 counter module is located in the path shown below under STEP 7
! HW Config ! Catalog.
Figure 3-3Counter module CM35 in the hardware catalog
Indicating
integrated help
In addition to the dialogs of the object manager, help information is available
which you can call during every phase of parameterization either with the F1
key or with the Help button.
3-14
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 38
Commi
s
s
3.3.2Central Integration into the SIMATIC S7-300
ioning
Configuration
Module
address
Setting the
operating mode
When used with an S7--300, the module is configured with STEP 7 with the
application HW Config. To add a CM35 to an existing project, proceed as
shown below.
1. Start the SIMATIC Manager, and open the desired project.
2. In the left--hand portion of the project screen, select the SIMATIC 300
station to which you want to add the CM35.
3. Select the menu command Edit > Open Object.
This opens the HW Config application. This application contains a screen
with the hardware setup of the opened station.
4. Select the CM35 from the module catalog of HW Config, and place it in
the module rack.
Based on its position on the mounting rail, the required input and output address areas are automatically assigned to the CM35 and entered in the confi guration table.
When certain CPUs are used, these address areas can be changed. For details, see manual /70/.
The operating mode of the CM35 must have already been set during the configuration. Proceed as shown below.
Commissioning
1. In the configuration table, select the line with the CM35, and select the
menu command Edit > Object Properties.
2. In the dialog box, open the tab Operating Mode, select the desired oper-
ating mode, and confirm with OK.
For additional details on preparation for operation, see manual /70/ and user
manual /231/.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-15
Page 39
Commi
s
s
ioning
3.3.3Distributed Integration into the SIMATIC S7
Configuration
Module
address
The module is configured as distributed I/O with the HW Config application
of STEP 7. To add a CM35 to an existing project, proceed as shown below.
1. Start the SIMATIC Manager, and open the desired project.
2. In the left--hand portion of the project screen, select the SIMATIC station
from which the DP slave is to be addressed.
3. Select the menu command Edit > Open Object.
This opens the HW Config application. This application contains a screen
with the hardware setup of the opened station.
4. If not already done, set up a DP slave. From the ²Hardware Catalog²
screen, select an ET 200M with IM 153-2, and place it in a PROFIBUS--DP master system.
5. Select the CM35 from the hardware catalog, and place it in the ET 200M.
Based on the position on ET 200M, the required input and output address
areas are automatically assigned to the CM35 and entered in the configuration table. Address gaps in the address areas of the CPU rack are utilized.
The preset address areas can be changed in accordance with certain rules.
For more information on free address assignment, see manual /70/. Proceed
as shown below.
1. In the configuration table, select the line with the CM35, and select the
menu command Edit > Object Properties.
Setting the
operating mode
Commissioning
2. In the indicated dialog box, open the t ab Addresses, and enter the desired
start address.
If there are address overlaps with other modules, you will be told this
when you close the dialog box.
3. Leave the dialog box open so that you can make the following settings of
the module’s operating mode.
The operating mode of the CM35 must have already been set during configuration. Proceed as shown below.
1. If not already done, select the line with the CM35 in the configuration
table, and select the menu command Edit > Object Properties.
2. In the dialog screen, open the tab Operating Mode, select the desired
operating mode, and confirm with OK.
For additional preparations before operation, see manual /70/ and user
manual /231/.
3-16
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 40
Commi
s
s
3.3.4Distributed Integration into the SIMATIC S5
Note
This section assumes that you have a knowledge of SIMATIC S5 and
COM PROFIBUS.
ioning
Integration on the
SIMATIC S5
The CM35 module can be linked as distributed I/O to the SIMATIC S5 using
PROFIBUS--DP.
The modular ET 200M I/O device is required to link the CM35 modules t o
PROFIBUS--DP. The SIMATIC S5 is connected to PROFIBUS--DP with interface IM 308--C. Another method is to use a SIMATIC S5--95U/DP master
with integrated PROFIBUS--DP interface.
3.3.4.1Hardware Prerequisites
IM 308-C
Release 4 or later
Note
An FB 192 with release 3 can only be used with an IM 308--C starting with
release 6!
When release status 2 of the FB 192 is used, all versions of the IM 308-C
can be used starting with release status 3.
S5-95U/master DP
Release 2 or later
The maximum tra nsmission speed is 9600 Kbaud to 1.5 Mbaud, depending
on the length of the cable.
IM 153-1
Prerequisites for the coupling are an IM 153--1 (MLFB no. 6ES7
153--1AA02--0XB0 or later) and CM35 modules (MLFB no. 6AT1
735--0AA01--0AA0, release status 4 or later)
IM 153-2
Prerequisites for the coupling are an IM 153--2 (MLFB no. 6ES7
153--2AA01--0XB0, release status 2 or later) and CM35 modules (MLFB no.
6AT1 735--0AA01--0AA0).
CM35 modules (MLFB no. 6AT1 735--0AA01--0AA0, release status 4 or
later) are required for the IM 153--2 interfaces (MLFB no. 6ES7
153--2AA02--0XB0, release status 5 or later).
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-17
Page 41
Commi
s
s
ioning
3.3.4.2Configuration
COM PROFIBUS
The IM 308-C interface module or S5-95U/DP master is parameterized with
the COM PROFIBUS software. With more recent versions of COM
PROFIBUS, you should be able to find the CM35 module in the ET 200M
under its order number 6AT1 735-0AA01-0AA0. See figure 3-4.
If you cannot find the CM35, copy the type or GSD files from the configuration package to the appropriate direc tory of COM PROFIBUS. Which files
must be copied depends on the version of COM PROFIBUS.
S With COM PROFIBUS (version £ 3.2): Copy the type files to the direc-
tory ²TYPDAT5X.²
S With COM PROFIBUS (version ³ 3.3): Copy the GSD files to the direc-
tory ²GSD.²
Figure 3-4Selecting the CM35 module during configuration of the ET 200M
Table 3-7Type and GSD files
File Name
SI801DV*.200Type file for IM 153-1
ST801EU*.200Type file for IM 153-2
SIM801D.GS*GSD file for IM 153-1
SIM801E.GS*GSD file for IM 153-2
SIM8071.GS*GSD file for IM 153-2 FO
* Identifies the particular language version
Use
3-18
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 42
Commi
s
s
ioning
Note
The latest GSD files (only for COM PROFIBUS version ³ 3.3) can be down-
loaded from the Internet (SIMATIC Customer Support).
Internet address: http://www.ad. siemens.de/support/html_00/index.shtml
Copy the new GSD files to the ²GSD² directory, and execute the menu command ²File > Open GSD File.²
Using the GSD files included with the configuration package has a drawback
-- you will not be using the latest GSD file (e.g., you may not be able to find
other new modules).
The type files are only required for older COM PROFIBUS
versions £ 3.2. In the future, they will be completely replaced by the
GSD files.
Configuration
Module
address
The module is configured as distributed I/O on the SIMATIC S5 with
COM PROFIBUS.
To add a CM35 to an existing DP master system, proceed as shown below.
1. Start COM PROFIBUS, and open the desired master system.
2. Open a DP slave (ET 200M with IM 153-1), or set up a new one.
3. Place the module in the ET 200M. In the configuration table, select the
desired slot, and select the button Order No. ...
In the dialog box ²Select...,² select the order number of the CM35
(6AT1 735-0AA01-0AA0), and select the Accept button.
4. Leave the configuration table open t o set the addresses and operating
mode which come next.
You can specify a start address for the input and for the output area. This address depends on the operating mode you want to use.
S Direct process inputs and outputs: Addresses in the P or Q area
Accesses only permitted via word load and transfer operations
S Accesses via FB 192: No address specifications required
For a detailed description of FB 192 and its manual, see the manual of
COM PROFIBUS.
Address overlapping with other modules or conflicts with reserved areas are
indicated by COM PROFIBUS.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-19
Page 43
Commi
s
s
ioning
Module
address (for
use of
the IM 308-C)
The same start address is used for the input area and for the output area. The
CM35 module occupies 16 bytes in the input area and 16 bytes in the output
area. The module address must be a whole number multiple of 16. The start
address is also required for configuration under COM PROFIBUS.
Addressing in the process image (PY0 to PY127) should never be used for
consistent data.
Table 3-8Possible addresses
CM35 number
Possible CM35 addressesP:128144160176192208224240
CM35 number910111213141516
Possible CM35 addressesQ:0163248648096112
CM35 number1718192021222324
Possible CM35 addressesQ:128144160176192208224240
1)
A fixed relationship between CM35 number and address does not exist.A maximum of 24 CM35 modules can be addressed per IM 308--C interface.
Module
address (for
use of
the S5-95U/DP)
1)
Input/output bytes 64 to 127 are used for both the local I/O (e.g., analog input/output modules, slots 0 to 7) and the distributed I/O (DP slaves). When
the local I/O is used (e.g., analog input/output modules), the address areas
must be reserved in the host parameters by the user with COM PROFIBUS.
12345678
Table 3-9Possible addresses
CM35 number
Possible CM35 addressesP:648096112128144160176
12345678
3-20
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 44
Commi
s
s
ioning
Setting the
operating mode
The operating mode of the CM35 must have already been set during configuration. Proceed as shown below.
1. In the configuration table, select the line with the CM35, and click the
button Param. ...
2. In the dialog box ²Parameterize...,² select the field under ²Value ² in the
first line of the table (5), and click the Select... button. In the next dialog
box which appears, select the desired operating mode, and confirm with
OK.
3. Repeat this step in the second line of the table (8) with the same operating
mode. See figure 3-5.
4. In the ²Parameterize...² dialog box, click the OK button, and close the
configuration table with OK.
Commissioning
Figure 3-5Setting the operating mode with COM PROFIBUS
Note
When distributed integration into the SIMATIC S5 is used, only the operating modes ²period duration measurement² and ²timer² (time generator) are
permitted. See chapter 1.2.
For additional preparations before operation, see the manual of COM PROFIBUS.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-21
Page 45
Commi
s
s
ioning
Data consistency
When the distributed integration is used, data consistency must be considered. Data are called consistent when their contents belong together.
When you access the CM35 with load/transfer commands, only word accesses may be used and only even addresses may be accessed so that consistency is ensured.
Data consistency is specified via the COM PROFIBUS configurat ion. Word
consistency has already been set for the CM35 in the type or GSD files included in the configuration package.
Figure 3-6Setting of the consistency via COM PROFIBUS
For more information, see the manual on the distributed I/O system ET 200.
3-22
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 46
Commi
s
s
ioning
3.4Reactions during Startup and in Case of Errors
Warm restart
Hot restart
Reaction to failure
of the S7-300
Module power
supply
When a warm restart (power on) takes place, the red group error LED (SF)
on the front of the module stays on until the module is ready for operation
(i.e., until it has received valid parameters).
When the module firmware recognizes the CPU STOP stat e, the parameters
stored on the CM35 lose their validity. Parameter memory and the input and
output area are deleted. This is indicated by the group error LED.
When the CPU assumes the STOP state , running operation of the CM35 is
terminated. The digital outputs are switched off (i.e., reset). Although the
operating mode is retained, the parameters are no longer valid.
Since the CM35 is completely powered by the backplane bus of the
SIMATIC S7-300, it has to be switched on together with the S7--300 CPU or
IM module.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
3-23
Page 47
Commi
s
s
ioning
3-24
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 48
Data Communication with the CM35
4
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-1
Page 49
D
ata
Communication with the CM35
4.1Overview
Address area
Parameterization
The CM35 is located in the analog address area of the programmable controller.
Central operation:
The address is assigned in one of the following ways, depending on the
S7--300 CPU being used.
-- Slot--oriented
-- As desired
Use the module’s start address from HW Config.
Distributed operation:
The address of the CM35 can be assigned as desired.
The start address of the module can be taken from one of the following.
-- HW Config with an S7 master (e.g., CPU 315--2 DP)
-- COM PROFIBUS with an S5 master (e.g., IM 308-C).
Use HW Config or COM PROFIBUS to set the operating mode for the
CM35 (e.g., pulse counter).
The data required to operate the module in the selected mode (e.g., counting
direction and compa rison values for pulse counting mode) are transferred to
the CM35 with the parameterization.
Programming
The parameters must be transferred at least once to the CM35 after CPU
STOP ® RUN.
With centralized use of the CM35 and with distributed use on S7 masters, the
parameters are written with system function SFC 55 “WR_PARM.”
With DP use with S5 masters, the parameters are written with direct I/O accesses (only in the permissible modes ²peri od duration measurement² and
²timer.²
After parameterization, you can
-- control operation of the individual channels via write accesses
-- read the data of the CM35 with read accesses
Depending on the selected operating mode and the parameteriz ation, the
module supports the triggering of hardware interrupts with the SIMATIC S7.
OB 40 must be programmed for this.
4-2
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 50
4.2Parameterization
ata
D
Communication with the CM35
Parameter data
Parameter block
The parameter data for the individual operating modes are combined into
parameter blocks. The required number of parameter blocks depends on the
operating mode which you selected.
The parameters must be transferred at least once to the CM35 after CPU
STOP ® RUN. After the data have been transferred correctly, the red SF
LED goes off and the m odule is ready for operation.
The parameters can be specified again during operation so that the individual
channels can be adjusted to the particular state of the process.
The parameter blocks can be transferred in any sequence. The order has no
effect on their use.
Note
Before a channel can be reparameterized, it must be stopped. The paramet ers
for a channel may not be changed or written while the channel is running.
A parameter block consists of the following.
-- A control word
-- Up to 6 words of data area (parameter data)
Table 4-1Layout of a parameter block
WordDescription
Wor d 1Control word
Wor ds 2 t o 7Parameter data
For the allocation and description of the parameter data for the individual
parameter blocks, see the description of the operating mode.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-3
Page 51
D
ata
Communication with the CM35
Layout of the
control word
The control word is the first word of each parameter block. The layout of the
control word is shown below.
The bit numbering is specifi ed for the data type ²word.²
-- The low byte of word ²n² has the byte address ²n+1.²
-- The high byte of word ²n² has the byte address ²n.²
Byte n
Start/stop byte
15X14X13X12X11 10 9 8 706 5 4 3 2 1 0
X = Disregard
Byte n+1
Coordination byte
Operating mode
Parameter block number
Consistency bit
Start/stop byte enable
Parameter block subnumber
Table 4--2 shows the permissible allocations of the cont rol word.
Table 4-2Allocation of the control word for parameterization
Bit
Address
0to3Identifier
for the set operating mode
4to5Nu mb er
of the current parameter block
6Consistency bit
-- Only with parameterization via
direct I/O accesses
0:Write parameter block
1:Accept parameter block via CM35
1:Evaluate start/stop byte
4-4
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 52
D
ata
Table 4-2Allocation of the control word for parameterization, continued
Communication with the CM35
Bit
Address
8to11Subnumber for parameter block
-- O n l y f o r ²positioning² mode
-- Not applicable to the operating modes
pulse counter, period duration measurement
and timer
12 to 15Disregard
Example (S5)
²Timer² mode/parameterization via direct I/O accesses
Write parameter block 2:
To write dataassign W#16#0023 to control word
To accept data via CM35 assign W#16#0063 to control word
Data transmission
The parameter blocks for the parameterization of the CM35 can be written in
one of the following ways.
-- Use of data record number 1 with SFC 55 “WR_PARM”
-- Write the analog I/O address area with direct I/O accesses
The data are written with SFC 55 when the CM35 is used with SIMATIC S7.
Direct I/O write-- accesses to the data must be used for DP operation with S5
masters or standard DP masters. A consistency bit which must be specified
via the user program is available to ensure the data consistency of a parameter block.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-5
Page 53
ata
Communication with the CM35
D
4.2.1Parameterization with SFC 55 (Only SIMATIC S7)
SFC 55 “WR_PARM” can be used to transfer to the module a complet e parameter block (cont rol word and parameterization data, length of 14 bytes) as
data record 1.
Below is an example for the transmission of the 1st parameter block from DB
20 (pulse counting mode). The CM35 has the logical base address 256.
Table 4-3Sample allocation for a data block (DB 20)
DB
Address
+0.0Para_Block_1_DataSTRUCT
+0.0Control wordWORDW#16#11Parameter block 1/
+2.0Cmp_Start_Va-
lue_Chan_1
+4.0Cmp_Start_Va-
lue_Chan_2
+6.0Cmp_Start_Va-
lue_Chan_3
+8.0Cmp_Start_Va-
lue_Chan_4
+10.0Cmp_Start_Va-
lue_Chan_5
+12.0Cmp_Start_Va-
lue_Chan_6
=14.0END_STRUCT
NameTypeInitial ValueCommentary
pulse counting mode
WORDW#16#00Comparison value/start value,
channel 1
WORDW#16#00Comparison value/start value,
channel 2
WORDW#16#00Comparison value/start value,
channel 3
WORDW#16#00Comparison value/start value,
channel 4
WORDW#16#00Comparison value/start value,
channel 5
WORDW#16#00Comparison value/start value,
channel 6
CALL SFC55
REQ:=true// Request to
write
IOID:=B#16#54// Area identifie r for
composite mod.
LADDR:=W#16#100// Logical address = 256
RECNUM:=B#16#1/ / Data record number 1
RECORD:=P#DB20.DBX 0.0 BYTE 14// Pointer to beginning
of the block
RET_VAL:=#ret_val// Error code
BUSY:=#busy// = 1, writing not
concluded
4-6
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 54
ata
Communication with the CM35
D
SFC 55 must continue to be called until BUSY is reset.
SFC 55 should not be used in OB100. We recommend setting a flag bit
(startup identifier) in OB100 instead. SFC 55 should then be called based on
this flag bit to parameterize the CM35 after the automation system is turned
on.
If an error occurs while the function is being processed, the error code is indicated in parameter RET_VAL, and BIE is set to ²0.²
For a description of the parameterization of the system functions and the return values, see STEP 7 reference manual /235/.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-7
Page 55
D
ata
Communication with the CM35
4.2.2Parameterization via Direct I/O Accesses (Only SIMATIC S5)
Parameterization via direct accesses is only permitted in the ²period duration
measurement² and ²timer² operating modes.
Assignment of the
I/O address area
Use of the consistency bit
The analog I/O address area contains 8 words. The data must be written with
word accesses.
The I/O address area is used for parameterization as shown below.
Table 4-4Assignment of the address area for parameterization via direct I/O
accesses
Offset for the
Module Start Address
+0DO byte (digital output control)
may not be written during parameterization.
+2Control word
+4 to +14Parameterization data
Description
The consistency (”C bit”) in the control word is used with direct--access parameterization to ensure consistency of the written values within one parameter
block.
The CM35 does not evaluate the transferred values of one parameter block as
long as the C bit is not set. These values do not becom e valid until the control word is written with C bit = 1.
Transmission of
parameter blocks
The following sequence must be used to transfer the pafameter blocks.
1. Transfer the control word with C bit = 0.
2. Transfer all required data of the parameter block.
3. Transfer the control word with C bit = 1.
Transfer next parameter block.
Note
The c hannels may not be started or stopped by accesses to the control word
while parameter bl ocks are being transferred. The system must be in a defined state before parameter blocks are transferred.
An example is shown below.
--²Timer² operating mode
-- Transmission of the 1st parameter block from DB 20
-- The CM35 has the module start address 128.
4-8
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 56
Table 4-5Sample allocation for a data block (DB 20)
14Control_wordWORDW#16#53 C bit = 1/parameter block 1/
NameTypeInitial
Value
²timer² operating mode
Commentary
A DB20// Open data block.
L DBW0// Load control word with C bit=0.
T PW 130// Module start address + 2
L DBW2// Load time base for timers 1 and 2.
T PW 132// Module start address + 4
L DBW4// Load time base for timers 3 and 4.
T PW 134// Module start address + 6
...
L DBW12// Load factor for timer 2.
T PW 140// Module start address + 14
L DBW14// Load control word with C bit = 1.
T PW 130// Module start address + 2
Transfer next parameter block.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-9
Page 57
ata
Communication with the CM35
D
Wait time, OB1/
OB100
When distributed connection to the SIMATIC S5 is used, a wait time must be
adhered to after an S5 CPU STOP/RUN transition, before the module is parameterized via direct I/O accesses.
The wait time depends on the PROFIBUS transmission speed set. It can be
configured in OB 100 or OB 1.
The following standard values apply
.
187.5kbit/sec®500 msec wait time
::
1.5kbit/sec®100 ms wait time
::
12kbit/sec®10 ms wait time
4-10
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 58
4.3Programming
ata
Parameterization must be correct before the channels and digital outputs can
be controlled and the actual values can be read.
With both the SIMATIC S7 and the SIMATIC S5, direct I/O accesses are always used. Only word or double--word accesses to even addresses can be
used for I/O accesses.
4.3.1Controlling the Chann els
The i ndividual channels of the CM35 can be started and stopped by writing
the control word. The control word must be written to address ²module start
address + 2.²
Communication with the CM35
D
Layout of the
control word
The control word is assigned as shown below to start and stop the channels.
Byte n
Start/stop byte
15 14 13 12 11 10 9 8 716X50403 2 1 0
Byte n+1
Coordination byte
Consistency bit (disregard)
Start/stop byte enable
Start/stop byte
Table 4-6 shows the permissible assignments of the control word.
Table 4-6Allocation of the control word for controlling the channels
To start all channels, write control word W#16#FF81.
To stop all channels, write control word W#16#0081.
4-12
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 60
4.3.2Controlling the Digital Outpu ts
The digital output s of the CM35 can be controlled by the user program, based
on the parameterization selected.
The status of the digital outputs can be specified by writing the DO pattern
(DO byte) to I/O output byte ²module start addre ss + 0.²
Table 4-7Allocation of the DO byte for controlling the digital outputs
DataCommunication with the CM35
Bit
Address
0
1
2
3
4
5
6
7
DescriptionAllocation
Digital output 10: Digital output off
Digital output 2
Digital output 3
Digital output 4
Digital output 5
Digital output 6
Digital output 7
Digital output 8
1: Digital output on
Example (S7):Set outputs 1 and 5 of the ²pulse counter² operating mode.
- Parameterize DO mode with CPU control.
- The CM35 has the module start address 256.
L2#0001_0001_0000_0000 // Load DO byte to set outputs 1 and 5
TPQW 256// Module start address = 256
Note
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
Remember that only word--accesses to even addresses are permitted.
4-13
Page 61
ata
Communication with the CM35
D
4.3.3I/O Write Accesses
When I/O write accesses (T PQW) are used, it is essential to remember that
write accesses to the same I/O addresses may overwrite each other before
being transferred to the CM35.
Example, pulse counter:
Start channel 1, then start channel 4 shortly afterwards
LW#16#0181// Start channel 1
TPQW 258// Module start address +2
:::
LW#16#0881// Start channel 4
TPQW 258// Module start address +2
If the time between the start of channel 1 and channel 4 is too short, the start
command for channel 1 may be overwritten by the start command for channel 4.
This is particularly apt to happen if you are using distributed connection of
the CM35 with low bus transmission rates. In this case, the 1st start command (channel 1) is overwritten by the 2nd start command (channel 4) before
the 1st start command can be sent to the module via PROFIBUS.
The following measures should be taken to ensure that I/O write accesses do
not compete at the same address.
S The same I/O address may only be write--accessed once during one OB1
cycle.
S When a distributed layout is used, the DP cycle should be at least twice as
fast as the CPU cycle (DP cycle and CPU cycle can be determined with
STEP 7).
4-14
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 62
4.3.4Reading the Data
The CM35 supplies the following data, based on the operating mode set.
Table 4-8Data of the CM35
DataCommunication with the CM35
Operating Mode
Pulse counterCurrent counting valueWord
Period duration measurementMeasured period durationWor d
TimerStatus of the timerByte
PositioningCurrent actual positionDWord
DataData Type
For the allocation and description of the data of the CM35, see the description of the particular operating mode.
Remember the following points which concern the assurance of data consistency based on the programmable controlle r used.
SIMATIC S7 (central or distributed)
Only one single load command (L PIW or L PID) can be used to read the
desired value.
This means that an actual value in double--word format m ust be read with
one double--word access (L PID). Use of t wo word accesses (L PIW) can
cause data inconsistency in this case.
SIMATIC S5 or standard DP master (distributed)
Only word--accesses to even addresses may be used to read--access the de-
sired value.
Table 4-9 shows an example of the address allocation for reading the counting values in ²pulse counter² mode.
Table 4-9Address allocation of the counting values for the ²pulse counter² operat-
Depending on the set operating mode and the selected parameterization, you
can specify that a hardware interrupt is to be triggered when certain events
occur. In this case, a hardware interrupt OB (OB 40) must exist on the CPU.
When a hardware interrupt occurs, the user program is inte rrupted, the data
of the module are transferred to the start information of OB 40, and OB 40 is
called. The hardware interrupt is acknowledged when OB 40 is exited.
The following local data are located in the start information of OB 40.
-- OB 40_MDL_ADDR: The base address of the module which trig-
gered the interrupt
-- OB 40_POINT_ADDR: Information on the event which triggered the
interrupt
Variable OB40_POINT_ADDR consists of four bytes. The process
interrupt information of the CM35 is entered in the low word (local data
bytes 10 and 11 of OB 40). For the allocation and description of this interrupt
information, see the description of the particular operating mode .
Communication with the CM35
For a description of OB 40, see STEP 7 reference manual /235/.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-17
Page 65
DataCommunication with the CM35
Table 4-10Hardware interrupts in the various operating modes
Local Data of OB 40Hardware Interrupts
Local data word 6Address of the module which triggered the hardware interrupt
Local data byte 10Operating Mode
Bit 0ReservedNo hardwa re inter-
Bit 1
Bit 2Timer 3 faulty
Bit 3Timer 4 faulty
Bit 4Timer 5 faulty
Bit 5Timer 6 faulty
Bit 6Timer 7 faulty
Bit 7Timer 8 faulty
Local data byte 11Operating Mode
Bit 0Counter channel 1 has re -
ached the comparison va-
Bit 1Counter channel 2 has re -
ached the comparison va-
Bit 2Counter channel 3 has re -
ached the comparison va-
Bit 3Counter channel 4 has re -
ached the comparison va-
Bit 4Counter channel 5 has re -
ached the comparison va-
Bit 5Counter channel 6 has re -
ached the comparison va-
Bit 6Counter channel 7 has re -
ached the comparison va-
Bit 7Counter channel 8 has re -
ached the comparison va-
(The function must have been activated before the interrupts are reported.)
Pulse CounterPeriod Duration
Pulse CounterPeriod Duration
lue.
lue.
lue.
lue.
lue.
lue.
lue.
lue.
Measurement
rupts are reported in
this operating mode.
Measurement
No hardware interrupts are reported in
this operating mode.
Timer for
Selective Interrupt
(for Group Interrupt)
Timer 1 faulty
(malfunction of a timer)
Timer 2 faulty
(disregard)
(disregard)
(disregard)
(disregard)
(disregard)
(disregard)
(disregard)
Timer for
Selective Interrupt
(for Group Interrupt)
Time r 1 ha s expired.
(a timer has expired)
Time r 2 ex pired
(disregard)
Time r 3 ex pired
(disregard)
Time r 4 ex pired
(disregard)
Time r 5 ex pired
(disregard)
Time r 6 ex pired
(disregard)
Time r 7 ex pired
(disregard)
Time r 8 ex pired
(disregard)
Positioning
Reserved
Positioning
Axis 1 has reached
setpoint position.
Reserved
Axis 2 has reached
setpoint position.
Reserved
Axis 3 has reached
setpoint position.
Reserved
Axis 4 has reached
setpoint position.
Reserved
4-18
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 66
ata
Communication with the CM35
D
4.4Overview of the Allocation of the Address Area and Sequence of
the Evaluation
Allocation of the
address area
Table 4-11 shows a summary of the allocation of the address area for writing
data via direct I/O accesses.
Table 4-11Allocation of the I/O address area for writing via direct I/O accesses
Offset to
Module Address
(by Word)
+0Do not write--access during parameterization.
Byte +0 (DO byte)Byte +1 (reserved)
Control digital outputs
(0=off,1=on)
XXXX XXX? Digital output 1
XXXX XX?X Digital output 2
XXXX X?XX Digital output 3
XXXX ?XXX Digital output 4
XXX? XXXX Digital output 5
XX?X XXXX Digital output 6
X?XX XXXX Digital output 7
?XXX XXXX Digital output 8
Table 4-11Allocation of the I/O address area for writing via direct I/O accesses
Module Address
(by Word)
+4 to +14
(With SFC55:
2to12)
Parameterization data
Pulse counter:Parameter blocks 1 to 3
Period duration measurement: Parameter block 1
Timer:Parameter blocks 1 to 3
Positioning:Parameter block 1 (subnumbers 0 to 4)
Parameterblock2(subnumbers1to4)
Output Area (16 Bytes)Offset to
Note:With parameterization via SFC55, the data to be transferred are set up the same as
output words 2 to 14.
Note
Only word or double--word accesses t o even addresses can be used for I/O
accesses.
4-20
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 68
Addr
Address
DataCommunication with the CM35
Table 4-12Allocation of the I/O address area when reading via direct I/O accesses
Offset to the
Module
ess
(by Word)
+0Current counting value,
+2Current counting value,
+4Current counting value,
+6Current counting value,
+8Current counting value,
+10Current counting value,
+12Current counting value,
+14Current counting value,
Pulse CounterPeriod Duration
channel 1
channel 2
channel 3
channel 4
channel 5
channel 6
channel 7
channel 8
Input Area (16 Bytes)
Operating Mode
Measurement
Measured
period duration average
value, channel 1
Measured
period duration average
value, channel 2
Measured
period duration average
value, channel 3
Measured
period duration average
value, channel 4
Measured
period duration average
value, channel 5
Measured
period duration average
value, channel 6
Measured
period duration average
value, channel 7
Measured
period duration average
value, channel 8
TimerPositioning
Status of timer:
Bit0:Channel1
Bit1:Channel2
Bit2:Channel3
Bit3:Channel4
Bit4:Channel5
Bit5:Channel6
Bit6:Channel7
Bit7:Channel8
0: Timer is active.
1: Timer has expired
and can be started again
after a STOP command.
Reserved
ReservedCurrent actual
Reserved
ReservedCurrent actual
Reserved
ReservedCurrent actual
Reserved
Current actual
position, axis 1
position, axis 2
position, axis 3
position, axis 4
Note
Only word or double--word accesses t o even addresses can be used for I/O
accesses.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
4-21
Page 69
D
ata
Communication with the CM35
Order of
evaluation
Start
Change in
DO byte?
No
Change in
coordination
byte?
No
When the CM35 recognizes that new data have been written in its address
area, the DO byte and the coordination byte are evaluated in the following
order.
Evaluate DO
byte and
Yes
Yes
Start/stop
byte
enable = 1?
No
Yes
conclude proc-
essing.
Evaluate
start/stop byte
and conclude
processing.
Conclude processing
Evaluate
Consistency
bit = 1?
No
Conclude processing
Yes
parameter block
and conclude
processing.
Note
Remember that either a change in the DO byte or a change in the coordination byte is evaluated.
4-22
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 70
Pulse Counter Operating Mode
5
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
5-1
Page 71
Pu
l
s
r
a
e CounterOpe
tingMode
5.1Function Description
In this operating mode, the CM35 counts continuously up or down within the
counting range 0 to 65535, when the counter is enabled.
-- When the counting value reaches the upper counting limit when
counting up, and an additional counting pulse occurs, the counting
value j umps to the lower counting limit and continues to count from
there without losing an impulse.
-- When the counting value reaches the lower counting limit when
counting down, and an additional counting pulse occurs, the counting
value jumps to the upper counting limit and continues to count from
there without losing an impulse.
Table 5-1Counting range
Counting Range
16 bits065535Max. of 10 kHz
Upper counting
limit
Lower counting
limit
Figure 5-1Counting up with counter started
Lower Counting
Limit
Counter status
Upper Counting
Limit
Counting
Frequency
5-2
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 72
l
s
e CounterOpe
r
a
Pu
tingMode
Starting
or stopping the
counter
Counting edge
The individual count ing channels are started and stopped by the user program. After a counting channel is started, t he encoder pulses are counted.
After a counting channel is stopped, the encoder pulses are no longer acquired.
When a counter is started, the CM35 turns on the related digital output.
When the comparison value is reached, the digital output is switched off and
a hardware interrupt is triggered.
Comparison value
0
Digital
output
Figure 5-2Switching the digital output, counting direction up
1
0
Counter start
Counter stop
The c ounting value is changed with every falling edge on the related counter
input.
Counting
value
Encoder pulses
Figure 5-3Evaluation of the encoder pulses, counting direction up
01234567888
1
0
Counter start
Counter stop
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
5-3
Page 73
l
s
e CounterOpe
r
a
Pu
tingMode
5.2Parameterization
This chapter discusses possible parameterization in ²pulse counter² operating
mode which you can use to adjust the reaction of the count ing channels to
your task.
The parameter data are divided into three parameter blocks. For the structure
of these parameter blocks, see chapter 5.2.2. The number of the parameter
block and the offset in the related structure are specified in the description of
the individual parameter data.
To be able to utilize the ²pulse counter² ope rating mode, you must transfer at
least parameter blocks 1 and 2 to the CM35.
Note
A channel must be stopped before it can be reparameterized.
-- If you want to change channel--specific parameters, this channel must
-- If you want to change parameters affecting more than one channel, all
be stopped.
channels must be stopped.
The new parameterization data take effect when the channel is started again.
For general layout and transmission of the parameter blocks, see chapter 4.2.
5.2.1Description of the Parameterization Data
Counting direction
When you specify the direction of counting, you determine the direction in
which the encoder pulses are counted.
The parameterized direction of counting applies to all channels.
Table 5-2Direction of counting
Variable:
Counting
Direction
C_Direction27.0Bool0: Counting direction, up
Parameter
Block
OffsetData
Value Range
Type
1: Counting direction,
down
5-4
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 74
l
s
e CounterOpe
r
a
Pu
tingMode
Comparison value/
start value
When you specify the counting direction, you determine how the comparison
value/start value parameter will be used.
Counting up:
The transferred value is the comparison value.The following happens when a
counter is started.
-- Counting begins with the start value ²0.²
-- The counting value is incremented with each encoder pulse.
When the counting value reaches the specified comparison value, the parameterized reactions are triggered (e.g., reset digi tal output, trigger hardware
interrupt).
Counting down:
The transferred value is the start value. The following happens when a counting procedure is started.
-- The counting value is set to the specified start value.
-- The counting value is decremented with each encoder pulse.
When the counting value reaches the comparison value ²0,² the parameterized reactions are triggered (e.g., reset digital output, trigger hardware interrupt).
The comparison value/ start value can be specified for a specific c hannel.
Table 5-3Comparison and start value
Variable:
Comparison or Start Value
(Depending on Dir ection of
Counting)
Cmp_Start_Value_Chan_112.0Wo rd0 to 65535
Cmp_Start_Value_Chan_214.0Wo rd
Cmp_Start_Value_Chan_316.0Wo rd
Cmp_Start_Value_Chan_418.0Wo rd
Cmp_Start_Value_Chan_5110.0Wo rd
Cmp_Start_Value_Chan_6112.0Wo rd
Cmp_Start_Value_Chan_722.0Wo rd
Cmp_Start_Value_Chan_824.0Wo rd
Parameter
Block
OffsetData
Type
Value
Range
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
5-5
Page 75
Pu
l
s
r
a
e CounterOpe
tingMode
Counting value
65,535
Upper counting limit
Parameterized
30,000
0
Parameterized
comparison valuestart value
Start
a) Counting upb) Counting down
StopStartStop
Figure 5-4Use of the comparison value/start value parameter, delete counting value
after stop
5-6
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 76
l
s
e CounterOpe
r
a
Pu
tingMode
Counting value
after counter stop
The ²delete counting value² variable can be used to specify which counting
value is to be indicated after stop.
Delete counting value at stop:After the count ing procedure has been
stopped,
the counting value is set to the start value.
Delete counting value at start:After the counting procedure has been
stopped,
the current counting value is retained until
the next start.
Parameterization applies to all channels.
Table 5-4Delete counting value
Variable
Delete_CountVal27.5Bool0: Delete counting value
Parameter
Block
OffsetData
Type
Value Range
at stop
1: Delete counting value
at start
Counting value
65,535
30,000 Start
value
0
Start
a) Delete counting value at stopb) Delete counting value at start
Figure 5-5Current counting value after a counter has stopped (counting down)
StopStartStop
Old
counting
value
Start
value
Counting
value
before
stop
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
5-7
Page 77
l
s
e CounterOpe
r
a
Pu
tingMode
Switching reaction
of the digital
outputs
You can choose between automatic operation and CPU control to control the
digital outputs.
DO mode
Automatic:When a counter starts, the related output
is switched on.
When the comparison value is reached,
the related output is switched off.
While counting is running, a switched on output can be
reset by the user program.
CPU control:The user program specifies the status of the outputs.
The status is not linked to the counting procedure
(e.g., for adjustment mode).
DO mode can be specified for specific channels.
Table 5-5DO mode
Variable:
DO_Mode
DO_Mode_Chan_126.0Bool0: Automatic
DO_Mode_Chan_226.1Bool
DO_Mode_Chan_326.2Bool
DO_Mode_Chan_426.3Bool
DO_Mode_Chan_526.4Bool
DO_Mode_Chan_626.5Bool
DO_Mode_Chan_726.6Bool
DO_Mode_Chan_826.7Bool
Parameter
Block
OffsetData
Type
Value Range
1: CPU control
5-8
Dribbling
Comparison
value
Start
value
Digital
output
Figure 5-6Switching of the digital outputs during automatic mode (counting up)
1
0
Stop
(4) J31069-D0416-U001-A5-7618
StartStart
CM35 Counter Module
Page 78
l
s
e CounterOpe
r
a
Pu
tingMode
Hardware
interrupts
You can use the ²interrupt generation² variable to specify whether a hardware
interrupt is to be triggered by the CM35 when the comparison value is
reached. You can use the hardware interrupt OB to evaluate which channel
has reached the comparison value.
After a counter starts, only one hardware interrupt is triggered even when the
comparison value is reached a second time.
You can use the scanning rate factor to specify that the counting value does
not change until the stated number of encoder pulses has occurred.
This increases the counting range of the encoder pulses by a multiple of the
scanning rate factor.
Evaluation of the channel--specific scanning rate factors must be enabled
with the ²scanning rate² group bit.
When a counting procedure starts, the scanning rate factor is always started
again. The remaining pulses are not carried over from the previous counting
procedure.
Counting
value
Encoder pulses
Counting pulses
Figure 5-8Generation of the counting value with a scanning rate factor of 3
1
0
(counting up)
0011110011
Counter start
Counter startCounter stop
Enabling of a scanning rate factor applies to all channels.
Table 5-7Scanning rate
Variable
Scanning
Rate
Parameter
Block
27.7Bool0: Scanning rate not enabled
OffsetData
Type
Value Range
1: Scanning rate enabled
The scanning rate factor can be specified for each channel.
If you specify ²0² or ²1,² the channel does not use the scanning rate.
Table 5-8Scanning rate factor
Variable:
Scanning Rate Factor
ScanRate_F_Chan_128.0Byte0to255
ScanRate_F_Chan_229.0Byte
ScanRate_F_Chan_3210.0Byte
ScanRate_F_Chan_4211.0Byte
ScanRate_F_Chan_5212.0Byte
ScanRate_F_Chan_6213.0Byte
ScanRate_F_Chan_732.0Byte
ScanRate_F_Chan_833.0Byte
Parameter
Block
OffsetData
Type
Value Range
5-10
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 80
5.2.2Structure of the Parameter Blocks
l
s
r
a
Tables 5-9, 5-10 and 5-11 show the data structures of the three parameter
blocks as they must be transferred with SFC55 calls to the CM35.
The first word of the parameter blocks contains the control word. The required assignment is entered as the initial value in the structures.
For transmission of the data, see chapter 4.2.
Parameter block 1 contains:
S The comparison or start values for channels 1 to 6
After the module has been parameterized, you can start and stop the individual counting channels of the CM35. To do this, write the start/stop block to
the address ²module start address + 2.²
Table 5-12 shows the contents of the start/stop block. The required assignment of the coordination byte is entered as the initial value in the structure.
For a description of the bit assignment of the coordination byte, see chapter
4.3.1.
Write--accesses to the start/stop block must be programmed as word-accesses.
In DO mode ²automatic,² the related output is switched on when a channel
starts. The output is switched off with stop even when the comparison value
has not yet been reached.
5-14
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 84
5.4Controlling the Digital Outp uts
l
s
r
a
You can control the digital outputs of the CM35 as shown bel ow, based on
the parameterization of DO mode.
DO mode:
Automatic:Note:
A parameterization bit can be used to specify whether
the DO byte is to control the enable
or whether the enable is continuous.
Enable mode = ²²²²Enable control via DO byte²²²²
The DO byte is used to enable the out put for
control via the counter status.
0: Output disabled
-- The output is not switched on with the start of
counting.
-- A switched on output is forcibly switched off.
1: Output enabled
-- The output is switched on at start of counting.
-- The output is switched off when the comparison
value i s reached or counting is stopped.
Pu
e CounterOpe
tingMode
Enable mode = ²²²²continuous enable²²²²
Control via the counter status is continuously enabled for
the outputs. A switched on output can be forcibly switched
off with the DO byte.
0: A switched on output is forcibly switched
off.
(The forced switch--off only affects the current
counting procedure.)
1: No effect
CPU control:You specify the state of the output with the DO
byte.
0: Switch off output
1: Switch on out put
Write the DO byte to t he address ²module start address + 0.²
Note
Control of the digital outputs must be programmed with a word access.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
5-15
Page 85
g
p
D
Omod
²²²²
t
i
²²²²
g
p
Note:
p
y
w
tospecifywhetherenablingistob
e
whethercontinuousenableistobe
l
s
e CounterOpe
r
a
Pu
tingMode
Table 5-13 shows the assignment of the bits of the DO byte to the counting
channels.
hether enablingis to be
controlled with the DO byte or
hhrnin
used.
nli
Example (S7): Set outputs 1 and 5
- Parameterize DO mode with CPU control
- The CM35 has the module start address 256.
L2#0001_0001_0000_0000 // Load DO byte to set outputs
1 and 5
²²²²
c
:
TPQW 256// Module start address = 256
5-16
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 86
5.5Hardware Interrupt Evaluation
l
s
r
a
When in ²pulse counter² mode, the CM35 can trigger a hardware interrupt
when a comparison value is reached. If this is used, the CPU must contain a
hardware interrupt OB (OB 40).
The start information of OB 40 contains the following information.
-- The variable OB40_MDL_ADDR contains the base address of the
module which triggered the interrupt.
-- The variable OB40_POINT_ADDR contains information on the event
which caused the interrupt.
The variable OB40_POINT_ADDR consists of four bytes. The hardware interrupt information of the CM35 in ²pulse counter² mode is entered in the
low byte (local byte 11 of OB 40).
By evaluating local byte 11, you can determine which channel triggered the
interrupt. Remember that more than one bit can be set.
Table 5-14Assignment of the hardware interrupt information (OB 40/local byte 11)
Pu
e CounterOpe
tingMode
Local Byte
110Counter 1 has reached comparison value.0/1
BitMeaningValue Range
1Counter 2 has reached comparison value.
2Counter 3 has reached comparison value.
3Counter 4 has reached comparison value.
4Counter 5 has reached comparison value.
5Counter 6 has reached comparison value.
6Counter 7 has reached comparison value.
7Counter 8 has reached comparison value.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
5-17
Page 87
l
s
e CounterOpe
r
a
Pu
tingMode
5.6Reading the Counting Values
In ²pulse counter² mode, you can read the current counting values from the
CM35.
To ensure data consistency, the read--access must be performed with one load
command (L PIW).
Table 5-15 shows the addresses of the individual channels for reading the
counting value.
Table 5-15Assignment of the output area for reading the counting values
Offset to the
Module Start Address
+0Counting value,
+2Counting value,
+4Counting value,
+6Counting value,
+8Counting value,
+10Counting value,
+12Counting value,
+14Counting value,
MeaningValue Range
channel 1
channel 2
channel 3
channel 4
channel 5
channel 6
channel 7
channel 8
Example:²Pulse counter² mode
- Read counting value of counting channel 4
- The CM35 has the module start address 256.
0 to 65535
LPIW 262// Address = 256 + 6, counting value of
channel 4
TMW16// Save the counting value
5-18
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 88
Period Duration Measurement Operating
Mode
6
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
6-1
Page 89
Pe
r
r
a
a
sur
r
a
iod Du
tion Me
ement Ope
6.1Function Description
In this operating mode, the CM35 uses period duration measurement to acquire small frequenci es.
The CM35 measures the e xact time between two falling edges of the counting signal by counting the pulses of an internal precision-quartz reference
frequency. The period duration of the input signal is calculated from the
counting value afte r a period, divided by the reference frequency (in kHz).
Example:
-- Counting value = 100
-- Reference frequency = 100 kHz (standard value)
tingMode
100
= 1 msec ( 1 kHz)
100 kHz
Þ Period duration = 1 msec or frequency = 1 kHz
Measuring range
At a measuring value width of 16 bits and a reference frequency of 100 kHz,
period duration measurements between 655 msec (counting value 65500) and
1 msec (counting value 100) can be performed with a resolution of 1% without switching the range.
Note
The resolution depends on the lower counting value (i.e., the minimum
period duration).
The reference frequency can be adjusted for measurement of longer period
durations. The following table shows the reference frequencies and the resulting measuring range.
Table 6-1Measuring ranges
Counting
Range
16 bits10065500100 kHz655 msec to 1 msec
Lower
Counting
Value
Upper
Counting
Value
Reference FrequencyMeasuring Range
(1.53 Hz to 1 kHz)
50 kHz1,310 msec to 2 msec
(0.76Hzto500Hz)
25 kHz2,620 msec to 4 msec
(0.38Hzto250Hz)
6-2
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 90
Pe
r
r
a
a
sur
r
a
iod Du
tion Me
ement Ope
tingMode
Period number
Starting and stopping measurement
To eliminate inaccurate measurements, you can also perform the measurement over several periods of the input signal (1 to 40).
An average value can be calculated at the end of the measuring interval.
Measuring interval
1st meas.2nd meas.3rd meas.1st meas.
Input
signal
Reference
signal
Figure 6-1Principle of period duration measurement over 3 periods of the input signal
Start
The user program starts the individual channels. After a channel is started,
the period duration is acquired based on the parameterization. The channel
must be stopped before a new measurement can be made .
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
6-3
Page 91
Pe
r
r
a
a
sur
r
a
iod Du
tion Me
ement Ope
6.2Parameterization
This chapter shows you available parameterizations in ²period duration measurement² mode which you can use to adj ust the reaction of the measuring
channels to your task.
The parameter data are located in a parameter block. For the structure of the
parameter block, see chapter 6.2.2. The description of the individual parameter data include s the number of the paramet er block and the offset in the
structure.
You must transfer parameter block 1 to the CM35 before you can use ²period
duration measurement² mode.
Note
The channel must be stopped before it can be reparameterized.
You must stop the channel before you can change the channel--specific parameters.
tingMode
The new parameters take effect the next time the channel is started.
For a description of the general layout and the transmission of the parameter
block, see chapter 4.2.
6-4
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 92
Pe
r
r
a
a
sur
r
a
iod Du
6.2.1Description of the Parameter Data
tion Me
ement Ope
tingMode
Period number
Measuring range
When you specify the number of periods, you determine the number of periods of the input signal during which the measurement is to be performed.
You can specify the number of periods for each channel separately.
Table 6-2Setting of the number of periods
Variable:
Number of Periods
PeriodNumber_Chan_112.0Byte1to40
PeriodNumber_Chan_213.0Byte
PeriodNumber_Chan_314.0Byte
PeriodNumber_Chan_415.0Byte
PeriodNumber_Chan_516.0Byte
PeriodNumber_Chan_617.0Byte
PeriodNumber_Chan_718.0Byte
PeriodNumber_Chan_819.0Byte
Parameter
Block
OffsetData TypeValue Range
By selecting the measuring range, you can al so increase the period duration
which is measured.
The parameterized measuring range applies to all channels.
Table 6-3Setting the reference frequency
Variable:
Measuring Range
F_RefFrequency110.0Byte0h: 100 kHz (standard)
Parameter
Block
OffsetData
Type
Value Range
(655 msec to 1 msec)
77h: 50 kHz
(1310 msec
to2msec)
EFh: 25 kHz
(2620 msec
to4msec)
Note
A change in the F_RefFrequency parameter only takes effect with the first
parameter transfer a fter a warm restart (power on).
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
6-5
Page 93
Period Du
r
a
a
sur
r
a
tion Me
ement Ope
tingMode
6.2.2Structure of the Parameter Block
Table 6-4 shows the data structure of the parameter block and how to transfer
it to the CM35 using SFC 55 calls or I/O direct accesses.
The first word of the parameter block contains the control word. The structure shows the required assignment as an initial value.
When I/O direct accesses are parameterized (only possible with the
SIMATIC S5), the acceptance structure must be transferred after the data
structure. See table 6-5. The table shows the required assignment of the acceptance structure as an initial value.
Adhere to the specifications in chapter 4.2 which apply to transmission of the
data.
Parameter block 1 contains the following information.
-- The period numbers for channels 1 to 8
-- The factor for reference frequency (measuring range)
After parameterizing the module, you can start and stop the indivi dual measuring channels of the CM35. To do this, write the start/stop block to address
²module start address + 2.²
Table 6-6 shows the contents of the start/stop block. The required assignment of the coordination byte is entered as an initial value in the structure.
For a description of the bit assignment of the coordination byte, see chapter
Since no function is assigned to the digital outputs in ²period duration measurement² mode, they c an be used as desired.
The DO byte is used to specify the state of the digital outputs.
0: Switch off output
1: Switch on output
The m odule firmware switches off the outputs during the transition of the
CPU to the STOP state (BASF/OD signal)
Write the DO byte to address ²module start address
+0.²
Table 6-7 shows the assignment of the bits of the DO byte to the measuring
channels.
Note
Control of the digital outputs must be programmed with a word access.
.
Table 6-7Assignment of the DO byte
Address
+0.0Digital_Output_Chan_1BOOLFAL SE
+0.1Digital_Output_Chan_2BOOLFAL SE
+0.2Digital_Output_Chan_3BOOLFAL SE
+0.3Digital_Output_Chan_4BOOLFAL SE
+0.4Digital_Output_Chan_5BOOLFAL SE
+0.5Digital_Output_Chan_6BOOLFAL SE
+0.6Digital_Output_Chan_7BOOLFAL SE
+0.7Digital_Output_Chan_8BOOLFAL SE
+1.0Res_1BYTEB#16#0In reserve
=2.0END_STRUCT
NameTypeInitial ValueCo mmentary
DO_BlockSTRUCT
0: Digital output off
Example (S7):Set outputs 1, 3 and 5
-- The CM35 has the module start addre ss 256.
L2#0001_0101_0000_0000 // Load DO byte to set outputs
1, 3 and 5
output on
TPQW 256// Module start address = 256
6-8
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 96
6.5Hardware Interrupt Evaluation
r
a
a
sur
r
a
Hardware interrupts are not generated in ²period duration measurement²
.
mode
Period Du
tion Me
ement Ope
tingMode
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
6-9
Page 97
Pe
r
r
a
a
sur
r
a
iod Du
tion Me
ement Ope
tingMode
6.6Reading the Measured Values
You can read the current measuring values of the CM35 in ²period duration
measurement² mode.
To ensure data consistency, the read access must be performed with one load
command (L PIW).
When an overflow occurs, the hex value FFFDH (65533) is transferred (frequency below the minimum frequency, encoder interrupted, and so on).
Measuring channels which have not yet been started are transferred with the
value 0000H regardless of whether or not pulses are present on the input.
Table 6-8 shows the addresses of the individual channels for reading the measured value.
Table 6-8Assignment of the output area for reading the measured values
Offset to the
Module Start Address
+0Period duration average value, chan. 10 to 65532
+2Period duration average value, chan. 2
+4Period duration average value, chan. 3
+6Period duration average value, chan. 4
+8Period duration average value, chan. 5
+10Period duration average value, chan. 6
+12Period duration average value, chan. 7
+14Period duration average value, chan. 8
MeaningValue Range
Example:²Period duration measurement² mode
-- Read the measured value of channel 2
-- The CM35 has the module start addre ss 256.
LPIW 258// Address = 256 + 2, measured value
channel 2
TMW16// Save the counting value
6-10
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 98
Timer Operating Mode
7
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
7-1
Page 99
Time
rOper
a
tingMode
7.1Function Description
Timer mode can be used to implement precisely defined switch--on times for
the 8 digital outputs of the counter module.
Switch--on times
Start and stop
timers
Controlling the
outputs
Times from 10 milliseconds to 278 minutes can be specified seperately for
the switch--on times.
The timers are started by the user program, thus setting the related digital
outputs.
If no parameter values for time base and factor are available when a timer is
started, these values are processed with 1 as the default value.
The related digital output is switched off after the parameterized time
expires.
A started timer can be terminated by transferring the control word with a ²0²
for the applicable channel in the start/stop byte. This resets the digital output
and the internal counter.
The end of the switch--on time is indicated by a hardware interrupt. This can
be acquired by the user program to trigger additional processing (e.g., to
position the next container in proportioning systems/filling systems).
A timer must be stopped before the user program can execute a new start.
This can be done after the ²timer expired² hardware interrupt or after a time
calculate d by t he user program which is with certainty longer than the run
time of the timer.
The digital outputs of the timer can also be controlled by writing the DO byte
(e.g., for continuous switch--on during washing procedures). The user program must ensure that the timer channels cannot be manipulated
(see chapter 7.4).
Monitoring the
outputs
7-2
The module can monitor the switching status of its outputs. To do this, the
digital outputs must be wired to the digital inputs. The firmware cyclically
compares the status of the digital outputs with the status of the digital inputs
and generates a hardware interrupt when required by the parameterization
(e.g., timer failure). The interrupt can be output as a group interrupt or as a
selective interrupt (i.e., channel--specific).
(4) J31069-D0416-U001-A5-7618
CM35 Counter Module
Page 100
7.2Parameterization
rOper
a
This chapter describes possible parameterization in timer mode which you
can use to adapt timer reactions to your task.
The parameter data are divided into three parameter blocks. For the structure
of the parameter blocks, see chapter 7.2.2. The descriptions of the individual
parameter data include the number of the parameter block and the offset in
the related structure.
To be able to utilize ²timer² operating mode, you must transfer parameter
blocks 1, 2 and 3 to the CM35.
Note
The timer must be stopped before it can be reparameterized.
-- When you want to change timer--specific parameters, you must stop
-- When you want to change timer--overlapping parameters, you must
the applicable timer.
stop all timers.
Time
tingMode
The new parameter data take effect when the timer is started again.
For a description of the general layout and transfer of the parameter blocks,
see chapter 4.2.
CM35 Counter Module
(4) J31069-D0416-U001-A5-7618
7-3
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.