Shift register?

shamu

Member
Hi all.

I have read quite a bit on POV displays and most of them use a shift register. Reading on LED cubes lastnight and low and behold the mention of shift registers cropped up again.

Thinking that these shift register things must be a good thing I researched them in an effort to workout how they are applied in such an application.

All I can glean is they they offer some sort of storage but there must be more to it than this.
Can anyone shed more light on the subject please, preferably in laymans terms.

Thanks.:)
 

Buzby

Senior Member
From : http://en.wikipedia.org/wiki/Shift_register

SIPO registers are commonly attached to the output of microprocessors when more General Purpose Input/Output pins are required than are available. This allows several binary devices to be controlled using only two or three pins, but slower than parallel I/O - the devices in question are attached to the parallel outputs of the shift register, then the desired state of all those devices can be sent out of the microprocessor using a single serial connection.
 

Paix

Senior Member
With three 8 bit serial in parallel out shift registers 74HC595 chained together for example, it would be possible to shift in three bytes worth of information (24 bits) and then pass all that data to the parallel output pins for display. The shifting in of data happening whilst the previous data is being displayed, which is about what you would want for your POV.

It might be worth Googling "74HC595 ebay" and taking a chance at between 23 and 29 cents apiece, what's that 15 to 20p?
 

westaust55

Moderator
In line with the suggestion by PAIX for 3 x 74HC595 shift registers, have a look at the project that I have previously posted here:
http://www.picaxeforum.co.uk/showthread.php?13687-3-digit-display-using-74HC595

I would suggest thinking of shift registers as a form of serial to parallel interface with some variants such as the 74HC595 including an output latch to hold the output data steady while new data is clocked in and thus avoid "flicker" on the outputs as the new data ripples through.

If using the X1 and X2 parts, the inbuilt SHIFTOUT command is (from recollection – I did post some speed comparison long ago) around 4 times faster than bit-bang coding as required for M2 and other pRts. The i2c comms bus will be faster still.

I would consider using the MCP23017 chips but if you are just getting to grips with the idea of shift registers they are cheap enough and may prove less complex for someone with limited experience so suggest you start with the shift register approach and then do mark 2 version with i2c comms.
I recall there is also a 16 bit version of the 74HC595 shift register but do not recall the aprt number from memory.
 
Last edited:

Paix

Senior Member
Thanks on that Westaust55, I have noted the MCP23017 as a useful chip to get to know, it sounds very versatile. worth a bit of reading and boggling with. Reasonably cheap too. We are truly spoiled.
 

Paix

Senior Member
Confession time - I did a little reading and very quickly realised that I understand shift registers quite well . . . but it looks like the MCP23017 is likely to be well out of my mental grasp for quite some time. What chance of an aha moment I ask myself, but am not about to put money on that happening, just yet. The data sheet fails to help my understanding. Most of it looks to be English, but somehow my brain tells me that it's actually all Greek to me.
 

hippy

Technical Support
Staff member
it looks like the MCP23017 is likely to be well out of my mental grasp for quite some time.
Perhaps the easiest way to view it is as how a PICAXE can be used as an I2C Slave which can accept commands which tell it how to control and read its I/O pins and perform other tricks.

There are registers which set the pins, registers to read the pins, registers which say whether a pin is an output or an input, and more registers which can be used to determine if an input pin has gone high or low. In addition there's more to invert polarity of inputs and outputs; write a 1 and the output can be made to go low instead of high etc.

Controlling the MCP23017 is a lot like any PICAXE controlling its own I/O pins but instead of doing it directly with PICAXE commands, you have to figure what commands and settings are required then pass them over to the MCP23017 to have that happen.

An analogy is the manager of a supermarket telling his security officer which doors of the shop he wants as entry and exit doors, which are to be usable and which locked shut, with an additional 'tell me when anyone comes through a particular door'. The manager says what he wants and receives reports back, the security guy does the actual work to make it happen.

The key to understanding is two fold; what it does and how that is achieved. Start with considering how an output pin can be set ( ignoring whether that would work or not ). To set GPIO7 output pin high you need to set bit 7 in the OLATA register. That's similar to 'Let outpinsA=%10000000' except you need to send the command via I2c - "HI2cOut OLATA_REG, (%10000000)'.

To make sure it's an output pin; bit 7 needs to be cleared in the DIRA register, similar to 'Let dirsA=%00000000' again using I2C "HI2cOut DIRA_REG, (%00000000)'.

Get to grips with the basics and then how things can be manipulated in other registers and what that achieves should start to fall into place.
 

Paix

Senior Member
Thanks for that Hippy, the learning curve seems particularly steep, so maybe I will need a pair of crampons and a Picaxe to scale it.
I think that there was an element of shock and confusion as things were not hardware as I understood it.

I started with Fairchild RTL and moved to 74N TTL way back, I had a few books with package outlines and truth tables etc. which I had asked distributor for. As I moved up to LSI and a little bit of VLSI chips, most of it usually made sense after a lot of pouring over the datasheets. I was chuffed as a young man when I read the datasheets for the UARTS of the day and FIFO chips and realised that I understood what was going on . . . It's probably been downhill since then but I try to keep my hand in.

The MCP23017 is very cheap and powerful so I should persevere. As you have said, it's getting accustomed to the concept that is key to it all.
I have a theory, you don't learn concepts. You learn to accommodate them. What that really means is that it's not an overnight thing, but working at it and becoming accustomed to the way things are done.

This is going to be a bit of a challenge and won't happen overnight, but I will work on it and see if I can't crack it. Thanks once more.
I had better order myself a chip to play with and test the fruits of my understanding if they come to that . . . .

Ordered.
 
Last edited:

westaust55

Moderator
I haves posted on at least two past projects I built which use the MCP23017 i2c IO expander chip.
1 using a single chip is a simple board resolution compass display with 16 LEDs in a circle and 32 increments of resolution.

Another more complex is an 8x8 RGB LED display using two MCP23017s in a multiplexed format.
That thread has a title about RGB LEDs.

I have also posted an MCP23017 register info spreadsheet which may be easier then search through many pages of the Datasheet.
 
Top