09-23-2010 08:04 PM
hi tbob,
Thank you very much. It seems to work but I have one last question. How do I control the off module when I stop. Right now, it turned on and off immediately.
Aaron
09-24-2010 12:04 PM
My fault for not reviewing all of your code. Look at the True case, to the right side. You have a Configure Output Enable function that has a False wired to it. This turns the power supply off. You need to move this function and the next one (Close) to outside the entire loop. You don't want to close the session until you stop the program. So the Configure Output Enable and the Close functions need to go after the big loop. Now since you have to close more than one power supply, you will have to accumulate all the session handles into an array. Do this by wiring the purple wire for the instrument handle out to the loop border. Be sure that indexing is enabled. The output from the loop should be an array. Create a new For Loop after the main loop and wire this array to it with indexing enabled. This will index out each element as the loop iterates. Put your two functions, Configure Output Enable (with the false constant wired to it) and the Close fucntion inside this for loop. Then when you press the stop button, the for loop will take each instrument and turn it off and close its session. See if you can code this yourself. If it doesn't work, attach your code.
09-24-2010 12:31 PM
After thinking about this, it is a little more complicated than I described. Instrument arrays and channel arrays have to be built so that they can be stopped at the end. Here is a vi that does this. Please study it so you can understand what is happening. Notice that I use Error In and Error Out instead of a simple error handler. This gives you a visual error indicator on the front panel that does not disappear. Also notcice the shift registers and the way to build arrays. This allows you to gather a list of power supply sessions and channel numbers that you need to effectively shut them down and close their sessions. I removed the inner loop that kept reading voltage and current levels continuously, and I just read them once. I added an indicator for compliance since you had the function but did not have an indicator.
The vi is attached. In 8.6.
09-24-2010 12:45 PM
Hi tbob,
I have tried to do as you described above posted, but I have some error. Yes, it does complicate. I really sorry for bothering too much because I don't have much experience in LabVIEW programming. I will defintely need to study this. Thank you for helping.
PS: NIquist, I also would like to say "thanks" to you too.
09-24-2010 12:51 PM
So did the last code I attached do what you want? If you have questions, just ask.
09-24-2010 01:02 PM
Hi tbob,
Yes, Thank you. I am studying right now.
Aaron
09-24-2010 03:58 PM
hi tbob,
I study the program, and I found that the "stop button" is not turning off the power supply instead turning off individual power supply. First, I selected ps1 from instrument control and set channel 0 to 5v, then if I selected the same ps1 with channel 1 to 15v then it shutted the channel 0 to off. The "stop button" are not turning off all power supplies in the array.
09-24-2010 04:34 PM
I think I see what is happening. You are using the same device name (ps1 or Dev1 or whatever) but you are addressing two channels. I didn't know you were using a multi channel power supply. You didn't say so. What happens is that at the end, in the last loop, ps1 channel 0 is turned off and then ps1 session is closed. Then on the next loop iteration, since ps1 session is closed, an error occurs when the Configure Output Enable vi is executed. This error then carries over to the next loop and the remaining power supplies are not turned off.
Here is a fix. I put the close in a new loop to ignore errors.
09-24-2010 04:49 PM
hi tbob,
How do I prevent the channel not turn off if I set another channel with the same dev1? I want to turn all devices only when I press the "stop button". Adding new for loop will do nothing but there is an error occurs something "session handle is not valid".
09-24-2010 05:09 PM
So you want to turn on all supplies when you press the stop button, and not before. You need to be specific when you ask for help. This changes the vi. Before I change the vi, please tell me exactly what you want. Like this:
1. set up the power supplies one at a time, but don't turn them on yet.
2. after all power supplies are set, turn them all on.
Is there more than physical one power supply? Count multi channel power supplies as one physical power supply. If there is only one device (physical power supply), the code changes. If there are more than one power supply, are all of them multi channel?