LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generate and record with NI 6251

Hi,

 

i have a NI 6251 and want to generate n periods of a signal and record it again.

 

Recording should start at the same time as the generator starts.

I tried something, but i got stuck. Perhaps you can give me a good hint?

 

I tried the Codecapture Tool to show my code here. Hope used it

================================
system: Win7 and debian stable
Download All
0 Kudos
Message 1 of 9
(2,742 Views)

Hi Jonas,

 

could you please post some default values of tau 1 and S per Period for which you want your VI to work. Problem is that frequency and rate have to fit together. When I used reasonable values it worked - the signal could be seen on the waveform Graph. When I checked out your code I figured, that you always use one VI too much for each virtual channel. Just don't use the create virtual channel VI's without setting it to e.g. "Analog Input".

 

If you could explain your code a little more, esspecially the timeout part of your event structure I will be glad to look over the topic once more.

Kind Regards

0 Kudos
Message 2 of 9
(2,725 Views)

Hey Jonas,

sry I mixed something up. I didn't see that you were creating tasks before each virtual channel. That's totally fine. But there is one big thing wrong in your code:

 

You are using "finite samples" while setting up your sample VI for data input. Doing so is alright - but than you can't use a "while-loop" to retrieve this data using a read VI since data is written to the Output channel only once with a finite number of samples. Actually there are some parts in your Code which don't go together like that (e.g. your read VI is set to read from multiple channel - which you don't have). I advice you to look at the example "Multi-Function-Synch AI-AO"

which shows you how to synchronise your in- and output easily. (just alter the code of the example using your event structure and signal conditions)

 

I hope this helps a little...

0 Kudos
Message 3 of 9
(2,714 Views)

i tried the NI example and connected AOut1 --> AIn1 and set the switch to common ground.

It generates a nice signal and i can record it.

I generate a RAMP and i think it should start at 0mV, but it starts at a negative value.

Can i improve this?

================================
system: Win7 and debian stable
0 Kudos
Message 4 of 9
(2,709 Views)

Hey your Code now looks better 🙂 two things came to my mind checking your code:

1.) Your Error-merge VI looks somehow wired -> please check on that

2.) look at the examples again. Most of them use a Trigger VI and sequence structure in order to synchronize in and Output instead of the Errorlines that you are using. Try that and if you get stuck again just post you code in labView editable form so that I can help you improving it to your needs

Best regards

0 Kudos
Message 5 of 9
(2,695 Views)

the code above was 99% from an NI example. Even the strange errormerge is part of the original file.

 

could you post a link to an example, that could fit?

i am digging through the trigger examples since hours, but i do not find an example that is similar to my problem.

 

I want to generate for example 10000 samples and record them at the same time again.

================================
system: Win7 and debian stable
0 Kudos
Message 6 of 9
(2,693 Views)

Hey Jonas,

 

now I finally figured what you problem was. Just use the property node for the read vi and set an offset off 1.

If you don't want the Signal to be moving in your graph while continuesly acquiering data in the while loop - make sure to set the number of samples to any numbe ending with 99.

One more thing - I am not so sure, why you want to use an external counter for setting the sampling clock. That way you can only use predefined frequencies - the counter only has certain steps to count down the onboard Clock.

 

Using the onboard clock directly will give you far more possibilities to set the frequency to any random number you can think of.

 

I hope this helps you a little bit.

 

Best Regards

0 Kudos
Message 7 of 9
(2,682 Views)

thank you so far, but a .vi is missing to run your attachement.

 

There was no reason to use the external clock.

The signal should not be recorded continously, but 1 time with a given number of samples

================================
system: Win7 and debian stable
0 Kudos
Message 8 of 9
(2,677 Views)

Hey Jonas,

hopefully you found the missing vi. If you didn't... Just open the example "Multi-Function-Synch AI-AO-Ext Dig Trigger.vi" and copy the vi "Get Terminal Name with Device Prefix.vi". I am sure by looking at the layout of the code you'll find the correct vi quiet easily.

 

On my Computer this example was perfectly synchronised.

 

Let's hope his solves your problem

0 Kudos
Message 9 of 9
(2,668 Views)