5.6.3 Proceeding
In the Siemens SIMATIC Manager the following steps should be executed:
1.
Perform a hardware configuration for the CPU.
Chapter 4.4 ‘Hardware configura-
2.
Double-click the counter sub module of the CPU 314C-2 PN/DP.
ð
The dialog
‘Properties’
is opened.
3.
As soon as you select the operating mode for the corresponding channel, a dialog
box with default values for this counter mode is created and shown.
5.6.6 ‘Counter operating modes’ on page 115
4.
Perform the required parameter settings.
5.
Safe your project with
‘Station
è
Safe and compile’
.
6.
Transfer your project to your CPU.
You must not call an SFB you have configured in your program in another
program section under another priority class, because the SFB must not
interrupt itself. Example: It is not allowed to call the same SFB both in OB
1 and in the interrupt OB.
n
The
Chapter 5.6.4 ‘SFB 47 - COUNT - Counter controlling’ on page 105
should
cyclically be called (e.g. OB 1) for controlling the counter functions.
n
The SFB is to be called with the corresponding instance DB. Here the parameters of
the SFB are stored.
n
Chapter 5.6.4 ‘SFB 47 - COUNT - Counter controlling’
contains a request interface. Hereby you get read and write access to
the registers of the appropriate counter.
n
So that a new job may be executed, the previous job must have be finished with
JOB_DONE = TRUE.
n
Per channel you may call the SFB in each case with the same instance DB, since the
data necessary for the internal operational are stored here.
n
Writing accesses to outputs of the instance DB is not permissible.
n
Starting, stopping and interrupting a count function of
Counter 0
to
Counter 2
exclu-
sively happens via the SW gate by setting the SW gate of
COUNT - Counter controlling’ on page 105
.
You can also activate input
‘Gate 3’
via the parametrization for
Counter 3
.
5.6.4 SFB 47 - COUNT - Counter controlling
The SFB 47 is a specially developed block for compact CPUs for controlling of the coun-
ters. The SFB is to be called with the corresponding instance DB. Here the parameters of
the SFB are stored. With the SFB COUNT (SFB 47) you have following functional
options:
n
Start/Stop the counter via software gate
SW_GATE
n
Enable/control digital output DO
n
Read the status bit
n
Read the actual count and latch value
n
Request to read/write internal counter registers
Hardware configuration
User program
Description
VIPA System SLIO
Deployment I/O periphery
Counting > SFB 47 - COUNT - Counter controlling
HB300 | CPU | 013-CCF0R00 | en | 16-40
105