Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Derivate of DAQ analog input

Hello,
 
I'm trying to calculate the rate of change of the analog inputs to my DAQ (USB-6210).  I'm reading voltages from 2 channels and I want to actively calculate the derivative of this changing data.  The rate of change of the voltage is very important for my application.  Is there any way I can do this?  I'm just a beginner with LabVIEW and do not really know how to manipulate data in arrays and stuff.  I don't think the derivative VI is working either.  I need to store the measurement from the previous second and then use the data from the current time to calculate the rate of change.  I guess it's easy but I must be overlooking it.  Any help would be great.  Thanks a lot.
 
Joe
0 Kudos
Message 1 of 3
(3,043 Views)
Hi Joe,

There may be a few ways to code your application in LabVIEW. You have already been looking at the derivative VI, which will take an array input and give you an array output. The purpose of this VI would mainly be to take a derivative of a signal that has already been acquired. This does not sound like what you need because you are trying to determine the derivative as the data is acquired. Thus I believe you have touched on the best method for your application: you will need to examine the last sample taken and calculate the slope between these two points.

To do this, you will need to pass the most recent value read from your acquisition to a shift register. You can then calculate the slope by taking the current value minus the previous value (from the shift register), then divide by the time between samples.

I assume that you are doing a continuous acquisition in a loop and the result is an array. If this is the case, then you can access these two samples without a shift register. You can use the index array function to extract a single element. The index of the most recent sample would be [array size] -1. The previous element will be [array size] -2. With each of these elements, you can then calculate the slope as discussed above.

I hope this explanation makes sense for your application. Please post back if you are still having difficulty. Thanks!

Mike D.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,031 Views)

Mike,

I found that the queue VI also works.  I believe that it is an emulation of a shift register and found it to be calculating the right numbers.  Thanks very much for your advice.

0 Kudos
Message 3 of 3
(3,029 Views)