101BExtended instructions
8.4 Interrupts
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
275
Check box options within the PLC device configuration:
●
Digital input
–
Enable rising edge detection
–
Enable falling edge detection
●
High-speed counter (HSC)
–
Enable this high-speed counter for use
–
Generate interrupt for counter value equals reference value count
–
Generate interrupt for external reset event
–
Generate interrupt for direction change event
Adding new hardware interrupt OB code blocks to your program
By default, no OB is attached to an event when the event is first enabled. This is indicated by
the "HW interrupt:" device configuration "<not connected>" label. Only hardware-interrupt
OBs can be attached to a hardware interrupt event. All existing hardware-interrupt OBs
appear in the "HW interrupt:" drop-down list. If no OB is listed, then you must create an OB
of type "Hardware interrupt" as follows. Under the project tree "Program blocks" branch:
1.
Double-click "Add new block", select "Organization block (OB)" and choose "Hardware
interrupt".
2.
Optionally, you can rename the OB, select the programming language (LAD or FBD), and
select the block number (switch to manual and choose a different block number than that
suggested).
3.
Edit the OB and add the programmed reaction that you want to execute when the event
occurs. You can call FCs and FBs from this OB, to a nesting depth of four.
OB_NR parameter
All existing hardware-interrupt OB names appear in the device configuration "HW interrupt:"
drop-down list and in the ATTACH / DETACH parameter OB_NR drop-list.
EVENT parameter
When a hardware interrupt event is enabled, a unique default event name is assigned to this
particular event. You can change this event name by editing the "Event name:" edit box, but
it must be a unique name. These event names become tag names in the "Constants" tag
table, and appear on the EVENT parameter drop-down list for the ATTACH and DETACH
instruction boxes. The value of the tag is an internal number used to identify the event.
General operation
Each hardware event can be attached to a hardware-interrupt OB which will be queued for
execution when the hardware interrupt event occurs. The OB-event attachment can occur at
configuration time or at run time.