Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple, non-conflicted reference clocks on one card

Solved!
Go to solution

Hi,

 

I am writing in C#.

 

I have an bunch of analog output, digital output, and analog input tasks all synchronized (across boards and tasks), in terms of start triggers and reference clocks. 

 

At some point in my application, the user can select to discontinue the output side of things, so the digital and analog output tasks are disposed of, but the system continues to collect analog and digital input. The problem is that sometimes when the user does this, the port state defined by the digital output and the analog output remain in their last, non-zero state, which can be very bad since these signals are potentially being injected into biological tissue.

 

I need a way to zero all the outputs at when the user chooses to stop using them, while continuing to allow the recording side of things to function.

 

What I have been trying to do is to create a class that can create a bunch of AO and DO tasks for a given device and zero all the output ports and AO channels by quickly writing a zeros. This class is created and the zeroing methods called right after the AO and DO tasks that were originally controlling the output are disposed of. My problem is that since the AI task is currently running on the board, when I try to start my new zeroing tasks, DAQMX tells me:

 

Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
Property: NationalInstruments.DAQmx.Timing.ReferenceClockSourceSource Device: Dev1Source Terminal: 20MHzTimebase
Required Resources in Use bySource Device: Dev1Source Terminal: 10MHzRefClockDestination Device: Dev1Destination Terminal: PFI1
Required Resources Also in Use byTask Name: AuxiliaryAnalogInputSource Device: Dev1Source Terminal: 10MHzRefClockDestination Device: Dev3Destination Terminal: RefClock
Required Resources Also in Use byTask Name: spikeInTask_1Source Device: Dev1Source Terminal: 10MHzRefClockDestination Device: Dev2Destination Terminal: RefClock
Required Resources Also in Use byTask Name: spikeInTask_0Source Device: Dev1Source Terminal: 10MHzRefClockDestination Device: Dev1Destination Terminal: RefClock
Task Name: AnalogClear
Status Code: -89137

 

So, it seems that because the reference clock is busy being used by the analog and digital input tasks, I cannot use it as a reference clock for my zeroing tasks. How can I get around this issue. Since the timing of the zeroing does not need to be precise at all, is there a way that I can just send a single sample to the all of the output lines without using the reference clock? Any help would be appreciated.

 

Thanks.

 

-Jon

0 Kudos
Message 1 of 3
(3,348 Views)
Solution
Accepted by neuronerd

Hello Jon,

 

Thank you for posting.  My suggestion would be changing the output data of your original output tasks before disposing them, rather than creating new tasks that generate zeros on your outputs.  Have a user control that just sets the analog and digital outputs to zero and then dispose of the tasks if you wish.  The outputs should stay at zero because that would be the last state the outputs were in before the task was disposed.  Let me know what you think!

 

Regards,

Joe S.

 

0 Kudos
Message 2 of 3
(3,341 Views)

Hi Joe,

 

Yes, I ended up going down this route. I don't know why I didn't think of it! Thanks.

 

-Jon

0 Kudos
Message 3 of 3
(3,331 Views)