필터 지우기
필터 지우기

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

조회 수: 17 (최근 30일)
수형
수형 2023년 9월 5일
답변: Prinsca 2024년 3월 13일
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