Instructions: Events can occur in the current process which require responses which are quicker than are possible in the current program cycle. Events also occur which do not last long enough to be identified in the current program cycle. Therefore, there is hardware interrupt processing in SIMATIC S7-400 controllers.
Together with:
- analog input modules (AI),
- digital input modules (DI) and
- function modules (FM)
with hardware interrupt capability, a program which is adapted to suit the event can be called in real time.
Hardware interrupts approximate to interrupts.
This entry is intended to serve as a guide to hardware interrupts in S7-400 CPUs.
General:
If an alarm-triggering event occurs during program processing, the operating system calls the assigned alarm OB, interrupting the processing of the program cycle or lower-priority program blocks. The alarm-triggering event (or events (multiple bits can be set)) is/are specified more precisely via the alarm OB's temporary local data. The temporary local data can be evaluated by the user program in the alarm OB.
If there is no alarm OB in the CPU when an alarm-triggering event occurs, the CPU goes into STOP mode.
Hardware interrupt-triggering events in the different modules:
Analog input modules: A value can be monitored in analog input modules with hardware interrupt capability. The hardware interrupt can be configured to be triggered off if values drop below or rise above specified thresholds. More information about the individual analog input modules is available in the manual "Programmable Logic Controller S7-400 Module Data" in Entry ID 1117740 in chapter 5.
Digital input modules: Individual bits can be monitored in digital input modules with hardware interrupt capability. The hardware interrupt can be configured to be triggered off in the event of a negative and/or positive edge to the bit. More information about the individual digital input modules is available in the manual "Programmable Logic Controller S7-400 Module Data" in Entry ID: 1117740 in chapter 4.
Function modules: Since function modules with hardware interrupt capability perform a wide range of different tasks, allowing the hardware interrupts to be configured for different events, it is advisable to consider the FM 450-1 counter module by way of an example.
The FM 450-1 enables a hardware interrupt to be triggered off in the CPU whenever comparison values are reached, or in the event of an over-run or under-run and/or if the counter passes through zero. More information about the FM 450-1 module is available in the manual "FM 450-1 Counter Module - Setup and Configuration" in Entry ID: 1118412. More information about the other function modules is available in the module-specific documentation.
Warning:
Many function modules require special parameterization software which is supplied with the function module with the corresponding documentation. Hardware interrupt-triggering events can only be configured together with STEP 7 and the parameterization software.
(Communication modules): There is no way of configuring hardware interrupt-triggering events in the communication modules themselves. However, the communication modules can forward hardware interrupts from modules with hardware interrupt capability to the CPU. Example:
You can install a CP 443-5 Ext (6GK7 443-5DX01-0XE0) in your CPU's subrack. You can configure the CP 443-5 Ext as the master and link an IM 153-1 (6ES7 153-1AA02-0XB0) to it. You can then install a module with hardware interrupt capability into the IM 153-1 (see Fig. 01). If a hardware interrupt then occurs in this module, the assigned alarm OB is called by the CPU.

Fig. 01
Alarm OBs in the SIMATIC S7-400: SIMATIC S7-400 CPUs contain the alarm OBs 40 to 47. Each module can be assigned to the required alarm OB in the HW Config (Module object properties > Addresses > Hardware interrupt activated:) . Temporary local data is made available in each alarm OB. The channel/bit where the hardware interrupt event occurred is specified through this temporary local data.
You can find the description of the alarm OBs in STEP 7 whenever you create a new alarm OB in the CPU's block folder (right click > Insert new object > Organization block > OB[40...47]), select the newly created OB and then press "F1". This opens the S7 Help for the alarm OBs. Needless to say, if there is an alarm OB already present, you can select an alarm OB straight away and then press "F1".
More information about the module-specific evaluation of the local data is available in the manual "Programmable Logic Controller S7-400 Module Data" in Entry ID: 1117740 Chapter 4 (Digital Modules) and Chapter 5 (Analog Modules) or in the special manuals relating to the function modules.
There are 2 alarm OBs (40 and 41) in the CPU 318-2DP. All other S7-300 CPUs only possess the alarm OB 40.
More information about hardware interrupts for S7-300 is available in Entry ID: 23657941
Configuring a hardware interrupt: Hardware interrupts can be configured in the hardware configuration under the properties for the modules with alarm capability.
You can find an example of how to calculate the alarm response time for the S7-400 in the manual "Programmable Logic Controller S7-400 CPU Data" in Entry ID: 14016796 section 5.8 ff.
The modules with hardware interrupt capability can also be configured during an ongoing program cycle by means of system functions SFC 55 (WR_PARM), SFC 56 (WR_DPARM) and SFC57 (PARM_MOD). You can find out how to configure the corresponding data records with the system functions in the manual "Programmable Logic Controller S7-400 Module Data" in Entry ID: 1117740.
Information about the different SFCs is available in the S7 Online Help and in the manual "System Software for S7-300/400 System and Standard Functions" in Entry ID: 1214574 in section 7.1.
Warning:
System functions SFC 55, SFC56 and SFC 57 cannot be used with PROFINET IO.
Blocking, delaying, releasing hardware interrupts:
Hardware interrupts can be blocked, delayed and released again by means of system functions SFC 39 (DIS_IRT IRT_FUNC), SFC 40 (EN_IRT IRT_FUNC), SFC 41 (DIS_AIRT IRT_FUNC) and SFC 42 (EN_AIRT IRT_FUNC).
Information about the different SFCs is available in the S7 Online Help and in the manual "System Software for S7-300/400 System and Standard Functions" in Entry ID: 1214574 in chapter 12.
|