LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

use DAQmx to write program for synchronizing voltage measurement

Solved!
Go to solution

I want to measure voltage with my cDAQ and C-Series Voltage Input Module. I want to use ai0 and ai1 to get two synchronizing waveform. But I can not even run these two channel in one programm. I can only use each one to create a subVI and use subVI for measurment in the third picture(messen is the subVI).  I have also fould examples of synchronizing measurment in this link: http://www.ni.com/tutorial/5376/de/ I  can not find the source for Timing and Trigger (cDAQ/ai/startTrigger). I want to know how to write a synchronizing measurement programm in a subVI. 

Measurement.PNG

error.PNG

seperate.PNG

0 Kudos
Message 1 of 14
(2,709 Views)
Solution
Accepted by topic author Young365

Combine BOTH channels into 1 task, do NOT use separate tasks for each channel.

 

If your device supports simultaneous sampling than they will be synchronized, if the DAQ multiplexed then there will be a small delay between digitization events.

 

mcduff

0 Kudos
Message 2 of 14
(2,696 Views)

yeh I know I should put them in one Task. But error occured when I write both of them in one Task. I have made a screenshot of the error. I don't know why.

0 Kudos
Message 3 of 14
(2,679 Views)

I cannot tell from the screenshot, you need to upload your VI if you require more in depth help.

 

Your screenshot showed two tasks not one.

 

mcduff

0 Kudos
Message 4 of 14
(2,677 Views)

yeh, I know what you mean. I have put them in one Task. You mean in this way these two signals are synchronized with each other? Another Problem is, when I put them in one Task, the highest sample rate is only half as before. Is there any method to make the sample rate stay constant? Because we want to measure high frequency Signals. And a high samplerate is also convenient for filter. Thanks.

 
0 Kudos
Message 5 of 14
(2,642 Views)

Hi young,

 


@Young365 wrote:

Another Problem is, when I put them in one Task, the highest sample rate is only half as before. Is there any method to make the sample rate stay constant? Because we want to measure high frequency Signals.

 

The sample rate is limited by your daq hardware: with a MUX the max rate goes down with the number of channels you need to read...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 14
(2,625 Views)

@mcduff wrote:

I cannot tell from the screenshot, you need to upload your VI if you require more in depth help.

 


Hello, @Young365.  I see you are a "New Member", so may not understand the above request.  Screenshots are static pictures of part of your code (imagine I showed you a picture of a few hundred lines of MATLAB code and asked for help …).  We can't edit a picture, can't "see what's hidden" in a picture, can't "run" a picture, ...

 

Here's what you should do to help us to be able to best help you:

  • Find the folder on your disk that contains all of the VIs that you are using for your Project.  If you are a beginner, it might only be a single VI, in which case you can skip the next step.
  • Compress the folder, which should create a .zip file with the folder contents (skip if your code consists of a single VI).
  • Attach the .zip file (or the single VI).  Now we have something we can use to understand your situation.

Welcome to the LabVIEW Forums.

 

Bob Schor

0 Kudos
Message 7 of 14
(2,622 Views)

We use NI 9205 for voltage measurement. And the maximum sample rate is 250kS/s. Earlier I used two subVI to make a two-channel-voltage measurement. So both of the channels have a sample rate of 250kS/s. I know sample rate will be only half of it when I make two channels in one Task. In this tutorial:http://www.ni.com/tutorial/5376/en/ (tutorial for cDAQ)

there are also other Methods to make a synchronized measurement (not in one Task). I have also tried these methodes and error occurs. So I want to know why I should make these in one Task and why other Methods in this Website lead to error.

 

Best Regards

 

Young

0 Kudos
Message 8 of 14
(2,608 Views)

@Young365 wrote:

We use NI 9205 for voltage measurement. And the maximum sample rate is 250kS/s. Earlier I used two subVI to make a two-channel-voltage measurement. So both of the channels have a sample rate of 250kS/s. I know sample rate will be only half of it when I make two channels in one Task. In this tutorial:http://www.ni.com/tutorial/5376/en/ (tutorial for cDAQ)

there are also other Methods to make a synchronized measurement (not in one Task). I have also tried these methodes and error occurs. So I want to know why I should make these in one Task and why other Methods in this Website lead to error.

 

Best Regards

 

Young


You have ONE Resource, the analog input of of your 9205. Only ONE analog input task can use it at one time. Your analog input is multiplexed, meaning than SAME A/D converter is used for ALL channels. Making two separate tasks doesn't magically give two independent A/D converters.

 

Your link for synchronization is for SEPARATE modules, not channels in the same module. If your cDAQ module supports simultaneous sampling, then ALL channels are synchronized, if your module is muxed, then there are slight phase delays between channels. (You are stuck with the hardware you have.)

 

Your program needs some work. I haven't looked at it in detail, but the acquire data VI in the loop is incorrect if you want a continuous data stream, you are stopping and starting the task inside the loop, you need to move the start and stop outside.

 

Look in the example finder for continuous DAQmx acquisition and study it.

 

mcduff

0 Kudos
Message 9 of 14
(2,591 Views)

Hello Mr mcduff,

 

thank you so much for your teaching:) And about the acquire data VI, I have also considered a lot. I tried to make a corrcect subVI such as the example I attached. I use two Array as Output of the subVI. But it makes no sense because Array can not come through the while loop. That's why I made it all in a while loop. I want to write the Signal Collection in one subVI and that's a start of the whole Programm.

0 Kudos
Message 10 of 14
(2,586 Views)