Jump to content
  • 0

count digital rising edge triggers for 30 seconds


esorensen

Question

6 answers to this question

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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){

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...