How to add CLEAR, PRESET terminals in J-K FLIP FLOP

25 visualizaciones (últimos 30 días)
수형
수형 el 5 de Sept. de 2023
Respondida: Prinsca el 13 de Mzo. de 2024
I want to make MOD-3 counter with 2 J-K flip flop, 1 and gate like picture that I upload
but in library there is no CLR,PR port in J-K flip flop. How can i make this?

Respuestas (2)

Kunal Kandhari
Kunal Kandhari el 5 de Sept. de 2023
If you want to create a MOD-3 counter using J-K flip-flops in Simulink and as there is no direct CLR (Clear) or PR (Preset) port in the J-K flip-flop block, you can implement the clear and preset functionality using additional logic gates.
Here's how you can create a MOD-3 counter using J-K flip-flops:
1. Create the J-K Flip-Flops:
  • Place two J-K Flip-Flop blocks from the Simulink library onto your model.
2. Connect the Clock Signal:
  • Connect a clock signal to the clock (CLK) inputs of both J-K Flip-Flops.
3. Implement the Clear and Preset Functionality:
  • Since the J-K Flip-Flop block in Simulink might not have direct CLR (Clear) or PR (Preset) ports, you can use additional logic gates to achieve these functions.
  • For the first J-K Flip-Flop (FF1):
  • Connect the J input to an AND gate:
  • One input of the AND gate should be your desired preset signal.
  • The other input of the AND gate should be your clock signal inverted using a NOT gate.
  • Connect the K input to an AND gate:
  • One input of the AND gate should be your desired clear signal.
  • The other input of the AND gate should be your clock signal inverted using a NOT gate.
  • For the second J-K Flip-Flop (FF2):
  • Connect the J input to an AND gate:
  • One input of the AND gate should be your desired preset signal.
  • The other input of the AND gate should be the output of FF1 (Q1).
  • Connect the K input to an AND gate:
  • One input of the AND gate should be your desired clear signal.
  • The other input of the AND gate should be the output of FF1 (Q1).
4. Connect the Feedback Logic:
  • Connect the Q output of FF1 to the J input of FF2.
  • Connect the Q output of FF2 back to the K input of FF2.
5. Create the Output:
  • Connect the Q outputs of the J-K Flip-Flops to your output or display blocks to observe the counter's behavior.
By following these steps, you can create a MOD-3 counter using J-K flip-flops in Simulink, implementing clear and preset functionality using additional logic gates as needed. Be sure to configure the preset and clear signals according to your specific requirements.

Prinsca
Prinsca el 13 de Mzo. de 2024
what if it is a d flip flop and I want to create a preset signal

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by