Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Consecutive Waveform Outputs

USB-6343

Visual Basic 2008  / .NET 3.5

 

 

Our project contains a process with multiple I/O operations in sequence.  We use digital and analog inputs / outputs, including sinewave generation.  During the course of the process, we re-use tasks and AO channels to generate various sinewave outputs without issue.  When the process is complete, the code stops all tasks and disposes them, and then we invoke the Reset() method on the device.

 

The first run through our process works fine; however, subsequent runs (without cycling power on the USB-6343) will generate exceptions when we get to the step where we attempt to generate the first sinewave.  The exception messages indicating a bandwidth problem, but since it always works the first time, I think something else is going on.

 

If we cycle power on the USB-6343 and then re-run the process, then we can successfully generate sinewave outputs.  However, the exceptions return when we attempt to run the process again.  We only get one time through!

 

It seems clear that some resource is not being reset properly by stopping the tasks, disposing of them, and then resetting the device.  Interestingly though, other digital and analog I/O operations seem to work fine in consecutive runs.  It is only the waveform generation where we have issues.

 

The code generating the sinewave outputs uses the FunctionGenerator class, taken directly from the DAQmx .NET 3.5 samples provided with the Measurement Studio.

 

Anyone have an idea what might be happening here?

 

Thank you in advance for your assistance.

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

Hi parksma,

 

What does your error message say?  What error code are you receiving?  This issue sounds similar to a buffer overflow error 200361, is that what you are seeing?  There is a KnowledgeBase here talking about seeing this error in WinXP SP1, what operating system are you using? 

 

Also, be sure you are operating within specifications on the USB-6363, those can be found here.

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 2 of 4
(3,447 Views)

Kyle,

 

Thanks for your reply.

 

Operating system:  Win XP Pro SP3

 

I have modified the code - instead of disposing of the tasks and resetting the device, I now simply Stop() the task.  The next time through the sequence, I re-use the tasks for the same purposes.  We can still run through teh entire test sequence once without issue.  On the second attempt, however, we get the following error when we go to generate our first sinewave:

 

     Error -50103

     The specified resource is reserved

 

I have tried adding a 'unreserve' before the output is started, but still get the same error.

 

I still find it interesting that other I/O operations (digital and analog, inputs and outputs) seem to work fine the second time through.  It is only the sinewave generation that does it.  As I stated in my original post, I basically use the same method that is employed in the DAQmx .Net 3.5 samples for continuous waveform that cam with the Measurement Studio.

 

Thanks again for your assistance.

0 Kudos
Message 3 of 4
(3,441 Views)

Hey,

 

So the error you were getting before, I am still interested in what that was before your code change, do you happen to remember what it was?  Since you seem to be doing multiple I/O functions and multiple start/stops, it is a little difficult to identify what exactly could be causing this behavior.

 

I think what will be best at this point is to narrow down the code to reproduce the issue.  This means taking out the sections that do work, and only have the section that is giving you issues.  From there, I would like to look at the process that goes on to see where the resource reserved error could be coming from.

 

I assume when you start/stop the task, you are not ending your program, correct?  Typically the resource reserved will pop up when you try to create a new channel (which reserves a resource) and that resource already has a task associated.  Start Task to stop task and starting again should not cause resource conflicts if you are using the same channel.  Make sure you are not trying to recreate the task in each iteration of your sequence if you are using this structure.

 

 

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 4 of 4
(3,424 Views)