09-21-2009 02:20 PM
I had thought I knew how to do this... but it's a Monday. Looked through the examples to no avail.
I have a PXI-6733 I am using to generate 4 AOs. All AOs are in the same task as they should be. I start the task with initially starting up the VI.
1) Two of the AOs are used to write out continuous pressure data to another system and therefore run continuously and need to be uninterrupted.
2) The other 2 are for sending out Analog command signals as configured by the user during runtime (sine's, ramps, sawtooths, etc.) to a couple controllers. The user can change the output waveform parameters and then "say go".
I can successfully configure the buffer: set the size and finite samples for the user configured AOs during runtime. But when I use the "DAQmx Write (Analog Wfm, 1 Chan Nsamp)" with the user waveforms, I get the -50103 Error (The specified resource is reserved....). I am using the global virtual channels as the inputs to these blocks so I can get to these channels only.
I don't want to "stop" the entire task (all of the channels) and then restart them when the user makes changes. I just want to start writing the buffer on two of them.
Have I lost my mind? Isn't there some way to do this?
09-21-2009 05:36 PM - edited 09-21-2009 05:37 PM
Hi bradh,
I would suggest to start with the AO Non-Regeneration example:
Help >> Find Examples... >> Hardware Input and Output >> DAQmx >> Analog Generation >> Voltage >> Cont Gen Voltage Wf-Int Clk Non-Regeneration.vi
You will need to slightly modify the code to work with multiple channels. It will end up looking something like this:
The above would allow you to give an array of Sine/Square/Triangle/Sawtooth wave parameters for the different channels and update them on the fly based on user inputs. Since your signals are all being defined differently, you might need to change up the code a little bit, but the idea is that you write all of the channels at once with new data to be generated.
Best Regards,
09-22-2009 12:26 PM
John,
Thanks, I understand what you are doing. One question though - you are rewriting all of the channels in the task in your for loop. Is it possible to write say only 2 of the 4 using two "Write Analog Wfm, 1 Channel, Nsamp"? (All of 4 channels/wfms are at the same sample rate.) I just need to change 2 of them without stopping the other 2 in the task?
09-22-2009 01:20 PM
09-22-2009 04:52 PM
Hi guys,
It isn't possible to only write to one of the channels at a time in a hardware-timed operation. Since the analog output circuitry shares a single timing engine, all clocked analog output lines must be in the same task. What I was getting at in my last post is that you can continue to output any desired signal to your channels in this task. This signal is defined in software, so if you want to only change a single channel it would certainly be possible to only adjust one channel in your array of data and continue to output the same data on the other lines. This is what the code should do that I posted in my last post.
Also, you can put software-timed Analog Outputs in seperate tasks. Software-timed Analog Outputs will only allow you to write a single value at a time (but you can write over and over based off of a software loop).
What exact signals do you need to generate? For function generation (sine wave, sawtooth, etc.) you should probably use a hardware-timed, buffered operation mentioned in my first post. The user could change the parameters of these signals on-the-fly since the data is constantly being streamed to the board. The datatype being used in my last post is a 1D array of waveforms--every element is the waveform that will be written to a different channel in the task. To turn a channel "off" just set this waveform to output 0s.
If you want the pressure data clocked off of the same AO clock as the function generation, you could simply build this data into your array that you are writing to the DAQ device. If you don't need the data to be clocked (e.g. if it's a DC voltage level) then you can always put this into a seperate task that does not include any timing and run it in parallel with the hardware-timed task.
Best Regards,
John
09-18-2015 07:57 AM
How did you build the cluster that gets unbundled in your example?
I tried to use an array but i couldn't get the Waveform Type:string inside it :-(, with cluster i can use only one (?) user Panel?
Can you please give some insight how to build the input cluster? Thank you!
09-18-2015 08:01 AM
Two things here. FIrst this thread is from 2009. You should start a new qestion asking this.
THe second is you use a custer not an array. The cluster is located int he cluster palette.
09-21-2015 09:44 AM
Okay I know this is an old thread but it reminded me of a technique I used to accomplish this.
So I had two AO in one task, both were PWMs at the same frequency, but different duty cycles. I had a need to change the duty cycle of either AO while the program was running, but not stop the task, because I didn't want the other channel to stop.
The way I did this was I setup the continuous task and wrote my two arrays of set points and had it start. Then when I wanted to update the values, I used a DAQmx Write property node and set the RelativeTo to 0. This set my write point back at the start of the buffer. I then generated a new duty cycle buffer for both channels, and wrote them. What this did for me was replace the output setpoints I put on the hardware with a new set of points. A limitation with this technique is the buffer size needs to be the same, and in my case they were because the frequency, and number of cycles in the buffer didn't change, just the duty cycle.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord