PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I write multiple sample waveforms on different channels?

Hi, I have looked through the examples and stuff on the net but I cannot find anything that will allow waveorms written on different channels.  I just get an error that states that the write function is allocated somewhere else.  I took a screen shot of the code I have written.  I am sure that I can create waves on different channels, but I do not know how.  I have a PXI-6723 analog card.  I need to write to two different channels with just a slightly different waveform.  Thanks, Fred
0 Kudos
Message 1 of 7
(4,761 Views)

Hi Fred,

 

You can certainly output two different waveforms on two different channels, however, there are a couple caveats to this. You can only have one task for this output because your analog output board only has one AO sample clock. This means that if the "slightly different waveforms" that you are trying to use are different because of their timing qualities then you cannot generate them both at the same time using "Use Waveform" for your timing. If the timing parameters for each of the waveforms is different there will be a conflict in what timing is actually used, which means the VI will use whichever configuration VI it gets to first, which should throw an error. The way around this is to use sample clock timing with the AO Sample Clock. Now with the rate you set for this and the number of samples that you use to represent your waveform you can generate whatever you want for both signals. I would suggest modifying the waveform to output to be one period of the square wave you want and changing the number of samples you use to represent that one period. For example if you want one of your square waves to be running at 1000Hz and the other to run at 100Hz, both with 50% duty cycle, then you can set your sample clock frequency to be 10kHz. Then you would set the single period of your first square wave to use 10 samples (5 high and 5 low) and set the single period of your second square wave to use 100 samples (50 high and 50 low). To combine the two signals you can just append the waveforms together and set your DAQmx Write VI to use N samples, N channels and then specify the two channels in the one AO channel input at the DAQmx Create Channel VI. Hopefully this helps out.

 

Chris W

0 Kudos
Message 2 of 7
(4,749 Views)

Is there any way that you could send me some example code.  I have been trying to get how you did this but to no avail.  Thanks

0 Kudos
Message 3 of 7
(4,742 Views)

If you have some revision to your code that you would like me to take a look at, I would be willing to do this. Would you mind posting a VI?

 

Chris W

Message 4 of 7
(4,736 Views)

Hi Fred,

 

I decided to create an example. I posted this example on the Developer Zone Community site. Here is a link to the code that I posted. The code that is posted was written in LabVIEW 8.6.

 

Chris W

0 Kudos
Message 5 of 7
(4,708 Views)

Thanks, I forgot to post that I had gotten it. 

Fred

0 Kudos
Message 6 of 7
(4,700 Views)

Hi Fred,

 

I would encourage you to post your code on the community site that I had linked to as well, if you feel it could be useful for the community. Glad to hear that you got it working, though.

 

Chris

0 Kudos
Message 7 of 7
(4,696 Views)