From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Digital Output software

Hey people. I need your help to improve my software. I need to use some digital outputs. The software does this:

 

- Choose which one battery to monitor

- Activate only one digital output at a time

 

Ok, I have done this, but I guess it's not the best solution. I've tried to make it a lot of different ways, mainly because I am using the VI's several times and it is not an "optimal code". Well, beyond that, I can't have two digital outputs HIGH at the same time, i mean, I CAN'T have LINE2 and LINE3, for example, at HIGH (true) at the same time. 

 

Does anybody have any idea on how to help me?

 

Thank you very much!

0 Kudos
Message 1 of 9
(2,701 Views)

It's tough to know what you're trying to do with your buttons labled 'Boolean n' but, from your description, I think you could use Radio Buttons instead of individual Boolean controls to prevent having more than one output on.

 

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 9
(2,690 Views)

I tried to use radian buttons, but I couldn't. Thanks

0 Kudos
Message 3 of 9
(2,688 Views)

Is there how to use an array to control the digital outputs? For example, send TRUE to LINE0 and FALSE to the others, using an array, instead of doing this manually? Something like: Line0:2

 

Thank you!

0 Kudos
Message 4 of 9
(2,686 Views)

You've got some dangerous habits in there.  This is a perfect use for a ring control-  NOTE: I've set the display format for Binary which doesnt show clearly on the item editor. 

 

Creating and destroying Tasks multiple times is a poor practice and will lead to memory leaks the program won't run stabilly for long periods.  Here is an example for the DO task.

1.png

 

You will want to make the ring a type def  and event case 1 should be Stop Vlue Change but I'm slinging faster than thinking

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 9
(2,680 Views)

Thank you very much, Jeff. I know my solution is not the best, but I need to ensure that only one of my outputs be at HIGH level. I am trying to use the RADIO buttons, and the program is attached here. But there is this problem, that is I repeat all the VI's. Please check this for me, if you can. Thank you very much, your help is very important!

0 Kudos
Message 6 of 9
(2,672 Views)

You only need a single create channel, a single DAQmx Write, and a single case statement. Please look at the shipping examples to see how you specify multiple channels and can use a Boolean array.

 

Nor do you want to constantly create and stop/clear the task in a while loop.

0 Kudos
Message 7 of 9
(2,667 Views)

The radio button is not without merit-  But it does lack extensibility.... Today you have a requirement that the lines are mutually exclusive- tomarrow that may changeSmiley Wink a U8 ring (or U16 when you scale up operations) will permit you to grow the solution no matter what changes in the future as long as a unique value for each selection can be mapped.  As stated- treat the system as a system- the lines are logically linked to each other and so your task should represent that interrelationship by grouping the lines that are co-dependant.


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 9
(2,663 Views)

Thank you, guys. I did it! I used "Dev1/Port0/line):3" on Digital U16 1 Chan 1 Samp and it worked with a Binary Input data.

 

 

Message 9 of 9
(2,630 Views)