TriggerOut's trigger remain valid for too long?

Hi I have a question about the trigger value of triggerout. As far as I understand, triggerout’s trigger is set to 1 when a rising edge is detected, and that rising edge is cleared when UpdateTriggerOuts() is called. So right now I have the following setup:


inLight ok1, ok2 => ok2,
ep_addr => x"60", ep_clk => clk1, ep_trigger => TrigOut60);



    public long doDetect(Stopwatch sw)
        long timeInNanoSeconds;

        while (true)
            if (m_dev.IsTriggered((short)0x60, (short)1))
                timeInNanoSeconds = sw.ElapsedTicks * nanosecPerTick;

        return timeInNanoSeconds;

so basically what happens is that a button (active low) is connected to the triggerout, and when I call doDetect(), it will hang and wait for the button press to call a rising_edge on the tirggerout’s trigger. So the expected behavior is that when I press the button, the doDetect() gets out of the infinite while loop, otherwise, it stays there indefinitely.

However, what’s happening now is that I call doDetect(), I press the button once, and I call doDetect() again, without pressing the button on the second time. However, I have debug statements to show that it still get out of the second infinite while loop, and I am not sure how this can be happening if I didn’t press the button again. Can some1 please let me know?

Larry Chen

Do you have your button deglitched?

It’s certainly possible that your button press is causing multiple rising edges.

[QUOTE=Opal Kelly Support;1903]Do you have your button deglitched?

It’s certainly possible that your button press is causing multiple rising edges.[/QUOTE]

Hi, I thought about that, but doesn’t the following happen?

Trigger ?

Yes, but if I understand your question correctly, the following can also occur:

Trigger (Read Trigger Value)

I actually wait at least seconds b4 checking the value of trigger out again so I didn’t think that could happen…right now i am using wire outs and things seem to work.

I’m not sure I follow what you mean when you say you wait at least seconds.

You mean you’re delay between checking is one second or more?

This still doesn’t prevent a double-detection when you don’t properly debounce your inputs.

For example, say we time-stamp events by milliseconds:

998…Button press occurs by user
1000…Update trigger outs and event detected.
1001…Button bounce occurs, triggering the ‘trigger out’ again.
2000…Update trigger outs and event detected again.

The two events were detected one full second apart, but actually occurred within a few milliseconds.

Alright. I think I understand the issue now. I will look into it.

Thank you for your help.