LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

indexing arrays faster than event loop

I am an untrained but somewhat experienced LabView programmer.  There, now you know!  (Brief Application Description:  Two strain gages going to mcu a/d pins.  MCU packetizes the 10bit a/d data into a 3rd party message format.  This format has 8 data bytes which the mcu shoves a/d data into.  This data contains 2 samples of each a/d channel.  MCU sends this message to the radio.  Radio transmits data to receiver.  So the message coming over the air has 4 sets of a/d data that I care about: a/d0 sample0, a/d1 sample0, a/d0 sample1, and a/d1 sample1.)

I am running an event loop based on a callback function of a 3rd party DLL.  The message format that comes in has several data bytes that I use (currently 4 data bytes, but I'm likely moving to utilize 8).   The data is contained in one data string which I'm trying to extract for use.  I need to separate each a/d sample from the data string.  Currently I simply average the 2 samples and use that number.  However, I need to not average because I need better resolution of the data.  So my question is this:

With the event structure running and generating that data each time it fires, how can I extract out each a/d sample?  Right now there are 2 samples of each a/d, but I'm likely going to move to 4 samples of each a/d - so does my problem get worse?  (you can see the event structure and where I take the mean of both samples for use in the attached vi.)

First time forum user anxious for help!  Thanks.
0 Kudos
Message 1 of 3
(2,633 Views)
What do you mean with get a better resulotion?

You can leave the values in an array and use "Decimate array" to split the values into two arrays, one with the "lead/lag" and one with the "toes" values.

@Havelld wrote:
However, I need to not average because I need better resolution of the data.  So my question is this:

With the event structure running and generating that data each time it fires, how can I extract out each a/d sample?  Right now there are 2 samples of each a/d, but I'm likely going to move to 4 samples of each a/d - so does my problem get worse?  (you can see the event structure and where I take the mean of both samples for use in the attached vi.)




Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 3
(2,608 Views)
Thanks for responding.  Good point on the resolution.  The radio has a fixed message rate.  The more data I can shove into each message, the higher resolution over time the data is. 

I will try the decimate array.  However, I already split the data out by type (one array for lead/lag and another for toe up/down), the problem is that the calculations and graphing functions are only utilizing one of those data numbers.  The array indexes and just overwrites the previous number.  At any rate, I'm going to try your idea and I'm also going to play around with doing the decimation/indexing outside the event loop.

Thanks.
0 Kudos
Message 3 of 3
(2,574 Views)