05-24-2015 01:47 AM - edited 05-24-2015 01:48 AM
Dear All,
Now I used NI-6008 when I used case structure to program via digital output. It 's can turn on and off. But when I tried to turn On and then push stop button to while loop.The Led that I connect to is still on when I stop my program. How can I turn off this led when I stop my program?
Thanks
Solved! Go to Solution.
05-24-2015 01:55 AM
Use a proper state machine architecture and turn the LED off as a last step before the loop stops. If you want more detailed advice, show us your code.
05-24-2015 02:08 AM - edited 05-24-2015 02:11 AM
As this image I can turn and off but if I turn on then I stop loop.The led should not be alway turn on. But it still turn on. Daq Assistant 2 is Digital output. Daq Analog in for compare.
Many Thanks
05-24-2015 02:20 AM
Your image is useless to show the problem. It is just a truncated picture and we don't even see where the loop condition is and how it is wired.
What is preventing you from attaching the actual VI?
05-24-2015 02:36 AM
As the attachment file I need to set the data as default or (booloean 2) if I press the button stop please help
05-24-2015 08:21 AM - edited 05-24-2015 08:22 AM
1. Your outter loop is not needed at all.
2. You have a lot of duplicate logic. If you are not above your threshold, of course you will be less than it. So you can do a lot to reduce your logic.
3. Things will make a lot more sense if you convert your DAQ data to a scaler immediately after the DAQ Assistant.
4. Move your writing of the digital output to outside of the case structure. Also allow the timer to affect the case that is called. This way, you can tell the output to just go to FALSE when your loop stop condition is encountered.
5. Since you are only gathering 1 analog value at a time, change your graph to be a chart. A chart has a history built into it, which I'm sure you would like to have.
05-24-2015 11:34 AM
@Chairat wrote:
As the attachment file I need to set the data as default or (booloean 2) if I press the button stop please help
Sorry, it was way after midnight for me when you finally posted your code, but it seems that Tim already told you the gist of it all. 😄
There are a few more things that should be mentioned.
05-24-2015 11:41 AM
crossrulz wrote:2. If you are not above your threshold, of course you will be less than it.
Well you could alse be equal to the threshold. 😄
(Still the logic could be simplified dramatically but you need two comparisons to identify one of three states. (greater, equal, less) another way would be to subtract the two inputs followed by the sign function).
05-24-2015 07:54 PM
@altenbach wrote:
crossrulz wrote:2. If you are not above your threshold, of course you will be less than it.
Well you could alse be equal to the threshold. 😄
1. I was trying not to muddy the waters.
2. Since we are dealing with floating points, that probably will not be an issue.
05-24-2015 09:54 PM - edited 05-24-2015 09:57 PM
I done the diagram as the picture but the led still on then on hardware is still on could you recommend for more?