Main Site Documentation

Flip-Flops, their function and use in I/O


Ok you EE level people (degree not required), I’ve been trying to understand an I/O board that uses TI’s octal D-type flip-flop with 3-state outputs. Best I can figure from my self-education is that these flip-flops are storing an input state. Perhaps until it’s state can be polled and cleared? Does that seem likely? Is this a replacement for, or a complement to, input interrupts? Do these provide any isolation for the MCU? I can see pros and cons of both flip-flops and interrupts, but are they used together?

I’m developing an I/O board myself, and always on the look out for a better idea, or an idea to store away for later. BTW, the board uses a PIC-something, sorry, don’t have the board in front of me, left it at the office.


flip flops are very versitile devices and they are used in different ways.

It generally has a clock input. A rising edge on the clock input stores the inputstates in the flipflops. Thy can then be read out by making the outputs “not high impedance”.

This is how registers in the pic is implemented. Multiple flipflops can be connected to the same input on the PIC and their inputs can be sampled at the same time, with the outputs read out one octal at a time.


You typically don’t see a lot of discrete flip-flops in embedded projects since all a flip-flop does is sample a single bit and store its value until the next clock cycle. The same functionality is built-in to every microcontroller, so there’s really no purpose to having additional discrete flip-flops outside of the microcontroller.


@ jay -
Unless you need to sample multiple inputs at the same time, then it is very useful…


Huh? All GPIO pins are read at the same time when you read the GPIO’s register. What would you need a flip-flop for?


Yes, “when you read”. The flipflop can store the value on an outside trigger with nanosecond response times, which you can’t get with interrupts.

An octal flipflop is a 1 byte memory that can be written to on outside trigger and read by the cpu at a later time.

You can also connect multiple octal flipflop to the same port, and have them sample the 16/32/64 signals at the same time, while reading them, assuming an 8 bit port, one octal at a time…

These might be esoteric applications, but flipflop are still very useful, maybe just not in everyday circuits.


@ Gregg -

You may find this useful…

See question 3 and 18 (and there is more if you ‘look’ around)

Using external circuits can be very useful as you can do things that are almost impossible or require too much time in software. (In my opinion).

I sure wish TTL/CMOS devices were around and easy to find like in the ‘Old Days’…