Jump to content
  • 0

Scope, Script and StaticIO


Matt B

Question

Hello, 

I am having a issue writing a script to turn on a digital output for pulse width measurement. I have two measurements. One has a pulse width of about 45us and the other around 80us. I have tried to display the Pulse Width using script and I am having issues. I would like to use the pulse width measurements and check it for tolerance. If measurement is good, turn on output. 

Any help would be appreciated.

 

Thanks,

Matt

Link to comment
Share on other sites

Recommended Posts

Hi @Matt B

The beta version adds access to Logic Analyzer measurements:
https://forum.digilentinc.com/topic/8908-waveforms-beta-download/

The following Script changes the DIO15 output based on DIO0 negative width measurement at 60us threshold.

Logic.run()
while(Logic.wait()){
    var sw = Logic.Channels.DIO0.measure("NegWidth")
    StaticIO.Channel1.DIO15.value = sw>60e-6?1:0
}

image.thumb.png.350ef08b32bb8e11547f21f8f02be8cf.png

 

Link to comment
Share on other sites

I do not think that will work for this application. I am actually testing a sensor. I am using the trigger to get the pulse from the sensor. The pulse responds differently to rotation in the clockwise/cc direction. I am measuring that Pulse width and checking to make sure it is in tolerance. If it is within tolerance I will activate StaticIO output.

 

If I could get the measurement of the NegWidth or PosWidth from the Scope into a variable in Script, I may be able figure this out.

Link to comment
Share on other sites

Hi @Matt B,

I'm not certain how to do this in script, but you can choose to set a trigger to occur based on the length of a pulse width input, though I don't think it will readily test between a range of pulse times. I have attached a screenshot of what the settings would look like for the trigger.

Let me know if you have any questions about this.

Thank you,
JColvin

ad2 trigger.png

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...