ControlLogix D Flip Flop


Introduction to the ControlLogix D Flip Flop (DFF)

The ControlLogix D Flip Flop (DFF) Instruction simply samples the input. If the input is true when the clock signal goes high, the Q output comes on, and stays on. On the other hand, if the input is low when we clock the instruction, the output goes low. The QNOT output is simply the opposite of the Q signal.

We can use this instruction in Function Blocks or in Structured Text. Ladder logic does not support the DFF Instruction.

One example would be for sorting. Let’s say a part goes past a bar code reader, and it can only be sorted into one of two bins. If we read one bar code, we can set the input high. The other would set it low. Once we are sure we read a valid value, and set the input properly, we can clock the instruction. The output will stay high even though the input goes low. In fact, the output will stay high until we clock the instruction again with a low input signal (or until we give it a clear signal).

Create Your Tags

Before we begin, we’ll create a few tags. This will demonstrate how the D Flip Flop operates. Obviously, we’ll need an input tag, a clock tag, and a clear tag. We’ll also create a couple of BOOL bits to represent out outputs. Be sure you are in “Edit Tags”. You don’t really need to create the DFF_01 tag. Studio 5000 automatically creates this when you add the instruction to logic. For this example, I’m just adding these to my Program Tags.

Create Your Logic

If you don’t already have a function block routine, we’ll need to create one. Remember this is a subroutine. Be sure you add a JSR into the MainRoutine (or another routine that is currently executing). Just right click on a program to create a new function block routine. If you are unable to do this, then you might not have a Studio 5000 license that allows for function blocks.

We’ll need the DFF Instruction of course. Then we’ll have three Input References (IREF). Additionally, we’ll add a couple of output references OREF.

As you can see QNOT is already on. Keep in mind that QNOT is the opposite of our Q output signal.

Test Your Work

At this point, we’re ready to test our work. An easy way to do this is to turn on the Watch window. This window will list all of the tags in this routine. Additionally, it will show the values. In this case, we can also change the values in the quick watch window. Be careful doing that on running equipment, however.

Let’s turn on our DInput tag. Additionally, we’ll clock the instruction. Place a 1 into the clock. You will see the output does energize.

Even when we loose the clock signal, and the DInput goes back to 0, the output stays on.

The next time we clock the instruction with a low input, the output shuts off.

Now, if our clear bit goes true, the output (Q) shuts off as well, even when the input is true, and the clock goes high.

Summary of ControlLogix D Flip Flop (DFF)

In short, the DFF instruction simply samples an input when the clock goes high. The output updates again depending on the input signal when the clock goes low, then high again. Although there are other ways to accomplish this, using function blocks, it’s a nice straight-forward way to take a sample of an input at any given clock cycle. No matter how short the clock signal is. The DFF Holds this sample until it’s either cleared, or the clock signal goes true again. In other words, it delays the state change of an input until the next clock signal.

For other instructions, and information, visit the ControlLogix Category Page!

— Ricky Bryce

Leave a comment

Your email address will not be published. Required fields are marked *