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.

Answers (1)

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 Comments

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
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.

Sign in to comment.

Categories

Find more on General Applications in Help Center and File Exchange

Products

Release

R2025b

Asked:

on 7 Jan 2026

Edited:

on 10 Jan 2026

Community Treasure Hunt

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

Start Hunting!