# How to toggle and latch using logic gates?

• OrlandoLewis
In summary, the problem is that the pulse is not coming from the overlapping XOR gates. You can try to connect the XOR gates directly, or use an XOR circuit that is connected to the gates after the inverters.
OrlandoLewis
We're implementing Dots and Boxes to logic circuits and the we would like to automate the process of changing turns. If you know the game, the game changes turn when one move doesn't score a point or form two or more boxes. I was able to create overlapping XOR gates that alternates from high to low without considering the score. And also a set of latches which turns high when a box (score) or two is formed.

My question is, how can I implement the alternating turn in this game? Note that my set of latches which saves the state isn't a pulse but a constant output from combinatoric circuit. So basically, I want my output to toggle when a turn is moved but a score is not formed, and to latch when a turn is moved and a score is formed.

Here is the schematic for a JK flip-flop. If you keep J and K high, it will toggle.

Svein said:
Here is the schematic for a JK flip-flop. If you keep J and K high, it will toggle.
Yes, I totally get how JK flip flop toggles when both J and K are high and latches when J and K are low. My problem is I have a continuous signal, not a pulsing one. As I said, I want my pulse to be coming from the overlapping XOR gates which alternates from high to low whenever it changes turn. However, I want both of its edges to be the trigger

OrlandoLewis said:
Yes, I totally get how JK flip flop toggles when both J and K are high and latches when J and K are low. My problem is I have a continuous signal, not a pulsing one. As I said, I want my pulse to be coming from the overlapping XOR gates which alternates from high to low whenever it changes turn. However, I want both of its edges to be the trigger
There are several ways to do that, it depends on what you have available. If you have a clock somewhere, you can run your signal through two D-flip-flops and use an XOR from D to Q on the last flip-flop. The output of that XOR will the be high for one clock cycle after the signal has changed state.

In real life, you can do the same thing using an XOR on your signal, one part going directly to an input and the other delayed through an RC combination.

Svein said:
There are several ways to do that, it depends on what you have available. If you have a clock somewhere, you can run your signal through two D-flip-flops and use an XOR from D to Q on the last flip-flop. The output of that XOR will the be high for one clock cycle after the signal has changed state.

In real life, you can do the same thing using an XOR on your signal, one part going directly to an input and the other delayed through an RC combination.

I tried doing the RC circuit but it doesn't seem to work. The alternating input I stated earlier is connected to the XOR gate and two inverters which is also connected to the XOR gate. I added a resistor( 1K ohms ) and a capacitor between tose inverters but it seems that it also stays constant instead of pulsing. Am I doing the circuit right?

The RC circuit has some restrictions, related to the logic family you are using. If it is a standard TTL, the R must be small, for CMOS it can be larger. the circuit I mentioned is a variation of this:

## 1. What is a logic gate?

A logic gate is a fundamental building block of digital circuits that performs a logical operation on one or more binary inputs and produces a single binary output based on its internal logic. It is typically represented by a schematic symbol and can be physically implemented using electronic components such as transistors.

## 2. What is the difference between toggling and latching using logic gates?

Toggling and latching are two different operations that can be achieved using logic gates. Toggling refers to the process of switching between two states or values, while latching refers to the process of storing a value or state and holding it until it is reset or changed. In terms of logic gates, toggling can be achieved using a flip-flop circuit, while latching can be achieved using a latch circuit.

## 3. How do I toggle using logic gates?

To toggle using logic gates, you will need to use a flip-flop circuit. This circuit consists of two logic gates connected in a feedback loop. By applying a pulse or changing the input values, the output of the flip-flop will toggle between 0 and 1. The specific type of flip-flop used will determine the exact behavior and timing of the toggle.

## 4. How do I latch using logic gates?

To latch using logic gates, you will need to use a latch circuit. This circuit consists of two cross-coupled logic gates that form a bistable multivibrator. The output of the latch will hold the state of the inputs until it is reset or changed. The specific type of latch used will determine the exact behavior and timing of the latching.

## 5. Can I use both toggling and latching in a single circuit using logic gates?

Yes, it is possible to use both toggling and latching in a single circuit using logic gates. This can be achieved by combining a flip-flop and a latch circuit. The flip-flop can be used for toggling, while the latch can be used for storing a value or state. This combination can be useful in digital systems that require both operations for different tasks.

• Electrical Engineering
Replies
29
Views
4K
• Electrical Engineering
Replies
1
Views
1K
• Electrical Engineering
Replies
16
Views
4K
• General Engineering
Replies
2
Views
6K
• Electrical Engineering
Replies
37
Views
4K
• Engineering and Comp Sci Homework Help
Replies
7
Views
7K
• Electrical Engineering
Replies
26
Views
16K
• Electrical Engineering
Replies
2
Views
4K
• Electrical Engineering
Replies
5
Views
4K
• Quantum Physics
Replies
5
Views
4K