LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing sample rate based on variables

I'm looking to get my timing down on my data measurements. I'm trying to take 100 readings of a sine wave, no matter what the frequency is. So I would like to set up some sort of static input control on my front panel that would allow me to decide on four frequencies. 0.1, 1, 5, 10hz. After inputting this frequency, I then want to tell my sample clock to only take 100 readings. I have a numeric control for how many cycles my VI will measure before stopping.

 

So, if I put in 10 cycles into this numeric, and 0.1hz into this new control I'm trying to fashion, it should take around 100 seconds. which means a sample a second. And, if I put in 1hz, it should run for 10 seconds; which means 10 samples a second, etc.

 

What's the best way to accomplish this?

0 Kudos
Message 1 of 6
(2,761 Views)

You can just change the sample rate of your DAQ input.  Use the DAQmx Timing VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 6
(2,758 Views)

I'm not using DAQmx. I'm using ULx. And my sample rate is defined by my cycle count and frequency....I can't just change the sample rate. I'm looking to create a user input scheme. Where I can input a variable and it will change my sample rate based on that variable.

0 Kudos
Message 3 of 6
(2,752 Views)

@glskinner wrote:

I'm not using DAQmx. I'm using ULx. And my sample rate is defined by my cycle count and frequency....I can't just change the sample rate. I'm looking to create a user input scheme. Where I can input a variable and it will change my sample rate based on that variable.


 

 

The introduction section of the ULx for LabVIEW Quick Start Guide says, "The ULx syntax is consistent with NI LabVIEW DAQmx VIs," so I imagine that anything in DAQmx will have a counterpart in ULx.

 

You got the hardest part done already - you showed how you arrive at the number of samples and the sample rate.  Now all you have to do is look up how to set up your sample in ULx (if you have the docs for that) or, with just a little imagination, you can use the DAQmx help just as effectively.

 

Unfortunately, I can't open the VI.  How far have you gotten?  Where does the problem lie?

 

 

Bill

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(2,723 Views)

Honestly, the problem lies with my knowledge of Labview. I'm not sure how to create a interface on my front panel that will take in an input like: .1, 1, 5, 10hz. I think If i could get the basic concept of a variable switch, I could create the code without a problem.

0 Kudos
Message 5 of 6
(2,675 Views)

You have several options. Combo box, listbox, text ring, menu ring, enum, radio buttons, slides - all provide for selecting one of several choices. Depends on the look you want and the datatype output. Drop them all on a front panel, turn on context help, look at the terminals on the block diagram, experiment, and then decide on exactly what you want.

Message 6 of 6
(2,666 Views)