Main Content

Set-Reset Flip-Flop

Set-reset flip-flop or bistable multivibrator

  • Library:
  • Simscape / Electrical / Control / General Control

  • Set-Reset Flip-Flop block


The Set-Reset Flip-Flop block implements a set-reset flip-flop or bistable multivibrator.

The block maintains the output signals, Q and !Q, unless an external trigger is applied. An external trigger (Set) produces a change of state, which is maintained until a second external trigger (Reset) is applied.

The table shows the relationship between the block input and output signals.

00Last QLast !Q

When the state is undefined, the priority is provided as an external parameter.



expand all

Input signal that triggers a state change.

Data Types: Boolean

Input signal that resets a state change.

Data Types: Boolean


expand all

Output signal Q, with the same dimensions and data type as the input signal.

Data Types: Boolean

Output signal !Q, with the same dimensions and data type as the input signal.

Data Types: Boolean


expand all

Priority for the undefined state, that is, when both Set and Reset are true.

Initial condition for Q state.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, specify -1. For discrete-time operation, specify a positive integer. For continuous-time operation, specify 0.

If this block is in a masked subsystem, or other variant subsystem that allows you to switch between continuous operation and discrete operation, promote the sample time parameter. Promoting the sample time parameter ensures correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters on a Mask.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2018b