Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Building scope with Ni-6229

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)

1.jpg

And the program itself:

2.jpg

 

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.

 

0 Kudos
Message 1 of 12
(3,110 Views)

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.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 12
(3,102 Views)

Thank you for your answer.

Check this out for the case of 100Hz.

Here is the screenshot from the program:

3.jpg

 

And here is from the Measurements&Automation Explorer:

4.jpg

 

I dont understand why it is not the same? I put the same parameters but I see the big difference here.

0 Kudos
Message 3 of 12
(3,084 Views)

Here the updated file.

0 Kudos
Message 4 of 12
(3,073 Views)

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 !

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 12
(3,055 Views)

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:question3.jpg

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.

question4.jpg

What do you suggest me to do?

 

Thank you.

0 Kudos
Message 6 of 12
(3,038 Views)

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 ... )

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 12
(3,028 Views)

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).Untitled.jpg

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.

strange 1Khz.jpg

 

Thank you.

 

 

0 Kudos
Message 8 of 12
(3,016 Views)

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

 

0 Kudos
Message 9 of 12
(3,000 Views)

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:

 

995Hz.jpg

And this one from the Measurement and Automation Explorer (samples to read=1000, rate 1000):

995Hz_Measurement and automation explorer.jpg

This frequency does not seem like 995Hz.

 

I don't understand what is wrong here....

 

Please find the attached program.

0 Kudos
Message 10 of 12
(2,995 Views)