Siemens Simatic S7-200 System Manual page 170

Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual
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
6
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.
The pulse train output interrupts provide immediate notification of completion of outputting the prescribed
number of pulses. A typical use of pulse train outputs is stepper motor control.
You can enable each of the above interrupts by attaching an interrupt routine to the related I/O event.
Time-Based Interrupts
Time-based interrupts include timed interrupts and the timer T32/T96 interrupts. You can specify actions to
be taken on a cyclic basis using a timed interrupt. The cycle time is set in 1-ms increments from 1 ms to
255 ms. You must write the cycle time in SMB34 for timed interrupt 0, and in SMB35 for timed interrupt 1.
The timed interrupt event transfers control to the appropriate interrupt routine each time the timer expires.
Typically, you use timed interrupts to control the sampling of analog inputs or to execute a PID loop at
regular intervals.
A timed interrupt is enabled and timing begins when you attach an interrupt routine to a timed interrupt
event. During the attachment, the system captures the cycle time value, so subsequent changes to
SMB34 and SMB35 do not affect the cycle time. To change the cycle time, you must modify the cycle time
value, and then re-attach the interrupt routine to the timed interrupt event. When the re-attachment occurs,
the timed interrupt function clears any accumulated time from the previous attachment and begins timing
with the new value.
158

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents