EveryCircuit
Contact
Reviews
Home
panasiuk
modified 1 year ago

Toggle button

2
5
263
02:17:22
Implementation of button control using the asynchronous finite state machine. When the button is pressed, the LED lights up. In order for it to go out, you need to press the button again. State Transition Table B state (Q0)(Q1) 00 01 11 10 0 00 11 11 00 1 01 01 10 10 K-map for R0 00 01 11 10 R0 = !B & !Q1 = !(B | Q1) 0 X 1 1 X X K-map for S0 00 01 11 10 S0 = !B & Q1 = !(B | !Q1) 0 1 X 1 X X K-map for R1 00 01 11 10 R1 = B & Q0 0 X X 1 1 X K-map for S1 00 01 11 10 S1 = B & !Q0 0 X X 1 1 X As homework, you can think about how to complete the circuit so that the LED lights up only after the button is released. Actual implementation should take into account the following points. After the power appears, the state machine must go to the initial state (00). And real buttons have the so-called effect, bouncing contacts. Therefore, it is necessary to suppress them, for example, through RC-filter, a Schmitt trigger, etc.
published 1 year ago
Redstone_guy
1 year ago
If you connected the LED and its series resistor to the output Q of the other RS NOR latch, it becomes falling-edge triggered
panasiuk
1 year ago
I'm sorry, but I don't understand your suggestion. Currently, the LED lights up in states (01) and (11). When the button is pressed, the machine switches to state (01) (from state 00). And when the button is released, it goes to state (11) (from state 01). Therefore, it is sufficient to add the condition that the LED lights up only in state (11). It is necessary to add an AND gate to the RS-triggers outputs (OUT = Q0 & Q1).
Redstone_guy
1 year ago
Here’s what I meant: https://everycircuit.com/circuit/5261481268215808
Redstone_guy
1 year ago
The link shows you how to make the FF falling edge triggered. But I personally prefer rising edge FFs
panasiuk
1 year ago
I see, that makes sense.

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2026 by MuseMaze, Inc.     Terms of use     Privacy policy