Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Switching digital input tasks in DAQmx

I have successfully created a DAQmx task (using an M-series board) that performs continuous change detection on a number of lines and is synchronized (via hardware trigger) with other tasks (analog input, count edges, etc).  Due to the nature of the data collection, the change detection task is configured for hardware times single point\programmed I/O data transfers.  All of this works fine...

However, becuase I'm running change detection, I'd like a way to do a single non-triggered sample of the digital lines to establish their initial states before starting the main tasks.  I figure the best way to do this is to create another digital input task with on-demand timing and do a single read operation (still transfer data via single point\programmed I/O).  I've read in these forums that simply stopping one task and starting another is not enough when your are changing between digital I/O.  You have to completely clear a task before starting another one.  Is this necissary when simply switching sampling\timing modes?  Both my tasks are DI, and it would be pain if I had to clear the tasks and reinitialize them every time I switched.  Is starting\stopping tasks enough in my case?  Do I need to use the DAQmx Control Task VI and force a particular state before switching?

Thanks.
Message 1 of 2
(2,918 Views)

Hello Yuri. 

Thank you for posting to the NI Discussion Forums. 

I constructed a quick example in LabVIEW to test the necessity of clearing a DI task before accessing the same lines with another DI task.  The results show that only stopping the task is necessary.  I first set up a digital task (Task A) to use the sample clock within the DAQmx Timing VI to acquire the states of the line.  Then, I stopped Task A and started another task (Task B) that uses Change Detection.  I then stopped Task B and resumed Task A with DAQmx Start.  All of this was successful and error free. 

Go ahead and give this a try.  Let me know if you are error free in your application or if you run in to any problems.  We would be happy to help you further so let us know!

Have a great day!

Brian F
Applications Engineer
National Instruments

0 Kudos
Message 2 of 2
(2,896 Views)