Siemens SIMATIC S7-200 System Manual page 170

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual
There are a number of programming techniques you can use to ensure that data is correctly
shared between your main program and interrupt routines. These techniques either restrict the
way access is made to shared memory locations or prevent interruption of instruction sequences
using shared memory locations.
For an STL program that is sharing a single variable: If the shared data is a single byte,
-
word, or double word variable and your program is written in STL, then correct shared
access can be ensured by storing the intermediate values from operations on shared data
only in non-shared memory locations or accumulators.
For a LAD program that is sharing a single variable: If the shared data is a single byte,
-
word, or double word variable and your program is written in LAD, then correct shared
access can be ensured by establishing the convention that access to shared memory
locations be made using only Move instructions (MOVB, MOVW, MOVD, MOVR). While
many LAD instructions are composed of interruptible sequences of STL instructions, these
Move instructions are composed of a single STL instruction whose execution cannot be
affected by interrupt events.
For an STL or LAD program that is sharing multiple variables: If the shared data is
-
composed of a number of related bytes, words, or double words, then the interrupt
disable/enable instructions (DISI and ENI) can be used to control interrupt routine
execution. At the point in your main program where operations on shared memory locations
are to begin, disable the interrupts. Once all actions affecting the shared locations are
complete, re-enable the interrupts. During the time that interrupts are disabled, interrupt
routines cannot be executed and therefore cannot access shared memory locations;
however, this approach can result in delayed response to interrupt events.
Calling Subroutines from Interrupt Routines
You can call one nesting level of subroutines from an interrupt routine. The accumulators and the
logic stack are shared between an interrupt routine and a subroutine that is called.
Types of Interrupts Supported by the S7-200
The S7-200 supports the following types of interrupt routines:
Communications port interrupts: The S7-200 generates events that allow your program to
-
control the communications port.
I/O interrupts: The S7-200 generates events for different changes of state for various I/O.
-
These events allow your program to respond to the high-speed counters, the pulse outputs,
or to rising or falling states of the inputs.
Time-based interrupts: The S7-200 generates events that allow your program to react at
-
specific intervals.
Communications Port Interrupts
The serial communications port of the S7-200 can be controlled by your program. This mode of
operating the communications port is called Freeport mode. In Freeport mode, your program
defines the baud rate, bits per character, parity, and protocol. The Receive and Transmit interrupts
are available to facilitate your program-controlled communications. Refer to the Transmit and
Receive instructions for more information.
I/O Interrupts
I/O interrupts include rising/falling edge interrupts, high-speed counter interrupts, and pulse train
output interrupts. The S7-200 can generate an interrupt on rising and/or falling edges of an input
(either I0.0, I0.1, I0.2, or I0.3). The rising edge and the falling edge events can be captured for
each of these input points. These rising/falling edge events can be used to signify a condition that
must receive immediate attention when the event happens.
The high-speed counter interrupts allow you to respond to conditions such as the current value
reaching the preset value, a change in counting direction that might correspond to a reversal in
the direction in which a shaft is turning, or an external reset of the counter. Each of these
high-speed counter events allows action to be taken in real time in response to high-speed events
that cannot be controlled at programmable logic controller scan speeds.
156

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents