01-11-2012 04:07 PM
Hello,
I am correctly acquiring data and placing them continuously into an array. I want to look at the last 5 seconds of data whenever I push a button, in other words pushing the button would work as a time marker to tell labview to look 5 seconds back. If the values of data contained within the last 5 seconds are all greater than 1, a LED would light on. If the values of data contained within the last 5 seconds are between -1 and 1 another LED would light on, and finally if the values of data contained within the last 5 seconds are all less than -1, another LED would light on. Is there a simple way of doing this? I will appreciate your suggestions, thanks!
Best,
Nestor
01-11-2012 05:06 PM
Hello Nestor,
What do you have so far? Do you have a VI you can post? It's best to experiment around with arrays and see what works. One problem I see is the timing. How do you know "how far back" in the array to look. Is this a 2D array with a time stamp attached? How are you timing your acquisitions? It would be helpful if you could post your VI.
01-12-2012 04:30 PM
Hello Reese,
thank you for your time to read my message! I found an alternative way to solve my problem. Using shift registers worked for me in this particular applicaiton.
Best,
Nestor
01-12-2012 07:25 PM
Glad to hear it. If you could post a .png or your VI and mark as the solution, it could help others with similar issues.
10-17-2012 12:09 AM
Hello Nester,
Now I am facing the same issue with yours, I want to do a comparision in an array... how did you manage to solve this using shift rigisters? I would really appreciate your help. if possible, could you please post a picture? Thank you.
10-17-2012 02:28 AM - edited 10-17-2012 02:39 AM
@Nestor C wrote:
Hello,
I am correctly acquiring data and placing them continuously into an array. I want to look at the last 5 seconds of data whenever I push a button, in other words pushing the button would work as a time marker to tell labview to look 5 seconds back. If the values of data contained within the last 5 seconds are all greater than 1, a LED would light on. If the values of data contained within the last 5 seconds are between -1 and 1 another LED would light on, and finally if the values of data contained within the last 5 seconds are all less than -1, another LED would light on. Is there a simple way of doing this? I will appreciate your suggestions, thanks!
Best,
Nestor
Try using a 5-seconds worth of data Circular Buffer. Anytime you flatten the buffer, there's your previous 5 seconds of data in a waveform or array.
Check out this implementation
https://decibel.ni.com/content/docs/DOC-20403
If you are having a DAQ buffer larger than 5 seconds, you can perhaps calculate how far back in the buffer you have to point to get the last 5s of samples:
Br,
/Roger
10-17-2012 02:44 AM
presumably you are sampling at a fixed rate. Another option is too use queues of a fixed size (say 5 secs worth of data but you would have to work out how many elements that is) as your program is running use lossy enqueue so this will keep the previous 5s worth of data. When you push the button set whatever leds etc you need to and process the data by dequeueing until the queue is empty.
hope it helps
10-17-2012 02:44 AM
presumably you are sampling at a fixed rate. Another option is too use queues of a fixed size (say 5 secs worth of data but you would have to work out how many elements that is) as your program is running use lossy enqueue so this will keep the previous 5s worth of data. When you push the button set whatever leds etc you need to and process the data by dequeueing until the queue is empty.
hope it helps