What can I use in
In any of the above methods, Interrupt
the Interrupt
subroutines are required. These subroutines
routines?
are placed after the END statement, which is
the last line in the main program.
You can use most any type of instruction
in the subroutines. You can have math
instructions,
instructions, etc. However, most people
find that the Immediate instructions and
the FOR/NEXT looping instructions are
the most useful. Immediate instructions
immediately read the status of inputs
and/or immediately update the outputs.
By using the immediate instructions in the
subroutine, the CPU can read input
points
immediately. By using the FOR/NEXT
instructions, you can literally have a
"mini-scan" by creating a loop inside of
the subroutine.
NOTE: You can use many different types of instructions in the interrupt subroutines.
However, if you use instructions with long execution times, such as some math
instructions, FOR/NEXT loops, etc., then you may exceed the Watchdog Timer limit.
The Watchdog Timer is set at 200ms from the factory. It can be changed with the
handheld programmer or Direct SOFT. You can also use a RSTWT instruction inside
of the subroutine to reset the Watchdog Timer.
When can the
The previous diagrams showed a simplified CPU scan cycle. However, the CPU can
Interrupts Occur?
process the interrupts during any portion of the scan cycle. Interrupts can occur in
the middle of the communications service, input update, output update, etc. So, this
helps ensure the fastest possible response for critical events.
The CPU does not perform any other functions when it is executing the interrupt
subroutine. For example, the CPU will not acknowledge any communication
requests until it has finished with the interrupt subroutine. Some devices, such as an
operator interface, may issue a communications timeout error due to the delay in the
response from the CPU. If this occurs, check your device documentation for
procedures on changing the communications timeout error settings.
Now that you understand how the CPU processes the Interrupts, you're ready to
install (and use) the D4–INT Interrupt module.
data
manipulation
or
update
output
(Main Program)
(Loops 3 times before
INT
O 1
returning to program)
X20
X21
X22
X23
points
INT
O 2
X40
7 7
7
END
K3
1
2
3
FOR
Y5
OUTI
Y6
OUTI
Y7
OUTI
NEXT
IRT
Y20
OUTI
Need help?
Do you have a question about the DL405 and is the answer not in the manual?
Questions and answers