LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to turn on/off multiple outputs with one button using USB-6501 & Labview 2010

Solved!
Go to solution

I have written a VI with 24 buttons, one for each output of the USB-6501, to turn on and off 24 relays.  Now I want to add more buttons that turn on and off mutliple outputs.  Let's call these buttons Presets and with a press of the Preset button some outputs turn on and some turn off.  Get it?  The VI I have included a screenshot of is used to test a transmission controller and rather than manually selecting relays one at a time I want a Preset button that sets up the relays instantly for the next step of the test.

The VI I have written uses tasks created in NI MAX.

I am a Labview beginner so please try to keep your solutions easy to understand....if possible.

Thanks,

Kevin

BTW I am enrolled in Core 1 and 2 next month in Richardson, TX.

Download All
0 Kudos
Message 1 of 10
(4,381 Views)

Hey,

 

You're basically talking about using property nodes to change the value of the controls. This is demonstrated in the attached VI and is discussed more thoroughly here:

 

Control References: Overview

http://www.ni.com/white-paper/3159/en#toc4

 

--Ryan S.

 

0 Kudos
Message 2 of 10
(4,368 Views)

This vi is 2012 and won't open in 2010......

0 Kudos
Message 3 of 10
(4,363 Views)

OK, I downloaded 2012 and opened your vi...it does exactly what I want it to do.....but how do I make it talk to my USB-6501?

0 Kudos
Message 4 of 10
(4,341 Views)

I hope that image of your block diagram is not your real VI. It is just silly to use individual buttons wired to so many DAQmx Writes. You should only have a single DAQmx Write and it should be inside an event structure so that it only executes when a value changes. You can use an array of Booleans on the front panel or build an array on the block diagram.

Once you have made those changes, then you can add another event for the preset button and write to a local variable instead of a property node.

0 Kudos
Message 5 of 10
(4,327 Views)

Thanks for the tip Dennis but I have no idea how to do what you suggest.  Could you possibly show me an example, please?  Keep in mind I am very new to Labview.

0 Kudos
Message 6 of 10
(4,321 Views)

Help>Find Examples. That should be the first place you look. Check under Hardware Input and Output>DAQmx>Digital Output. In 2011, there is an example called Write Dig Chan that does exactly what I mentioned for the DAQmx Write. The event structure is demonstrated in numerous places.

0 Kudos
Message 7 of 10
(4,317 Views)
Solution
Accepted by Teggun

Here's an example -- you'll learn about clusters, arrays, events, etc. in the class but this will give you a head start. Code is attached but I took a screenshot to give people an idea of how simple the diagram becomes:

 

2-12-2013 3-01-43 PM.png2-12-2013 3-06-11 PM.png

 

As your learn about them I'd also suggest making the cluster a TypeDef and doing some error handling but I omitted them from the example to keep things as simple as I could.

 

Good luck learning LabVIEW, it's worth it!

 

~Simon

Message 8 of 10
(4,262 Views)

This looks PERFECT!!  I'll try it tomorrow and see how it goes.  Thanks!

0 Kudos
Message 9 of 10
(4,256 Views)

This is perfect!!!!!!!!!!!!!  Thanks a ton SimonH!  I figured out how to change the presets and tweak the settings so it will talk to my USB-6501.  I plan on adding a USB-6009 analog I/O to the setup next.

 

Kevin

0 Kudos
Message 10 of 10
(4,219 Views)