Interrupt example, Interrupt, Example – Yaskawa FSP Amplifier FlexWorks User Manual
Page 95

Operating the FSP Amplifier Using FlexWorks
95
4.11.8. Interrupt
Example
The following example program illustrates the use of interrupts.
1. SET_VAR Interrupt_mask 3
Activates Interrupt 0
and 1.
2. LABEL 2
3. SET_OUTPUT 1 OFF
Sets Output 1 value to 0.
4. WAIT_INPUT 1 = 1 -1 Waits for In 1 to become
True
5. CONTROL ON
Starts the servo
6. MOVE_D 655360 -1
Moves motor 655360 UU at
profile speed.
7. SET_OUTPUT 1 OFF
Sets Output 1 value to 0.
8. END
Program ends.
9. INT 0 Target_velocity >= 400
Interrupt service routine
0: Runs if Target_velocity variable is equal to or exceeds 400.
10. SET_OUTPUT 1 ON
Sets Output 1 value to 1.
11. INT_RETURN -1
Returns to program line at which the
interrupt occurred.
12. EXT_INT 1 1 Falling
Interrupt service routine 1: Runs if In
1 becomes False
13. STOP_EX Emergency Servo OFF
Stops the motion and
turns the servo off
14. INT_RETURN 2
Returns to program to label 2
The program will execute differently depending on whether or not
In 1 changes during motion.