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

25 次查看(过去 30 天)
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?

回答(2 个)

Kunal Kandhari
Kunal Kandhari 2023-9-5
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 2024-3-13
what if it is a d flip flop and I want to create a preset signal

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by