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.
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.
11-16-2011 05:31 AM
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!
11-16-2011 11:47 AM
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.
11-16-2011 11:49 AM
I tried to use radian buttons, but I couldn't. Thanks
11-16-2011 12:20 PM
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!
11-16-2011 12:42 PM - edited 11-16-2011 12:44 PM
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.
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
11-16-2011 12:57 PM
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!
11-16-2011 01:06 PM
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.
11-16-2011 01:14 PM
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 change 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.
11-26-2011 11:41 AM
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.