08-26-2011 09:37 AM
Hello,
I am having trouble controlling my digital outputs based on using a timer to control them. My problem with this code is that when running case #2 the output comes on both the indicator and the h/w channel as expected but when the timer elaspes the indicator goes off the the digital output channel stays on. Maybe there is a better way or more common practise of controlling logic based on using timers? Any suggestions would be appreciated.
Regards,
John
08-26-2011 10:33 AM
THe while loop inside a while loop is your problem. This is never a good idea. You need to make everything run in one loop or break it into two loops. That is why tou are getting stuck.
08-26-2011 11:21 AM
Hey Tim,
So for case #2 how could I turn on output one for the set time and then turn it off without using a while loop to exit? I'm not sure about how to split it into two while loops as I need to run different cases based on the case input wire. Any thoughts on best approach for this?
Thanks,
John
08-26-2011 11:24 AM
You've got a major misconception of data flow and a very wrong use of locals. Your DAQmx Write is outside the loop. Obviously, the write will not happen until the while loop finishes. Put the write inside the loop and don't use ANY locals.
08-26-2011 12:01 PM
Thanks for your comments, I know it's obvious that I have not used Labview much as I am a hardware guy. I see now what you mean about my write. So now it is inside all of my cases, what is the best way to show the ouputs as an indicators on the front panel?
Thanks,
John
08-26-2011 02:10 PM
Here is an example of what I think you are trying to do. Ask any questions you need to ask and I will explain what I did. There are better ways to do some of the things but I wanted to show you an example of what I thank you are trying to accomplish.