DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Time When Waveform Passes Set Threshold

I'm trying to write some vbscript to automatically adjust the x-axis limits of several waveform channels. They all start out with a few seconds of nothing, and then an event happens, like what is shown here:

Capture.PNG

 

So, what I want to do is sense when the y-axis value crosses a threshold (say 4V in the case of this one) and get the time at which it does that. Any help would be greatly appreciated.

 

 

0 Kudos
Message 1 of 3
(3,343 Views)

Edit:

I got it to work using the ChD command like this:

While j < 4 'threshold

j  = ChD(k, "ChannelName")

k = k + 1

Wend

which works fine, but obviously take a very long time when you're checking 30 channels which each have nearly 1 million samples. If anyone knows of a command that does this more efficiently, I'd still love to know.

0 Kudos
Message 2 of 3
(3,316 Views)

Hi gam2498,

 

Take a look at ChnFind command:

 

 

Dim intMyResult
intMyResult = ChnFind("Ch(""ChannelName"")>4") ' 4 = threshold

 

Hope this helps.

 

0 Kudos
Message 3 of 3
(3,280 Views)