Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Can 2 programs use one task?

I have a program that continously writes to a PCI-6711 card for analog output.  Well, i periodically poll the card to know when there is enough buffer space to write more data.  Unfortunately, this seems to take more cpu than i would like, therefore, i have looked into making an activeX object to run in it's own process space to do the polling for me and raise an event when it is time to write more data.   Unfortunately, when i pass the task number to the ActiveX object all i ever get is the DAQmx error 200088, which i believe says that it is an invalid task.   Is it possible to share a task between two different programs?  I have heard that you can configure a task with Measurement studio and then call LoadTask or something like that, but i was hoping to do this all via code.
 
Regards,
Gerry
0 Kudos
Message 1 of 3
(3,241 Views)

Hello Gerry,

You can certainly call a task from two different applications. Can you tell me a little more about your Active X call and how you are setting things up? What programming language are you using for your main application?

As you noted, this error generally occurs when the task reference you are using is invalid. It is possible that the task you are referencing has been closed by the time you poll it with your Active X application. Make sure that you are passing the correct task reference and that it has not been closed or cleared when trying to access it.

I am curious, you said that running the polling in the first application was system intensive, what behaviors were you experiencing in regards to this? How were you going about polling the task?

Regards,

Chris Behnke
Sr. RF Engineer
High Frequency Measurements
0 Kudos
Message 2 of 3
(3,210 Views)
Sure, i will tell you a little bit about my activeX setup, and then a little about the setup i am trying to correct.  Okay, the activeX is written in VB as an executable.   I have a timer that is set to execute its code every 10ms.   @ the 10ms intervals i make calls to get the number of points written and the available space in the buffer.  If there is sufficient space i trigger an event that will fire in the main application (program 2) which will notify my program to write to the buffer.   I probably will use a similar concept to notify the main program when the waveform is done as well.  
 
In the main program, which is also in VB, I currently have all the functionality there to do the same thing, but I have a while loop polling the number of points written to the buffer (number of points written is updated via the timer) which will tell me when it is done so that i can go to the next waveform.   The main program takes a list of user-defined waveforms, which are represented as large arrays of data, and plays them sequentially until they are finished. 

Does that make sense?
 
Regards,
Gerry
0 Kudos
Message 3 of 3
(3,204 Views)