12-14-2015 12:57 PM
Hello all,
I have this program here that I want to use to run a CO2 laser, and for obvious reasons i'd like to have a stop button on the program that shuts everything off in case something untoward were to happen. The problem im having is that the button must not be coded correctly because it doesn't work at all, and this can make things potentially dangerous. The program is ment to ramp the laser power up to a specific power at a set rate, stay there for a set amount of time, and then ramp down at a set rate.
Does anyone have any way to fix this stop button problem?
Cheers!
12-14-2015 01:30 PM
Your stop button isn't wired to anything except for the controls that stop the loops that run your function generator. The function generator doesn't know to turn off unless you send it a signal to do so.
Basically, you need to have the "stop" button in your inner loop call the "output enabled" VI set to FALSE if the "stop" reads TRUE. And you need to make sure to have that run after the signal it gets every single loop to turn itself on (which you really ought to only call one time, instead of during every loop).
12-14-2015 01:30 PM
Owwwwwwwww...I'm blinded by the purple front panel! Do yourself and your users a favor and just use the default colors.
As far as your code, I very highly recommend using a State Machine. A loop inside of another loop is typically a sign that something is really wrong. One of your states should be "Idle" or "Wait" that uses an Event Structure to watch for the user pressing buttons. From that, you can key off of the user pressing the stop button and shut down the system. The Event Structure also allows for a timeout to allow for the timing of your ramping.
12-14-2015 01:37 PM
12-14-2015 01:39 PM
12-14-2015 02:21 PM
I'm looking at how to build state machines now, I've been recomended them before but I have not ever coded one. We do have an actual stop switch to the laser that kills all the power to it in case something goes wrong, but it would be nice to be able to kill the code with one push of a button as well so the DAQ and function generator stop sending voltages
12-14-2015 02:48 PM