ΣSigmaStudio Ask AI Русский Log in

Latch a zero for a set period of time?

SigmaDSP & SigmaStudio J3627 Aug 13, 2014 00:00 5 replies Original on forum ↗
Thread Summary

Thread Summary

The user sought a simple method to create a block that outputs 1 as long as the input is nonzero, and latches to 0 for n samples when the input is 0, even if it becomes nonzero again. The Timer object was suggested as a solution, but it triggers a pulse on turn-on, which the user wants to prevent or shorten. The user also encountered a feedback bug when trying to shorten the turn-on pulse and asked for a workaround to suppress the initial pulse.
AI Generated Content
Subscribe
J3627 Question
Aug 13, 2014 00:00

Desired block:

As long as input is nonzero, output should be 1.

When input is 0, even for 1 sample, output changes to 0 and stays at zero for n samples. Even if input becomes nonzero again, the output stays latched.

Any cheap simple way to do this?

Something involving a timer and feedback to keep its input from resetting until it outputs 1? something with a peak hold? (though that adds 19 MIPS)

KJBob Reply
Aug 14, 2014 00:00

Hi,

You could try the setup shown below, although it may not be as economical as desired. It creates a half-second pulse each time SW4 is pressed (the GP input goes to zero):

Best regards,

Bob

b1a49b1ff9121b9c4057d993ed72f7a0.png
b1a49b1ff9121b9c4057d993ed72f7a0.png
b1a49b1ff9121b9c4057d993ed72f7a0.png-507x229.png
b1a49b1ff9121b9c4057d993ed72f7a0.png-507x229.png
J3627 Reply
Aug 14, 2014 00:00

Uh, I just realized the Timer object already does exactly what I want. It outputs 1 until the input goes to zero, then outputs zero for as long as the input is zero, then when the input goes back to nonzero, the output stays zero for a set time before rising to 1 again.

J3627 Reply
Aug 14, 2014 00:00

However when the DSP turns on, the Timer is triggered for the same amount of time as when the input is changed, which I'd like to either prevent or shorten. I tried to shorten it but I got a weird feedback bug: Strange bug with timer and oneshot

Know any way to get rid of the turn-on trigger?

1423.1fe1402de5f1935975762476fe607944.png
1423.1fe1402de5f1935975762476fe607944.png
1423.1fe1402de5f1935975762476fe607944.png-276x201.png
1423.1fe1402de5f1935975762476fe607944.png-276x201.png
J3627 Reply
Aug 14, 2014 00:00

Here's a solution that suppresses the first pulse, but it's still happening, which prevents faults from being handled during the first x minutes:

Is there a way to get the Timer to not do this first pulse on turn-on?

1e52c64422c030b062c67dca76dbb05d.png
1e52c64422c030b062c67dca76dbb05d.png
1e52c64422c030b062c67dca76dbb05d.png-600x423.png
1e52c64422c030b062c67dca76dbb05d.png-600x423.png
EZAdministrator Reply
Aug 2, 2018 00:00

This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Thank you,
EZ Admin