The RS FlipFlop in the Simulink library is not working properly.

Hello, The RS FlipFlop in the Simulink library is not working correctly, because when I set the input S = 1 and R = 1, the output Q = 1, but after that when I set S = 0 and R = 0 it does not remember the previous state, instead Q is equal to the value of the initial conditional RS setting. The correct is tha de flip flop RS remember the beofre state when R=0 anda S=0.The correct thing is that the RS flip-flop remembers the previous state when R=0 and S=0.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 7 Jan. 2026

0 Stimmen

Double click the block, click "Help" to bring up the document.
It says when S=1 and R=1, both Q=0 and !Q=0, and this should be avoided.

4 Kommentare

Victor
Victor am 9 Jan. 2026
Verschoben: Fangjun Jiang am 9 Jan. 2026
Thanks for your reply, but my problem isn't with the states R=1 and S=1, my problem is with R=0 and S=0; the flip-flop doesn't remember the previous state.
Please construct a simple model to show the problem. Please not to include in any time when S=1 and R=1.
I've attached the model so you can run it in Simulink and identify the problem. When you open this file in Simulink, you'll see some commented text. Thanks again for your answer!
it's supposed to work this way
n R S Q
1 0 1 1
2 0 0 Qn-1=1
3 1 0 0
but to work this way !
n R S Q
1 0 1 1
2 0 0 0 It doesn't respect Qn-1
3 1 0 0
Fangjun Jiang
Fangjun Jiang am 10 Jan. 2026
Bearbeitet: Fangjun Jiang am 10 Jan. 2026
Your model did not show the problem.
The RS FlipFlop block did not have any problem.
Your input value for both the R and S are always 0 so the output Q should be Q(n-1).
If you double click the block and set the "Initial condition for Q state", which means Q(n-1) for your model, to be 1 or 0, then the simulation result keeps that value. This indicates the correct behavior.
Somehow, you must understand something wrong. The attached model should convince you.
By the way, the FlipFlop block you mentioned is from SimScape. It can specify whether "Set" or "Reset" has the priority. It does not have the problem when both R=1 and S=1, which applies to the generic Simulink Extras/Flip Flops/S-R Flip-Flop block.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu General Applications finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2025b

Gefragt:

am 7 Jan. 2026

Bearbeitet:

am 10 Jan. 2026

Community Treasure Hunt

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

Start Hunting!

Translated by