Jump to content

Edge Detection Circuits


Recommended Posts

Folks...

Here are three rising edge-detector circuits.

20211223135320_1.thumb.jpg.eebb6dcbcd7361673784c74841162574.jpg20211223135542_1.thumb.jpg.e45a2c0ab37ad029b26b2447e28ad61c.jpg

The first two came from the archives, and were fairly old. They're meant to detect a rising edge: when the switch goes from red to green, the output goes to green. All three circuits do this. The top one sends a single short pulse of 1 tick. The middle and bottom let you set the duration of the pulse using the filter's timing.

But.

The top and the middle have a problem: they also detect a *falling* edge, sending a tiny blip pulse when the switch goes green to red.

This is not a problem if you're using the output to control most hardware, a sweeper or an aquatuner, let's say. But if you're using it to control the reset port on a  memory toggle or the conveyor meter, you'll get a reset both on the rising and the falling edge, which likely isn't what you wanted.

It took me an embarrassingly long time to figure out the issue: the gates before the XOR take time to react, and on a falling edge, for one tick, the upper XOR input is green and the lower one is red, so the XOR fires green. The fix, synchronize them by inserting that ribbon-reader, which takes the same amount of time as the filter does to pass its signal along.

On the one hand, maybe this will help someone else. On the other hand, I absolutely suck at hardware logic: If someone uses a simpler and more compact perfect single-edge detector, please show it off.

Seeya -- @GeePaw

Link to comment
https://forums.kleientertainment.com/forums/topic/136451-edge-detection-circuits/
Share on other sites

I think the below from an old post of mine are the ones most people use I reckon.

For a positive edge detector you can also use a counter set to 1 with output and reset connected which obviously also makes a negative edge detector by having a NOT in front of the counter.

5be0263127077_Edgedetectors.png.cdbbfe62

 

2 hours ago, GeePaw said:

20211223135320_1.thumb.jpg.eebb6dcbcd7361673784c74841162574.jpg

 

On the one hand, maybe this will help someone else. On the other hand, I absolutely suck at hardware logic: If someone uses a simpler and more compact perfect single-edge detector, please show it off.

 

one thing you are wrong at here. that is a software logic what we deal in here, you may not experience like that in hardware or it may act little differently

1 hour ago, Tuode said:

Aren't these builds also affected by the issue mentioned above? Sorry if this is a stupid question, for I don't play around with automation very often

On the contrary - they specifically exploit the fact that gates take 0.1 seconds to update. That's part of the role of the NOT gate on the left - to allow a double green or double red signal to the center gate for only a moment.

Personally i use a buffer gate with a XoR for one edge and a filter with XoR for the other, then both a filter ande a buffer for both edges. Additionally a 0.2s filter at the edge to avoid false positives. There are probably better setups than that but this one seems the easiest for me to understand.

Archived

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

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...