LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Individual Values From 4351

I would like to insert values I'm reading from a 4351 into a rotating array for manipulation. I'm pretty sure the way I'm building/rotating the array is sound (I tested it with a an arbitrary signal) but when I attempt to acquire data from the 4351 - it doesn't work. How can I access those values? 

 

My other question is what should the dt be to build the 4351 array into a waveform? The 4351 will read one data point each iteration of the while loop - so the wait I program into the while loop should be the same as the waveform dt, right?

 

Andrew

Andrew
0 Kudos
Message 1 of 4
(2,690 Views)

What are you attempting to with that Insert Into Array?Replace Array. The data returned is always the same format. It's returning a 2D array and if you want to reduce that to a single element, your code is way too complex, Create an indicator for the array, run the VI, make current values default, save, attach that.

 

Yes, dt is your loop rate, which is silly to use an EXT. Silly to use anything except an integer.

0 Kudos
Message 2 of 4
(2,672 Views)

Dennis,

 

I've worked out a couple of my kinks - I'm sure my revelations are not news to you, but it's always a good feeling when the lightbulb goes on.

 

My rationale for making my loop rate 16.667 is that the 4351 redlines at 60Hz. To make sure I'm sampling as fast as possible, shouldn't the wait time be 1/60 seconds?

 

Adding an indicator was the first thing I did, but it only displayed zero. Actually it would flicker between zero and whatever voltage I was feeding the 4351 - regardless, it wasn't doing me any good. I slowed my loop rate down to 1s and then I could finally see the values on the indicator and things started to make sense. The 4351 takes as many samples as it's 60Hz sampling will allow it in the wait time - but I've discovered it doesn't live up to that 60Hz. The wait time has to be at least 250ms for it to poll one sample. I indexed the 2D array to get the first column, and then averaged that array to get a single value. I attached the revised VI.

 

The purpose of the insert/replace structure is to build a moving window of the M most recently acquired values. I'm trying to detect when a signal has settled (picture an underdamped step response). My plan is to fit a polynomial to the data in the window (so I'll have an array of time values as well), take the first and second derivatives of that polynomial, evaluate those at the median of time array. When the derivatives go [close enough to] zero, my signal has settled. That insert/replace structure has been used in other Savitzky-Golay implementations, so I think it's sound.

 

Andrew

Andrew
0 Kudos
Message 3 of 4
(2,655 Views)

I don't have the 4351 driver or tradtional DAQ but I would assume that you set the sample rate with a function in the driver - it would not be set with a wait statement. The wait would set the time between an acquisition at a specified rate. The reason I called your use of that silly is that you had a DBL wired to a function with msec resolution.

0 Kudos
Message 4 of 4
(2,648 Views)