# J K Flip Flop

**JK flip-flop**is a sequential bi-state single-bit memory device named after its inventor by

**Jack Kil**. In general it has one clock input pin (CLK), two data input pins (J and K) and two output pins (Q and Q̅…) as shown by Figure 1. JK flip-flop can either be triggered upon the leading-edge of the clock or on its trailing edge and hence can either be positive- or negative- edge triggered, respectively. In order to have an insight over the working of JK flip-flop, it has to be realized interms of basic gates similar to that in Figure 2 which expresses a positive-edge triggered

**JK flip-flop**using AND gates and NOR gates. Here it is seen that the output Q is logically anded with input K and the clock pulse (using AND gate 1, A

_{1}) while the output Q̅ is anded with the input J and the clock pulse (using AND gate 2, A

_{2}).

Further the output of A_{1} is fed as one of the inputs (X_{1}) to the NOR gate 1, N_{1} whose other input (Y_{1}) is connected to output Q̅. Similarly NOR gate 2, N_{2} has its two inputs (X_{2} and Y_{2}) as output of A_{2} and output Q (respectively).
Initially let J = K = 0, Q = 0 and Q̅ = 1. Now consider the appearance of positive-edge of the first clock pulse at the CLK pin of the flip-flop. This results in X_{1} = 0 and X_{2} = 0. Then the output of N_{1} will become 0 as X_{1} = 0 and Q̅ = 1; while the output of N_{2} will become 1 as X_{2} = 0 and Q = 0. Thus one gets Q = 0 and Q̅ = 1. However if one considers the initial states to be J = K = 0, Q = 1 and Q̅ = 0, then X_{1} = X_{2} = 0 which results in Q = 1 and Q̅ = 0. This indicates that the state of flip-flop outputs Q and Q̅ remains unchanged for the case of J = K = 0.

Now assume that J = 0, K = 1, Q = 0 and Q̅ = 1. Analyzing on the same grounds, one gets X_{1} = X_{2} = 0 which further results in Q = 0 (and hence Q̅ = 1). For the same case if Q and Q̅ were 1 and 0, respectively, then X_{1} = 1 and X_{2} = 0 which would result in Q = 0 (and hence Q̅ = 1). This implies that if J = 0 and K = 1, then the flip-flop resets (Q = 0 and Q̅ = 1).
Next if J = 1, K = 0, Q = 1 and Q̅ = 0, then X_{1} = X_{2} = 0 which results in Q = 1 (and thus Q̅ = 0). For the same case if Q = 0 and Q̅ = 1, then X_{1} = 0, X_{2} = 1 which leads to Q̅ = 0 and hence Q is forced to value 1. This means that for the case of J = 1 and K = 0, flip-flop output will always be set i.e. Q = 1 and Q̅ = 0.

Similarly for J = 1, K = 1, Q = 1 and Q̅ = 0 one gets X_{1} = 1, X_{2} = 0 and Q = 0 (and hence Q̅ = 1); and if Q changes to 0 and Q̅ to 1, then X_{1} = 0, X_{2} = 1 which forces Q̅ to 0 and hence Q to 1. This indicates that for J = K = 1, flip-flop outputs toggle meaning which Q changes from 0 to 1 or from 1 to 0, and these changes are reflected at the output pin Q̅ accordingly.
However it is to be noted that the state of the flip-flops remain unaltered if there is no rising-edge of the clock at its input. All these details can be summarized as in Table I. The wave forms pertaining to the same are presented by Figure 3. Moreover it is to be noted that the working of negative edge triggered flip-flop is similar to that of positive-edge triggered one except that the changes occur at the trailing edge of the clock pulse instead of its leading edge.
From the truth table above one can arrive at the equation for the output of the J K flip-flop as (Table II)
In addition to the basic input-output pins shown in Figure 1, **J K flip-flop** can also have special inputs like clear (CLR) and preset (PR) (Figure 4). These can be used to bring the flip-flop to a definite state from its current state. For example, the output can be made equal to 0 using CLR pin while it can set to 1 using PR pin. However these pins can be either active high (Figure 4a) or active low (Figure 4b) operated. The waveforms pertaining to positive-edge triggered JK flip-flop with active high preset and clear pins are shown in Figure 5. Moreover it is to be noted that these pins can be either synchronous or asynchronous in nature meaning which the clear and set operations occur either depending on the clock (shown by green lines) or no (shown by red lines), respectively. Further if the preset and clear pins are active low, then the changes observed in the diagram occur at the instant when clear and preset go low instead of high.

Closely Related Articles Latches and Flip FlopsS R Flip Flop S R LatchActive Low S R Latch and Flip FlopGated S R Latches or Clocked S R Flip FlopsD Flip Flop or D LatchMaster Slave Flip FlopRead Only Memory | ROMProgrammable Logic DevicesProgrammable Array LogicApplication of Flip FlopsShift RegistersBuffer Register and Controlled Buffer RegisterData Transfer in Shift RegistersSerial In Serial Out (SISO) Shift RegisterSerial in Parallel Out (SIPO) Shift RegisterParallel in Serial Out (PISO) Shift RegisterParallel in Parallel Out (PIPO) Shift RegisterUniversal Shift RegistersBidirectional Shift RegisterDynamic Shift RegisterUninterruptible Power Supply | UPSConversion of Flip FlopsMore Related Articles Digital ElectronicsBoolean Algebra Theorems and Laws of Boolean AlgebraDe Morgan Theorem and Demorgans LawsTruth Tables for Digital LogicBinary Arithmetic Binary AdditionBinary SubtractionSimplifying Boolean Expression using K MapBinary DivisionExcess 3 Code Addition and SubtractionK Map or Karnaugh MapSwitching Algebra or Boolean AlgebraBinary MultiplicationParallel SubtractorBinary Adder Half and Full AdderBinary SubstractorSeven Segment DisplayBinary to Gray Code Converter and Grey to Binary Code ConverterBinary to BCD Code ConverterAnalog to Digital ConverterDigital Encoder or Binary EncoderBinary DecoderBasic Digital CounterDigital ComparatorBCD to Seven Segment DecoderParallel AdderParallel Adder or SubtractorMultiplexerDemultiplexerOR Operation | Logical OR OperationAND Operation | Logical AND OperationLogical OR GateLogical AND GateNOT GateUniversal Gate | NAND and NOR Gate as Universal GateNAND GateDiode and Transistor NAND Gate or DTL NAND Gate and NAND Gate ICsX OR Gate and X NOR GateTransistor Transistor Logic or TTLNOR GateFan out of Logic GatesINHIBIT GateNMOS Logic and PMOS LogicSchmitt GatesLogic Families Significance and Types of Logic FamiliesBinary Number System | Binary to Decimal and Decimal to Binary ConversionBinary to Decimal and Decimal to Binary ConversionBCD or Binary Coded Decimal | BCD Conversion Addition SubtractionBinary to Octal and Octal to Binary ConversionOctal to Decimal and Decimal to Octal ConversionBinary to Hexadecimal and Hex to Binary ConversionHexadecimal to Decimal and Decimal to Hexadecimal ConversionGray Code | Binary to Gray Code and that to Binary ConversionOctal Number SystemDigital Logic Gates2′s Complement1′s ComplementASCII CodeHamming Code2s Complement ArithmeticError Detection and Correction Codes9s complement and 10s complement | SubtractionSome Common Applications of Logic GatesKeyboard EncoderAlphanumeric codes | ASCII code | EBCDIC code | UNICODENew Articles Voltage SensorFlow MeasurementVoltage in ParallelVoltage in SeriesVoltage Regulator 7805How to Use a Digital Multimeter?