LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write 2 AO tasks to a single device with 2 channels

I am working on a VI that should allow me to input coordinates for 2 voltage actuated piezos. The VI converts the location into a voltage and outputs the corresponding voltage. The basic program works well however, i i have been modifying it to test how the piezos will react to a ramp function voltage in order to assess its response. This is where i keep on running into trouble since i cannot seem to write to the 2 channels. Errors 201105 and 50103 keep on coming up.

 

I have attached copies of  the vi. Coordinate Writing is the original which works fine and V2 is the modified version that im having trouble with.

 

I would appreciate any help you can give on this. 

Thanks!

Download All
0 Kudos
Message 1 of 10
(3,234 Views)

Neither VI makes much sense. The one with AO function will only execute once and then stop. DO NOT USE the run continuous button.

 

The second VI has the same problem and more. You have a DAQ Assistant and a DAQmx Read. You cannot have both. You have to combine all channels into a single task. I also don't understand the purpose of the two while loops in the second VI. Even if you fix the VI and put a while loop around the code, there would be no acquisition done until you click the stop button so the comment 'Take points every Delay ms until Stop' is very wrong.

0 Kudos
Message 2 of 10
(3,225 Views)

Ok. The first VI works the way i want it to. My reasoning for the second VI is as follows:

1. I need the DAQ assistant to read the initial voltages before it ramps up to the newly specified value

2. Which run continuous button are you referring to?

3. How do i combine the channels into one task?

4. The 2 for loops are used to create a ramp function: It takes the initial voltage from the DAQ assistant, the final value from the cluster and ramps up the initial voltage value to this  new value. It is the output voltage of the 2 for loops that i want to write to the device (NI 9263)

 

As usual, my reasoning makes sense to me (and probably only me) so how would you approach the problem differently?

 

 

0 Kudos
Message 3 of 10
(3,221 Views)

I think I misunderstood. You only want to do a single acquisition correct? If so, since you are passing a couple of scalar to the bottom while loop, so you are only plotting those single points

 

I have no idea what the Versuch2.vi is doing and how you are creating the channels. You need to have the channels in your DAQ Assistant added there. The format for multiple channels is Dev1/ai0,Dev1/ai2 or Dev1/ai0:ai2.

 

It sound likes you just need to add the DAQmx Write at the end of the VI. Just use the Build Array function on the outputs of the case statement and wire that to the DAQmx Write input.

0 Kudos
Message 4 of 10
(3,218 Views)

Im an idiot! I just realized that i attached the wrong VI, the second attachement should have been the Coordinate Writing V2, which is a build up on the original version. Sorry about the confusion. Can you take a look at the new one and let me know what im doing wrong? That is the VI im having trouble with, not the Coordinate Reading one.

 

Sorry about that!

 

 

0 Kudos
Message 5 of 10
(3,211 Views)
You can't have two different tasks that use the same hardware run at the same time. In this example, you've got two analog output tasks. That is simply not allowed. Just like the comments for the other example, you have to combine all channels into a single task. You have a single convert clock for the muxed analog output and you cannot specify two different clocks
0 Kudos
Message 6 of 10
(3,201 Views)

From reading other comments, i know that i cannot have 2 hardware tasks run simultaneously.

 

How do i combine the 2 channels into one task?

0 Kudos
Message 7 of 10
(3,188 Views)

I figured it out, Thanks for your help.

I do have a follow up question though, i want to be able to plot the graph of the voltage across the Piezos (and hence the outputs) the whole time im ramping up the voltage to be able to gauge their response to the changing voltage. Any suggestions on how i can do this?

 

Attached is a copy of the modified VI.

 

 

 

 

0 Kudos
Message 8 of 10
(3,182 Views)
I don't think you can do that with the DAQ Assistant. I Haven't had much need to synchronize ai and ao. You should look at the example called Multi-Function-Snch AI-AO.
0 Kudos
Message 9 of 10
(3,169 Views)

Thanks for the help thus far. So rather than continuously plot the data, i want to save the data points in a spreadsheet instead with separate columns for the time and the 2 voltage values. One of the problems with the way i have it configured is that i get the values in pairs(in the same column) with a space inbetween every pair.

 

Any help you can give me on this will be great. I have attached the VI and a sample csv file of what the values look like. 

 

Thanks.

Download All
0 Kudos
Message 10 of 10
(3,149 Views)