I'm just starting to get into embedded systems and I recently stumbled across latches (as well as flip-flops). But I don't understand what they're used for.
First, if you would please clarify that I understand how they work, I'd greatly appreciate it. It is my understanding that I'd usually set the bits (in my case, seven bits for a 7-segment LED display) on my microcontroller first, and then set the input enable bit high on the latch. At this point, the latch will "store" the values that I originally set on my microcontroller. Next, I set the output enable bit on the latch high and the values get output to my connected device(s). At some point, I'd imagine that I'd have to set both the "input enable" and "output enable" pins back to low; but, I'm not sure exactly when to do this.
This is where I start to get confused. What was the point of the latch? Why not just set the bits high/low on my MCU and be done with it? Also, unless I'm missing something, I'll need two bits in addition to the seven that I'm already using for my 7-segment LED display so that I can assert the "input enable" and "output enable" pins when I'm ready for them.
In my case, I have a simple Assembly program that I wrote that simply counts from 0 to 9 infinitely, setting the output pins high/low as necessary to turn on/off the individual LED segments to correctly display the current value of my counter.
I browsed the Digi-Key website for latches and came across one that I think will work for me (Digi-Key part # 497-1334-5-ND):
Can anybody please give me a hand?
Thank you in advance,