Jump to content
  • 0

count digital rising edge triggers for 30 seconds


esorensen

Question

6 answers to this question

Recommended Posts

Posted

For such long period you can use the Stream acquisition mode and have the sample rate to filter the eventual glitches. For instance, if you are interested in signals with frequency below 1kHz, set the rate to 4kHz or something between 2-10kHz depending on pulse duty.

You can use the event view on one signal and filter the 1s to have to count of rising edges.

With the following script you can filter and sum the edges for multiple signals:

function filter(rgEvents){

   var cEvent = 0;

   rgEvents.forEach(function(event){

      if(event=="1") cEvent++;

   })

   return cEvent;

}

var cSum = 0

cSum += filter(Logic1.Channels.DIO3.events)

cSum += filter(Logic1.Channels.DIO2.events)

cSum += filter(Logic1.Channels.DIO1.events)

cSum += filter(Logic1.Channels.DIO0.events)

print(cSum)

img9.png

Posted

I'm new to this scripting language, so please bear with me.

The DIOx objects don't appear to have "events" available.

Also, how should I define "rgEvents"?

I'm running on a Mac.

(Pasted images aren't going through?)

Posted

The script syntax is javascript. The rgEvents is the argument of the defined "filter" function which returns the number of 1s (rising edges) in the array argument.

To use this, you have to add the interested signals to the Logic Analyzer, change the summing list in the Script code to have these signals, DIO#.
cSum += filter(Logic1.Channels.DIO#.events)
...

After you have the acquisition data press Run in the Script tool.

Posted

I do have the signals in the logic analyzer. 

I get the following when trying to run the script:

Error in line: 30

TypeError: Result of expression 'rgEvents' [undefined] is not an object.

 

for the following line within the fuction:

rgEvents.forEach(function(event){

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...