Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control two different processes with one DAQ output board

Hello all,
 
I have a PXI-6722 8-channel, 13-bit analog output board, and with this I want to independently control both the temperature (thermometer excitation/heater control) and magnetic field in my experiment. Unfortunately, it appears that I cannot do both simultaneously, which is totally unacceptable for my application.
 
Currently I'm using separate VI's for field and temperature control. This is the start of the problem, because in DAQmx you can't have 2 output tasks on the same card at the same time. In order to remedy this situation, I used MAX to create a global task containing all 8 13-bit analog outputs. However, it now appears that each time I do a write operation on this task (from whichever VI) I must write to all of the task channels, rather than just the channels I want to change. This would be fine for the temperature controls as they are of the type "set an output voltage value and hold it until told differently," so I could re-write the currently held values for channels that are not being changed. Magnetic field control will not work in this way, because we need to do very smooth field sweeps which require an analog waveform to be sent and sampled at a high rate (so that the steps are as small as possible). So if, for example, a thermometer's excitation voltage or a heater's power need to be changed during a field sweep (as is often necessary to maintain a constant temperature, via PID), then the sweep will be disrupted, potentially causing a dangerous magnet quench.
 
Does anyone have any ideas on how I could make this work? It seems very wasteful to buy a second output board when I still have lots of free channels on the first.
 
Thanks,
 
Patrick
0 Kudos
Message 1 of 15
(9,727 Views)
Hi Patrick,

In your post you mentioned that you are controlling several different processes with your analog output board and are running into problems because you would like to use several Analog Output Tasks, but can only actually use one analog task at one time for any one board.

While these rules do exist there are ways to work around them, but it will ultimately require you to write a data generation scheme that allows for the write data to be written at the right times.  Essentially you will want to make your output rate be about as fast as you need for your fastest updated channel.  From there you will have to generate the data that you need.  For a DC analog output signal you will need to generate an array of data that has the same values.  Similarly for the other channels, the data points will need to reflect the waveform you want to represent.

Ultimately you can probably find a technique that allows you to generate the right data at the right times, but it may take a little bit of work.  If you still feel the need to have very different analog output tasks that would require the use of multiple analog output tasks, then you may want to consider getting another board to increase your flexibility.

I hope this information helps you to determine the best way to proceed,
0 Kudos
Message 2 of 15
(9,707 Views)

Hi Patrick,

I made a small mistake in that email.  You can have more than one output task for one board at one time; however, you can only have one output task for one board if you are trying to generate a waveform.  But you CAN generate a single point with a separate task.  This should make your life much simpler as you won't have to generate an array of data like I stated before. 

I double checked this and was able to get a small example to work where it generated a waveform and simultaneously updated a single point on a different analog output channel.

Sorry for the confusion,

0 Kudos
Message 3 of 15
(9,701 Views)
Hi Otis,

Thank you very much for your help! This sort of generating a waveform while simultaneously updating a single point on another analog output channel is just what I want to do. Would it be possible for you to attach your small example?

Also, to clarify: I can have several single point output tasks on one board at one time, but only one waveform task? Does this mean that as soon as I have a waveform task on the board this has to be the only task at that time, or can I have one waveform task and several single point tasks running simultaneously on the board (it sounds like the latter is the case)?

Thanks,

Patrick
0 Kudos
Message 4 of 15
(9,698 Views)
Hi Patrick,

Attached is the VI that I made.

And yes, you can only have one clocked Analog Output task on one board at one point in time.   Since this 2nd task is not clocked then it does not conflict with the clocked waveform task.

Enjoy,
0 Kudos
Message 5 of 15
(9,682 Views)

Hi Otis,

I downloaded and ran your example VI, but it gave me the following error when trying to write the single point output (upper task -- had to add a "simple error handler" after the clear task so I could see the error description), and terminated on the first iteration of the loop.

"Error -200963 occurred at DAQmx Write (Analog DBL 1Chan 1Samp).vi
 
Possible reason(s):
Requested Sample Timing Type is not allowed, because there is already another task with analog output channels from the same device configured for a different Sample Timing Type. This is not supported on this device.
Change your application so that all the channels from this device are used in one task, set Sample Timing Type to On Demand for all tasks, or consider using two devices for the two tasks.
Task Name: _unnamedTask<4B>"
 
However, your example VI really does sum up what I want to do, so if we could get it working I'll be all set.
 
Patrick
0 Kudos
Message 6 of 15
(9,673 Views)

And I didn't mention it before, but yes you are correct in assuming that I use LabVIEW 7 (version 7.1.1 to be exact).

Patrick

0 Kudos
Message 7 of 15
(9,670 Views)
Hi Patrick,

I tried running the VI with a simulated PCI-6722 and didn't run into the same error.  You might want to see first if you can build a similar VI that does two one point operations and then maybe retry the example that I sent.  From everything I've tested though, the example should work. 

If you can't even get 2 AI one points working at the same time, let me know.
0 Kudos
Message 8 of 15
(9,651 Views)

Hi Otis,

I've modified the example you sent me so that it now does 2 single point operations (still in two parallel tasks), rather than one single point and one waveform. This works just fine, no errors at all, including when I get both channels to update on the same loop iteration. I've attached the VI to this post.

The error I get when running your original example is the same as the error I get when running my own applications; ie. it looks like the same timing type must be used in all tasks on a particular board. However, when I change all the tasks to waveform type, that's when I get the error that you can't have more than one task on a given board at a time. As reflected in the example above, when the VI with the waveform output is disabled all of the other VIs which do single point outputs to that board can happily run simultaneously. It seems unlikely, but perhaps there is some difference between the simulated PCI-6722 and my actual PXI-6722.

Patrick

0 Kudos
Message 9 of 15
(9,641 Views)

Patrick,

Remember, you can only have ONE waveform generation going at the same time as other single-point operations.  You cannot do waveform generation on channels 0 and 1 at the same time you waveform generation on channels 2 and 3.  There is only one timing engine and one FIFO for the waveform generation.  However, each channel can be used independently for single-point output.

So, you could do waveform generation on channel 0 in one task and then have 7 more tasks, each with on channel doing single-point output.

I hope that is clear.  It seems we need an example that shows how to do this.

Neil F. (former developer of E Series Analog Output code)

Neil Feiereisel
Principal Engineer, Modular Instruments, National Instruments
0 Kudos
Message 10 of 15
(9,637 Views)