Fkey instruction summary, Interrupts, Interrupts step by step – Rockwell Automation 1398-PDM-xxx IQ Master Version 3.2.4 for IA-2000 and IQ-5000 Positioning Drive Modules, IQ-55 User Manual
Page 173: Example, Interrupt variable, flags and instructions summary

IQ Programming Structure • Interrupts
151
Publication 1398-PM601A-EN-P — October 2000
TUTORIAL
gram is executing. Fkey programs are defined separately and can execute without application programs
running.
Fkey Instruction Summary
The following table contains a summary of instructions that relate to Fkeys. Refer to Part 5
•
Reference for more detailed information.
Interrupts
Interrupts are used to perform a specific task quickly in response to an event. The ULTRA Plus or IQ
has four events that may trigger an interrupt. They are: an index pulse on encoder 1 or encoder 2, or
input 11 or input 12 turning ON.
When any of these interrupts occur, the action taken is identical. The position of encoder 1 and encoder
2 are captured and saved in designated system variables, and flags are set to indicate that the interrupt
has occurred and the positions are saved.
Interrupts are most frequently used when position information needs to be gathered while the axis is in
motion, or when the relative position of encoder 1 and encoder 2 is required. This would be typical of an
application requiring the motor to be synchronized to an encoder attached to some mechanism.
Interrupts Step by Step
The steps required to use an interrupt are the same, regardless of the type of interrupt. They are:
•
clear the flag which indicates that the interrupt has occurred (the flag is not automatically cleared
after the interrupt occurs),
•
enable the interrupt,
•
test the flag to detect when the interrupt occurred,
•
read the appropriate system variable.
Example:
FI1 = OFF
;Clear the interrupt flag
INT1 ON
;Enable input interrupt 1
…
Statements
;find the difference in counts between encoder 1 and encoder 2 when the
;interrupt occurred.
IF FI1 = ON V1 = @I1P1 - @I1P2
Interrupt Variable, flags and Instructions Summary
The following is a summary of the instructions, variables and flags that relate to interrupts discussed in
Name
Description
FNACTIVE
ON if an Fkey is pressed, OFF otherwise
FNPGM
Starts an Fkey program
PRINT can be used to set and change Fkey modes
Note: The index interrupt for the 2nd encoder may not detect the index if the duration is less than 2
ms.