DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

calculate time of glitch

I am new to diadem and really don't have a clue what i'm doing. I have a log file with a time and voltage in it. I would like to calculate the time the voltage is high. the file only contains one transition from low to high and back to low.

I have attached my data file. I have figured out how to graph the data and to find the points manually but it takes quit a while to do it.

0 Kudos
Message 1 of 5
(4,383 Views)

Hello Chandler,

 

A small Script or formula calculation can help you automate this task:

 

Copy this into the Script editor:

 

Dim i,j
i = ChnFind("Ch(""[1]/Voltage"") > 6")
msgbox(chd(i,"Time"))
j = (chd(i,"Time"))
msgbox(Str(RTT(j),"mm/dd/yyyy hh:nn:ss.ffff"))

 

Explanation by line:

 

  1. Dim initializes two variables for VBS
  2. ChnFind looks through a channel and finds the row number where the condition "channel value > 6" is true
  3. MsgBox displays a message box with the value from "ChD" (ChD accesses the cell (row number and channel name are the two parameters))
  4. Store the value from ChD(row, column) in j
  5. Display the value "j" in time format (RTT converts a floating point (real) value to a time value using the format given in the sting)

 Let me know if that answered your question,

 

     Otmar

Otmar D. Foehner
0 Kudos
Message 2 of 5
(4,378 Views)

Hi chandler,

 

Did you mean the initial time at the rising edge (which Otmar addressed), or did you mean the duration of time that the signal remained high?

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 5
(4,358 Views)
Sorry about that, Yea I am looking for the total glitch time
0 Kudos
Message 4 of 5
(4,350 Views)

Hello Chandler,

 

Here is the code used to determine the duration. There are a few unnecessary message boxes, but I left them for better understanding of the code and results. This will calculate the glitch duration for the "Voltage" channel - since the signal is so noisy I used 8 and 0 as my limits. This would be better used on the "Smoothed" channel, but it is easily changed to work on that channel.

 

Dim i,j,k,m,n

i = ChnFind("Ch(""[1]/Voltage"") > 8")

msgbox(chd(i,"Time"))

j = (chd(i,"Time"))

msgbox(Str(RTT(j),"mm/dd/yyyy hh:nn:ss.ffff"))

k = ChnFind("Ch(""[1]/Voltage"") < 0",i)

m = (
chd(k,"Time"))

n = m - j

msgbox(Str(RTT(n),"mm/dd/yyyy hh:nn:ss.ffff"))

 

 

I hope this helps ...

 

    Otmar

Otmar D. Foehner
0 Kudos
Message 5 of 5
(4,346 Views)