12-13-2017 10:32 AM
Dear Lab-View explorers,
I want to build some kind of scope with NI-6229 card. I made some preliminary program but I have a problem with data reading. In the program I've built I want to read analog signal from some device. First I've connected the function generator to the card to check the program but I have a problem. When I deliver low frequencies it is not problem at all.
Here is the picture with Measurement&Automation Explorer: (10Hz as I see in the function generator)
And the program itself:
But as I increase the frequency the program shows me some mess unlike the measurement&automation explorer.
Can you tell me please where is the problem?
Thank you.
12-13-2017 10:57 AM
Try it with a higher samplerate 🙂
Even old analog scopes had a bandwidth of 1-2MHz ..
Digital scopes choose the samplerate according to the horizontal setting (time/div)
While one could say, that ~1000 points are fine for the resolution of your screen .. if you want to capture small pulses .. go for 10k to 50k points.
12-13-2017 01:50 PM - edited 12-13-2017 01:52 PM
Thank you for your answer.
Check this out for the case of 100Hz.
Here is the screenshot from the program:
And here is from the Measurements&Automation Explorer:
I dont understand why it is not the same? I put the same parameters but I see the big difference here.
12-13-2017 03:43 PM
Here the updated file.
12-14-2017 03:53 AM - edited 12-14-2017 03:56 AM
Try to avoid the express vis 😉
Do the setup (and DAQmx close) only once and than read more than one sample per read !
currently you don't read at the specified samplerate, you open and configure the DAQ read one sample per channel and close the DAQ task in a loop.
use a state MC
read about 500 to 50k samples at once. Since your eye only updates about ~30 times per second (more or less)
you should update your screen at a not higher speed.
I would use 1D wfrm array out.
Have a look at the shipped examples !
12-17-2017 05:49 AM - edited 12-17-2017 05:51 AM
Thank you, man. Now it works better. Please, find the attached file. The next step I want to measure the frequency of the signal. The program I found here (https://forums.ni.com/t5/Example-Programs/Measure-the-Frequency-of-an-Analog-Signal-using-a-Counter/...) doesnt work because:
When I try to put Digital Edge as the program suggests me it writes me that my device (NI-6229 [http://www.ni.com/pdf/manuals/375204c.pdf]) doesnt support this kind of trigger.
What do you suggest me to do?
Thank you.
12-17-2017 11:37 AM
A very easy and accurate method if you have an analog signal and want to measure the frequency:
Give the tone detection.vi a try. (you should capture more than 10 periods ... )
12-18-2017 02:15 PM - edited 12-18-2017 02:21 PM
Thank you. It didnt work, but before that I've paid attention that something wrong with the presentation of the wave. It doesn't represent right the wave I deliver to the NI card. Take a look at the picture I get when I deliver from the scope approx. 1kHz (samples to read=1000, rate=1000).
It doesn't seem like 1kHz for sure. Why is that?
Strange that the same picture I get from the Measurement&Automation Explorer with the same parameters (samples to read=1000, rate=1000) and delivered frequency of 1kHz.
Thank you.
12-19-2017 04:11 PM
Hi dimani4,
I took a look at your code attached here. Is this the one that corresponds to the top graph? I see two while loops in the VI and the sample clock on the outer VI. Having two loops and the sample clock in the while loop will cause unexpected behavior.
Which example did you end up modifying?
Cici Z.
Applications Engineer
National Instruments
12-20-2017 05:56 AM
Hey Cici,
Thank you for your response.
I've pulled out the sample clock outside the while loop. But the situation is quite odd. Still I didn't get the right frequency with the parameters of (rate=1000, samples per channel=1000). Take a look at the screenshots:
This is from the program:
And this one from the Measurement and Automation Explorer (samples to read=1000, rate 1000):
This frequency does not seem like 995Hz.
I don't understand what is wrong here....
Please find the attached program.