The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions. We hope you enjoy it. If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to[email protected].
To the left, to the left
Let’s start out explaining what a shift register is, just in case it’s been a long time since you discussed it. A shift register has a clock, an input (usually one bit), and a parallel output (which can be between 4 and 64 bits). There are usually other niceties like master clear or set, a latch enable, chip enable, and others. When the clock is toggled, whatever is on the input will get put into the first bit position and all other will shift by one position. You can put whatever sequence of bits you want on the output by feeding them to the input one bit at a time, toggling the clock and then feeding the next bit.
In the good old days…
In engineering design labs of yore, a shift register would be constructed of a series of cascading D-Flip Flops. The output of one feeding the input of the next and all the clocks tied together. And that is a fine way of doing it but it is expensive, takes a great deal of space and is time consuming to set up. Not to mention that it does not have a buffer. A buffer you say? Well yes, if your output is always active then each line will move up and down as the bits go by before you get to the final bit configuration you want. And if your circuit is hard tied to that output, well it will respond accordingly which can have disastrous effects.
Imagine you have a 4-bit register tied to 4 solenoid valves and you currently have the output 1011 and you want to have 1100, that is turn off 0 and 1 and turn on 2. By shifting you will turn each of those on and off several times before you come to the configuration you want. That is usually very bad. If you have a buffer in between the shift register and your circuitry you can move the next output into place and then in one shot move the new output byte from the shift register to the circuit in one go. That is how modern shift registers work when you buy them as a chip.
I mentioned above that some registers have a master set or reset. That is great, if your ground state is all on or all off. What if you have a ground state, safe condition or starting conditions, that has a complex on and off structure? Some registers have a parallel load option in addition to the serial load and the parallel output. Now if you want to go back to ground state all you do is load the parallel inputs to the output and you are done. The parallel inputs can be hard wired to power and ground so they are constant.
You are not forced to shift only in one direction. Some chips will have a direction selector that allows shifting to the right or to the left. You may also have a hold option that will keep the last setting even while the clock continues to toggle.
Outputs can be push-pull or open collector. You might even want them to go high impedance (tri-state). And who is to say if it should be a serial to parallel or a parallel to serialconnection? Well you are of course. They have those types as well.
Get one now, very low mileage
I feel a bit like a used car salesman today trying to sell you on the latest car on the lot. Truth is some people use shift registers a lot, others not at all. With the dropping price of powerful microcontrollers the need for logic gates has dropped off dramatically. It used to be that you would drop down a 555 timer to make a waveform, today you put a 25 cent MCU and write a little code. So why would we ever need a shift register? The last time I used one was because I had run out of GPIO pins on the MCU I was using. It did not make economic sense to get another one with more I/O so I converted enough of the outputs into a shift register and problem solved. It takes a bit more code, but for this application it made sense.
Is anyone out there
Aside from an obvious Pink Floyd reference I would like to know how many people are actually reading this in one form or another. I thought about putting something clearly incorrect and seeing how many people respond but I would rather a quick note letting me know the time I spend writing these weekly newsletters is useful to someone.
This newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan, Utah, which can be found on the web at:www.celticengineeringsolutions.com. You can find the newsletter on the company blog, LinkedIn or by subscribing. Send your emails to The Celtic Engineer at: [email protected].