JK Flip-Flop (JKFF)
This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The JKFF instruction complements the Q and QNot outputs when the Clock input transitions from cleared to set.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block
Structured Text
JKFF(JKFF_tag);
Operands
Function Block
Operand | Type | Format | Description |
---|---|---|---|
JKFF tag | FLIP_FLOP_JK | Structure | JKFF structure |
FLIP_FLOP_JK Structure
Input Parameter | Data Type | Description |
---|---|---|
EnableIn | BOOL | Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set. |
Clear | BOOL | Clear input to the instruction. If set, the instruction
clears Q and sets QNot. |
Clock | BOOL | Clock input to the instruction.
Default is cleared. |
Output Parameter | Data Type | Description |
---|---|---|
EnableOut | BOOL | Indicates if instruction is enabled. |
Q | BOOL | The output of the instruction. |
QNot | BOOL | The complement of the Q output. |
Structured Text
Operand | Type | Format | Description |
---|---|---|---|
JKFF tag | FLIP_FLOP_JK | Structure | JKFF structure |
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
When Clear is set, the instructions clears Q and sets QNot. Otherwise, if Clock is set and Clockn-1 is cleared, the instruction toggles Q and QNot.
The instruction sets Clockn-1 = Clock state every scan.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See
Common Attributes
for operand-related faults.Execution
Function Block
Condition/State | Action Taken |
---|---|
Prescan | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is false | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is true | EnableIn and EnableOut bits are set to true. The instruction executes. |
Instruction first run | Clockn-1 is set to 1.
Qn-1 is cleared to 0. |
Instruction first scan | Previous input Clock states is set to True. Previous output Q state is False. |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Structured Text
Condition/State | Action Taken |
---|---|
Prescan | See Prescan in the Function Block table. |
Normal Execution | See Tag.EnableIn is true in the Function Block table. |
Postscan | See Postscan in the Function Block table. |
Examples
When Clock goes from cleared to set, the JKFF instruction toggles Q. If Clear is set, Q is always cleared. The JKFF instruction sets QNot to the opposite state of Q.
Function Block
Structured Text
JKFF_01.Clear := clear_input;
JKFF_01.Clock := clock_input;
JKFF(JKFF_01);
q_output := JKFF_01.Q;
qNot_output := JKFF_01.QNot;
Provide Feedback