LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling case structure with daq assistant (digital input)

Solved!
Go to solution

Hello, 

I am relatively new to LabView and I try to control case structure with digital signal. I use LabView 2020 and NI USB 6009. I try to control case structure with digital input signal, same as I can control it using the Boolean 2. I use the case structure to pause the program. So when the value is true the program runs, when it is false is paused. I test the NI USB 6009 and it read the signal correct. I really don't know what I am doing wrong. I think something must be wrong in this part of the Block Diagram: 

jofu_0-1597653423752.png
And for controling stop button it works. I can stop program using digital signal connected to Dev 1/Port1/Line3 on NI USB 6009.

Hope you understand what I try to do. Thanks.

 

 

jofu_2-1597653536356.png

 

 

 

0 Kudos
Message 1 of 13
(668 Views)

Here is program.

0 Kudos
Message 2 of 13
(663 Views)
Solution
Accepted by topic author jofu

Hi jofu,

 

So to confirm a couple of aspects:

  • Your DAQ Assistant4 Read is set to read two boolean lines and invert them, line3 and line2 (in that order).
  • You then use Index Array with "0" wired twice. This gives you the "NOT line3" value twice (line2 is never used). As an aside here, you could just branch the wire if this is what you really want - if instead you want the "NOT line3" and "NOT line2" values, you don't need to wire anything to Index Array's indices - you automatically get 0, 1, ... if you don't connect values.
  • When "false" is the output, you're not actually 'pausing' the program - you will run the code fairly quickly (as fast as your DAQ device can supply values, which is not very determined here due to the use of "On-Demand" sampling).

I expect the problem you're running into is related to your Index Array inputs and getting the same value twice, but perhaps you can clarify what behaviour you want if this is not true.


GCentralI'm attending the GLA Summit!
0 Kudos
Message 3 of 13
(654 Views)

Thanks. I deleted the "0" wired to the Index Aray and now it works properly. Thanks again for the help.

One more question. Is possible that the Boolean value is every time when you run program set to True, no matter if it is True or False when you stop the program?

0 Kudos
Message 4 of 13
(620 Views)

Hi jofu,

 


@jofu wrote:

Is possible that the Boolean value is every time when you run program set to True, no matter if it is True or False when you stop the program?


Are you talking about that "Boolean" indicator shown in your image?

The answer is "Yes": just make sure the shift register contains the needed value! As there is a NOT operation before that indicator the shift register needs to be set to FALSE…

 

Btw. you should use better (aka "more descriptive") labels for your controls/indicators…

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 5 of 13
(591 Views)

Thanks for the answer. Sorry for my inaccuracy. I was talking about  "Boolean 2" control shown in my image. So I want to know if it is possible that  "Boolean 2" (push button) is every time when you run program set to True, no matter if it is True or False when you stop the program?

0 Kudos
Message 6 of 13
(569 Views)

Hi jofu,

 


@jofu wrote:

So I want to know if it is possible that  "Boolean 2" (push button) is every time when you run program set to True, no matter if it is True or False when you stop the program?


Yes.

Set a default value for this button…

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 7 of 13
(562 Views)

I try with that, but it did not work.

0 Kudos
Message 8 of 13
(557 Views)

Hi jofu,

 


@jofu wrote:

I try with that, but it did not work.


What did you try?

And what "did not work"?

(Mind to attach your VI?)

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 9 of 13
(554 Views)

I set a default value ("False") for  "Boolean 2" button. First time when I start the program the value is set to default ("False"), but when I press "stop" button on the Front Panel and then again Run (Ctrl + R), the value stays the same as is right before I stop the program (that is what I mean with "did not work").

Hope now you understand what I try to do. I attach the VI.

 

0 Kudos
Message 10 of 13
(491 Views)