Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

There must be an easier way to control digital outputs?

My user needs the ability to create and control (on/off) a set of (constant) digital oputputs.

 

I've come up with the attached VI, but I'm certain there has to be an easier way of doing it.  My only method of creating a constant output is to use a square wave with a 100% duty cycle. 

 

I like to do things right, and I know the solution is out there, though a search of the forums revealed nothing of use.

 

Any help would be much appreciated.

0 Kudos
Message 1 of 4
(3,562 Views)

Yes, that is massive overkill. To put out a constant, all you have to do is use the DAQmx Write set to Single Channel>Single Sample>Boolean. You wire your control directly into the data input.

 

And either place a small Wait inside the loop so you don't starve the cpu or even better, use an event structure. A value change event for each control would work much better.

0 Kudos
Message 2 of 4
(3,559 Views)

Thanks Dennis!  I'm able to get the DAQmx Write to work. 

 

 I think I theoretically understand what you mean by event structure though I've never used it before.  I've gone through the help section and now I'm even more confused.  Would I need 4 separate event loops? or just 4 separate cases? or otherwise?

0 Kudos
Message 3 of 4
(3,552 Views)
One while loop with one event structure. You can use a single event and get the CtrlRef to determine which line to set or use a separate event for each control. The latter is the simplest.
0 Kudos
Message 4 of 4
(3,549 Views)