I posted PLC application that provides support to test a physical stepper motor. The code uses a single limit switch that is used to find the home position for the stepper. This code used an external stepper driver so that used only 2 signals from the PLC, step and direction.
The code was written to allow me to test acceleration profiles.
The post includes documentation to explain how the code operates. There is, also, user interface code that runs on Wientek touch screen HMI.
You can operate the code without the HMI using either the simulator or the on-line monitor with real hardware.
I did not use the interrupt system to stop stepper movement. I used ladder logic to handle the switch input and invoke a custom function to stop the stepper motion.
i found that the interrupt approach was not necessary for my application.
I suggest that you use this code as a starting point. Get it to work with out interrupts, first. Then change the code to use interrupts and see if this improves how your system operates.
The following is a link to this forum where you can find the PLC code and it’s documentation:
https://triplc.com/smf/index.php/topic,2347.msg8397.html#msg8397
Best regards,
Gary Dickinson