LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

This works but I need to add control; Help PLEASE!

O.K. I am attaching a program I wrote to capture two signals using LabVIEW 7.1 from a 6036E PCMCIA. As you will see, the program captures the two signals data. From this data I can move the cursors and determine the amount of time elapsed from a change in signal zero and a change in signal one. My problem, my question, my headache is, how do I get it so that LabVIEW automatically detects the changes and reports back the time difference? It is highly inaccurate for me to position the cursors. Is there a way that labview could be programmed to detect the changes and calculate the difference of time between the two. Samples or additions are welcome.
0 Kudos
Message 1 of 17
(3,608 Views)
You don't specify what type of signals you are looking at, but if you can define what constitutes a "change" in a signal, then yes, you can do this.

If the change is a sudden shift in a DC level, then either:
1... Go thru each sample in the signal and compare each sample to the previous one. If the difference is greater than X, then remember this point in time. Do the same for the other channel, then subtract the times.
2.. Perform a differentiation on the signals, and look for the peaks (positive or negative). They will define your points of change.

If the signals change frequency, then perform a short FFT on part of the signals, and record the dominant peak. Move the section of data and perform another FFT , and look for a point where the dom
inant peak changes from one frequency to another. There are tools in the JTFA toolkit which simplify this process, if needed.

You need to specify what "change" you're looking for.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 17
(3,608 Views)
I will guess you are looing for a DC level change on both channels.

Drop two threshold 1-da arrays (from the array pallette) on the diagram. One for each channels of data.

Wire the array containing the reading from one channel into one threshold... and the other array into the other threshold...

Wire a "threshold value" (you pick a value) into the threshold inputs of your threshold 1-d arrays.

Then wire the the index values returned by the threshold 1-d.... into a subtract node.

The difference returned by the subtract node will be in "samples". Multiply this by you sample rate and you are done.

Note:
THis approach depends a good "thrreshold" value. Make high enough not to be triggered by noise.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 17
(3,608 Views)
Thank you.
One of the signals is from a switch (on/ off) but it actually appears in LabVIEW like a waveform not a high or off. The other is from an acceleromoter through a module. Is there an example of what you describe in your email?
0 Kudos
Message 4 of 17
(3,608 Views)
Ben, Great! Any examples of this?
0 Kudos
Message 5 of 17
(3,608 Views)
Hi Lab,

I am allowed to answer questions.

I am not allowed to write code unless there is a purchase order in place (:<)).

Doing what I can to help (without getting myself fired).

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 17
(3,608 Views)
Ben, I understand:-)
I have been working on your directions but am having trouble figuring out the "array" that gets wired to reading from one channel and the "other array." I am not sure I follow how to wire the array nor if I need a different array.

I'll tell you what, NI should allow you guys a little more lattitude. You shouldn't have to program for us but helping sure does help. Not too mention I don't feel so bad about the money we spent last month for a site license for the entire university. Tahnks for your "help" which means "real" help; keep up the good work!
0 Kudos
Message 7 of 17
(3,608 Views)
Hi Lab,

I should clarifry!

I am a consultant that works for a consuting firm that develops code for a living.

I do not work for NI. Many of Enthusiasts here are like me, volunteers that answer questions for fun.

Now to try to help....

Drop an index array next to yur graph.
re-size it so it has two outputs.
Use a "get Wavefor components" (from waveform pallette) to get the "Y" values.
Use those retuned arrays to do what I suggested above.

Still trying to help,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 17
(3,608 Views)
If you're looking for a simple threshold change, then Ben's idea is the best. You need to separate the data into two arrays, one for channel A, one for channel B.
run each into a THRESHOLD 1-D Array, and you get two indices. Subtract the earlier from the later, and you have the "reaction time" or whatever, in terms of # samples. Multiply by the delta Time, and you have time, in seconds.

This will work well, if the signals are clean, and if you can define a fixed threshold level.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 17
(3,608 Views)
Thank you Coastal!

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 17
(3,608 Views)