Specifications

C-14
IP 240
EWA 4NEB 811 6120-02b
C.6 Programming Example for “Counting” Mode
Prerequisites, Settings, Blocks and Addresses
The programming example describes the standard functions for operating the
IP 240 counter, position decoding and positioner module in “Counting”
mode.
Objectives of the programming example:
The example should show the most important functions in exemplary
form.
It should enable testing of the hardware (such as sensors) for functionabil-
ity.
The example is therefore simple and easy to follow.
And it can be expanded if desired without a great deal of overhead.
The example shows how to parameterize the module at start-up, the count
process with software and hardware gates, how to transfer a new count start-
ing value, and how an interrupt is generated at zero crossing.
The example can be implemented with only a minimum hardware comple-
ment (1 byte for inputs, 1 byte for outputs). Essentially, it uses the functions
“Monitor/Modify variable”.
The devices listed below are only some of those which can be used to try out
the sample program:
An S7–400 programmable controller system (rack, power supply unit,
CPU)
An adapter casing
An IP 240 module with suitable sensor
One digital input and one digital output module
A programming device (such as a PG 740)
It is possible to do without both the digital input module and the digital out-
put module when all functions are executed with “Monitor/Modify variable”.
This would require changes in organization block OB 1.
As sensors for the IP 240 module, one contact is connected to the CLK termi-
nal as the count contact, and one to the GT terminal as the gate contact.
The module must have a voltage supply of 24 V (X6 connector)
You must set the addresses for the adapter casing via STEP 7 (hardware con-
figuration). In the example, the following I/O settings have been assumed:
S7 address: 512,
S5 address: 0 (I/O area: P)
Length: 16 bytes,
Process image
subtable: 0.
Overview
Device Configura-
tion
Settings in the
CPU
IP 240 Counter, Position Decoder and Positioning Module