SignalExpress

cancel
Showing results for 
Search instead for 
Did you mean: 

external aquisition rate

Hey,

 

Ok so that vi is NOT going to achieve the desired behavior.  First off you are trying to use Traditional NI-DAQ (legacy) drivers (Ai one point.vi) with NI-DAQmx Drivers.  IN your case you should be able to use all NI-DAQmx devices.  And you should be able to use only one device (NI-6251)  I modified your example to create and analog input task and then use the AI Sample clock that is derived because of that AI Task as the sample clock for the counter task (Event count).  You will notice that they both sample at the same rate and are synchronized. time and return 1000 samples every time 1000 samples has been achieved in the DAQmx Buffer

 

Because we chare the sample clock and the start trigger we are ensured that the tasks are synchronized. 

 

 

Charley Dahan

Global Account Manager
Download All
Message 11 of 41
(4,539 Views)

Ok, so this program makes much more sense.  I am still puzzled on how I get the analog pulse--which determines when I sample my Analog Voltage input---to also correlate to specific wavenumbers (start at a reference frequency and then each pulse thereafter correlates to the measurement of the analog voltage at the next wavenumber).

 

Thank you very much. This has all been quite helpful.

 

John 

0 Kudos
Message 12 of 41
(4,535 Views)

And here is what I have so far.

 

I'm still having trouble creating my graph though (analog voltage = relative intensity @ each sampling time (analog pulse)). I know the two are synchronized with this program, I just need to define a graph where the measurement taken increases with each consecutive pulse--therefore correlating with the respective frequency of the voltage sampled. 

0 Kudos
Message 13 of 41
(4,534 Views)

Your program looks identical to my screenshot.  I don't know how you want to interpret the data. You should be able to develop some kind of arithmetic that interprets the data.  You currently have your analog voltage in the array "Analog Data".  You also have a event count in the Counter data.  This counter data represents the number of rising edges that was seen that the counter since starting the task. 

 

It is therefore up to you to determine the best course of action to interpret this data.  Note that each element of each array corresponds to the same sample.  for example element 2 of each array corresponds to the same samples.  

 

My question to you is what exactly does this square wave pulse mean?  what is used for?  Is it suppose to represent the frequency at any given time? Do you need to calculate frequency from this square wave? if so we will have to modify your code to use a frequency task.  

Charley Dahan

Global Account Manager
Message 14 of 41
(4,529 Views)

I'm sorry my VI looks identical to yours. I played around with different wiring and functions for hours to try and get the ideal program. What it comes down to is that I have yet to adequately understand all of the functions already in the program. I am getting better every day though, and your replies are helping more than anything. So thank you.

 

The original purpose of the square wave was to drive a stepper motor in a pen, strip chart recorder. Each pulse would move the knob one click and each click (or slight turn of the knob) would correspond to one wavenumber (or specific frequency).

 

What I need to do is set a user inputted reference freqency and then once the  experiment starts running, each pulse will correspond to the next additional wavenumber (on the x-axis of my final graph) and a reading of the AI input will be taken simultaneously (my y-axis on my final graph).  

 

I do not need to calculate the frequency of the square wave. It does represent the frequency, but only from simple (+1) arithmetic when given a reference (user inputted) frequency to start from. This is what my professor is assuming. I am fearing that perhaps the number of pulses buffered by a delay in time will also correspond with specific frequencies. This would alter my original finalized program some, but I still want to develop the "+1 wavenumber with each pulse, while consequitively taking an AI voltage reading" program. I do not need to calculate the frequency of the square wave itself.

 

In the end, actually, I need to display both an array of wavenumber vs intensity and a graph of it. 

0 Kudos
Message 15 of 41
(4,527 Views)

PLease see the attached small section of code that you could incorporate in you VI to manipulate your data. and plot that information to a graph. 

 

If you would like more information on the functions used use the Context Help (Ctrl + H).  Anytime you hover over a function or subvi it will display quick information as to what that function does and if you select detailed help it will show you more information on that particular function. 

 

This Vi scales the square wave information. and bundles it in an X-Y cluster and plots it to an x_y graph. 

 

It should be noted that the counter will only count up in this case because the counter cannot determine which direction the servo motor is going.  Unless you have a quadrature encoder It is impossible to determine which direction the motor is suppose to go.  Therefore in your case with only one signal you will only be able to Count up OR Down. If this is ok then your good togo.  If not you will need to determine if your spectrometer has an encoder and then you will have to wire it up properly (see links below) You will then have to modify your code to take Encoder measurements (position measurements). --> See links below for more information on counters. 

 

http://zone.ni.com/devzone/cda/tut/p/id/4763

http://zone.ni.com/devzone/cda/tut/p/id/7109
http://zone.ni.com/devzone/cda/epd/p/id/1721

Message Edited by CharlesD on 06-15-2009 12:53 PM
Charley Dahan

Global Account Manager
Message 16 of 41
(4,498 Views)

Hello CharlesD,

 

Thank you once again for the awesome help. Unfortunately I cannot open the code you attached, since I am using Labview 7.1. The code you attached was written in Labview 8.0.

 

I use the context help box all the time, thanks. 

 

So am I understanding you correctly when you talk about your attached VI? It scales the square wave info and bundles it into an X/Y cluster--plotting it to an x/y graph? So, does this mean that both the X and Y corresponding data for the graph Both come from one signal, or two? 

 

Just so I can feel confident that I have explained my desired program correctly, I'm going to try and do it again now, but in a more clear way.

 

The spectrometer is giving off two signals. One is a constant analog pulse (where I receive my x-axis info). The # of pulses per unit time may change. But, the actual frequency of the wave-like signal will not change.  So, from this signal, I need to determine at what frequency I am sampling (my other AI voltage) at any given time.  I will start at a reference frequency (eg. 0 cm-1) and then every (lets say 2 pulses), I then sample my AI voltage. This would mean that every 2 pulses would correspond to 1 x-axis unit (cm-1), and I would then sample the variable AI voltage input every cm-1 (or every 2 pulses). I am not measuring the frequency of the constant analog pulse signal. I am determing the frequency of the AI variable voltage I am sampling (from the # of pulses that have occured), at any given time. I need no info from the constant analog pulse other than: 1. Determining how many pulses correlate with a single unit on my x-axis (wavenumbers or cm-1) (This will probably be done by me, through experimenting with the final program). 2. Writing a program which can correlate (for example every 1 or 2) pulses with a single x-axis increment. 3. Taking a sample of the other AI variable volatage at every x-axis increment. 4. Plotting the corresponding x and y points in an x/y graph, as well as an output array of X (wavenumber) and Y (intensity) values.

 

I don't think it matters that the counter program you talk of can only count up. This should still work. 

 

Thank you again. I'm getting there.

 

Regards,

 

John 

0 Kudos
Message 17 of 41
(4,495 Views)

 OK.  That explanation seems to make more sense! Sorry about sending you 8.0 version.  I've attached screnshots and a 7.1 version of the vi.  I'm pretty sure this will get you going.  Remember that this section of code has to be added to your original code and will likely have to be modified a little to make it work properly to deal with some of the array manipulations that may be required!  Give this a shot and I think that it will get you on the right track. 

 

 

Datas manipulation.jpg
Data Manipulation FP.jpg

 

Message Edited by CharlesD on 06-16-2009 11:39 AM
Charley Dahan

Global Account Manager
Message 18 of 41
(4,491 Views)

CharlesD,

 

Thank you very much. I am now integrating this new code with my code in progress. One question--Do I need to include all of this in my while loop? I am assuming so, but just checking.

 

Also, I need to test the program before I actually hook it up. Is there simple advice you can give for that? Should I use a simulate signal function?

 

Here is the updated code:

 

Thanks again for all your help. 

0 Kudos
Message 19 of 41
(4,485 Views)

No you do not... you actually should put the initial frequency and frequency per count controls to the left of the while loop and wire that information in because those values should not change while the loop is running (unless you want that functionality).  If you put those controls outside of the loop than that information is polled from the controls once and is passed to memory (the tunnel of the while loop) once and is read from there everytime.  This is more efficient than polling the control every time the loop iterates.

 

If you have a function generator or some sort you could easilly hook it up to your anolog input with some signal that is representative of the behavior you expect.  In general though you shouldn't have any problems hooking it up directly (you won't break your system unless you pass information that is larger than the maximum voltages to the DAQ card).  In general your program is basically ALL data acquisition and very little actual data manipulation so using the actual hardware might turn out to be more useful than using a simulated signal - thats my own opinion.  If you don't have access yet then use some external function generator and then wire that into your DAQ device to actually test the DAQ part of your program

 

Good luck!

Charley Dahan

Global Account Manager
Message 20 of 41
(4,469 Views)