12-28-2012 08:53 AM - edited 12-28-2012 08:57 AM
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?
12-28-2012 08:58 AM
You can just change the sample rate of your DAQ input. Use the DAQmx Timing VI.
12-28-2012 09:33 AM
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.
12-28-2012 02:58 PM
@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
01-02-2013 08:22 AM
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.
01-02-2013 09:35 AM
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.