LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquiring and generating signals

Solved!
Go to solution

is there a way to achieve synchronization without sharing sample clock rates ? I want to dev1 and dev2 to start reading at the same time so there is no phase difference between the two.

Rajnikant Singh
Iowa State University (Research Assistant)

0 Kudos
Message 41 of 54
(1,729 Views)

The definition of synchronization is that each sample is taken at the same time. This requires sharing a start trigger as well as a sample clock.

 

However, if you don't want synchronization, but just want to start sampling at the same time, all you have to do is share a start trigger. 

 

Leah

0 Kudos
Message 42 of 54
(1,728 Views)

Please take a look at the code and the pics I am attaching. I have set the rate to 250ks/s for all the devices because I want synchronization. When I increase the frequency the I am losing data, can you tell me how to avoid this. One pic has frequency set to 20Hz and other with lost samples is 100Hz.

Rajnikant Singh
Iowa State University (Research Assistant)

Download All
0 Kudos
Message 43 of 54
(1,723 Views)

Are you saying that the signal that you are measuring is 20 Hz and 100 Hz? What do you mean by losing data? Do you mean that your acquired waveform isn't perfectly sinusoidal? Or do you think that you aren't really sampling at 250 kS/s?

 

Leah

0 Kudos
Message 44 of 54
(1,681 Views)

First I am acquiring 20Hz signal which works fine, but when I increase the frequency to 100 Hz the signal does not look like a sine wave instead it looks aliased. I believe that I am generating at 250kS/s and also acquiring at 250kS/s. I attached my code for you to look at, please let me know what am I missing? 

Rajnikant Singh
Iowa State University (Research Assistant)

0 Kudos
Message 45 of 54
(1,674 Views)

Wow you are really confusing us here.  But I think the problem is exactly what you have written:  You are aliasing your signal.

 

 

 

 

http://www.medicollector.com
0 Kudos
Message 46 of 54
(1,667 Views)

 

Judging by the time axis from your graph, I don't think that you are measuring a 20 Hz or 100 Hz sine wave. It looks like the wave you are measuring is about 25,000 Hz. Since this is the case, the output that you are seeing is expected for your sample rate. I don't think that you are losing samples. 

 

To get a "smooh" representation of your sine wave, you would need to sample at about 15 times the frequency of the signal you are trying to measure. 

 

Leah

0 Kudos
Message 47 of 54
(1,664 Views)

thanks for clearing it out, it was helpful. I am a software engineer I totally missed this:). Now, I am having confusion in understanding how the rate and samples per channel of daqmx timing vi. works. The way I understand is that to generate a sine wave of frequency 100Hz with sampling rate of lets say 500 samples/s means that there would be 500 samples per 100 cycle which interprets into generating 5 samples/cycle. Am I right over here ? and two generate two cycles I would have to generate 10 samples and so on. Please clarify this, this is getting really confusing to me. Ultimately I want to be able to control the number of cycles to pass through a ferromagetic material which is a part of my project. 

 

 

Rajnikant Singh
Iowa State University (Research Assistant)

0 Kudos
Message 48 of 54
(1,657 Views)

Samples per channel specifies the number of samples to acquire or generate for each channel in the task if sample mode is Finite Samples. If sample mode is Continuous Samples, NI-DAQmx uses this value to determine the buffer size. 

 

I found this document in the DAQmx help file that explains this. 

 

http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/buffersize/

 

Leah

0 Kudos
Message 49 of 54
(1,637 Views)

According to the block diagram attached, how many cycles should be generated according to you ? I am getting 3.5 cycles generated.

Rajnikant Singh
Iowa State University (Research Assistant)

0 Kudos
Message 50 of 54
(1,632 Views)