LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Limit switch with stepper communicating via NI-VISA

Hey everyone! Rookie LabVIEW user here. I have a stepper motor with a drive that communicates with LabVIEW using NI-VISA and there are a set of commands that need to be input in order to move the stepper. I would like to use limit switches to stop the stepper motor in case it triggers them.

 

My idea was that I could monitor the DI line that would be connected to the limit switches and when the connection is shorted it would stop the motor. But as the VISA communication uses commands that once sent would be executed, how can I assure that the motor would be stopped if it hits the switch.

 

Please suggest a point to begin with or how to approach this.

 

 

0 Kudos
Message 1 of 3
(1,119 Views)

Hi, is there a "stop" command that you can send to the motor?  You can check if this command can override the original move command.  The logic would be:

 

1. Execute motor move 

2. Monitor DI line

    - If DI is triggered, execute stop.

 

0 Kudos
Message 2 of 3
(1,102 Views)

Hi! Yes I can send a "KILL" command and that should immediately stop the motor. For that maybe I can create a event structure for this action in the stepper part of the program. For now I have event structures for CW and CCW movements of the motor and an emergency event when the DI from limit switch is high.

 

But, I am not sure how to extract the signals from two limit switches to use as an input for the emergency event in stepper.

 

Could you please have a look at my VI and suggest a way. I am a little lost with that, since I asked this query. I tried indexing the digital input and then convert it to digital waveform but not sure how to use this in event structure for the stepper. Maybe, a state register?

0 Kudos
Message 3 of 3
(1,058 Views)