LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to acquired data from "0"

Hi everyone. I'm trying to acquire data to an array and then do some other options. In order to make the data placed in a rising sequence I want to have the array start from "0". To be specific, I want it to be "0,1,2,3" instead of "1,2,3,0" or "2,3,0,1". Now I'm trying to achieve this goal by using case structure and when the first data of the 1D array is "0" then start save the data to the array. 2 days ago I made the code work but afterwards it cannot function as I wish. I think there must be errors which I didn't figure out. Any feedback would be helpful. Thank you!

 

Hereby is my code. 

 

read data.png

0 Kudos
Message 1 of 7
(2,190 Views)

In my experience in the world of data acquisition

 

"zero is a fictitious number".

 

Comparing to "0" will only work if there is something wrong.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 7
(2,174 Views)

Agree with @SirBen.

 

You are looking at an analog input and trying to save on the condition when that input exactly equals 0. Unless you have a noise free environment, the chances of that happening are little to none.

 

Check to see if the value is in a specific range instead of zero. Best case scenario, ± 1 bit from 0, but you would probably have to increase this. However, that is not a good assumption, I would go with at least ± 5 bits on either side of zero. Note this assumes your digitizer has no DC bias. If it does then I would go with at least ± 5 bits on either side of the signal mean(DC Bias).

 

mcduff

 

PS Don't use a timed loop. Let the acquisition rate control the loop.

0 Kudos
Message 3 of 7
(2,144 Views)

The range should be around ±0.02 on either side of zero. But I found that the computer can only work out at most 0.3 on either side of zero. 

0 Kudos
Message 4 of 7
(2,065 Views)

@chen3477 wrote:

The range should be around ±0.02 on either side of zero. But I found that the computer can only work out at most 0.3 on either side of zero. 


Use In Range and Coerce

snip.png

 

Not sure what you mean in your second sentence. If the Offset is 0.3V, then either look at the range 0.28 - 0.32V or subtract the mean from your signal such that it is centered at 0.

mcduff

 

 

0 Kudos
Message 5 of 7
(2,057 Views)

Sorry for misleading. I mean the range should be from -0.02 to +0.02 but when I set like this, the code can't work out. So I enlarge the range and when it goes from -0.3 to +0.3 it works. 

0 Kudos
Message 6 of 7
(2,052 Views)

You're only looking at the first sample of the N=20 samples you are grabbing.  If you have a lot of noise, maybe that first sample is only rarely falling in the tighter +/-0.02 range.

0 Kudos
Message 7 of 7
(2,046 Views)