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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

toggle analog input and output tasks in LabView on same board

Solved!
Go to solution

Hello,

 

I am fairly new to LabView, and am trying to figure out the best way to toggle between read and write tasks on my PCI-6024E. This seems like it would be a common thing to do, but I haven't found any good documentation or any relatable example programs. Basically, I'd like to be able to monitor some analog inputs and then write some analog outputs if an input meets some specific condition (say like the voltage > 4 Volts). It's my understanding that you cannot have mixed signal types (input and output) within a single task in DAQmx. I also understand that you cannot have multiple tasks running at the same time on the same hardware/board, otherwise you get an: Error -50103 "The Specified Resource is Reserved". Timing is not really all that important to me, but fairly synchronous and efficient would be nice.

 

I've attached an example program that shows loosely what I'm trying to do. I want to monitor multiple analog input lines (AI0, AI1, AI2, and AI3) in a time-efficient way. If some condition is met, AI3 > 4 Volts, then write 5 Volts to the analog outputs AO0 and AO1. I'd also like to keep the outputs at 5 Volts until AI3 drops back below 4 Volts. Is there a better way to switch between the read task and write task than what I've done here? In a sense, all I'm really doing is toggling a state machine if the required conditions are met, and stopping/starting the read/write tasks as needed.

 

One last question, is there a way to display all four channels in the waveform graph using the 1D NChan 1Samp mode so I can have a both the graph and indicators?

 

P.S. I'm running LabView 2011 on Windows 7. Your thoughts and suggestions are much appreciated.

 

Thanks,

KJ

0 Kudos
Message 1 of 2
(2,933 Views)
Solution
Accepted by topic author kjack

 I also understand that you cannot have multiple tasks running at the same time on the same hardware/board, otherwise you get an: Error -50103 "The Specified Resource is Reserved". 

 



This is incorrect.  You cannot have two tasks of the same type running on one board.  You can have one analog input and one analog output task running concurrently on the same hardware.

 

You are correct that each task can only have one type of task (i.e. input or output).  Check out the DAQmx examples in the Example Finder for examples of synchronized input and output.

 

PRO TIP: In the Example Finder, go to the hardware drop down box in the lower left hand corner.  Pull it down and select Add Hardware.  In the popup window, add your PCI-6024E to the right hand pane.  Hit OK in that window.  Then in the main Example Finder window select your hardware from the drop down box and check the box Filter Results by Hardware.  The Example Finder will then only show you examples that are out-of-the-box compatible with your hardware.  I'm confident you can find something to fit your needs in there.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 2
(2,930 Views)