Each buttons press is detected by a rising edge detector, and each button press is decoded into a binary code. That binary code is stored in a shift-register which is continuously checked against a reference value (’the padlock code’).
Connect a clock generator to the clock input, connect all four buttons with a debounce circuit - the buttons should act as active high.
# | Input | Output |
---|---|---|
0 | clock | none |
1 | Button A | none |
2 | Button B | none |
3 | Button C | none |
4 | Button D | none |
5 | none | none |
6 | none | Button press detected |
7 | none | Code valid |