Tuesday, October 9, 2012

Lab: Shift Registers

Overview:

The purpose of this lab was to use see the usefulness of shift registers and how the work.

Shifting Out:

In previous labs, we have never used more than 8-10 pins at once. If we ever ran into a circuit that needed additional pins what would we do? Shift registers allow the Arduino to extend to many more pins than the ones on it's board. With one shift register you can control 8 outputs at once while only taking up a few pins on the microcontroller. If you need more pins, shift registers can connect to each other allowing more extensions.

Instead of using "asynchronous serial communication", the shift register works by "synchronous serial communication", pulsing a pin up and down which communicates a byte of data bit by bit while the clock pin delineated between them. When the byte is completely transmitted to the shift register, the high or low messages carried by each bit get allocated into the output of each LED. Shift registers can be confusing without the knowledge of each pin-out so I have included a drawing.

In the first circuit, just one shift register is used to light up 8 LEDs. Once connections were made to ground and power, the Serial Data Input, Shift Register Clock Pin, and Storage Register Clock Pin were connected. The LEDs were then added with resistors and connected to 8 pins around the register (Q0 - Q7). Finally the code was added to give a binary counting system to the LEDs:


In the second circuit, a second shift register was added without any additional wired to the Arduino. A "serial output" is used by an extra pin in one register to pass serial information from the Arduino out again without changing. This allows us to transmit 16 bits in a row using the second register. The first 8 bits flow through the first register to the second. The code was added to light all 16 LEDs one by one and other patterns:


Problems:

Although the shift registers clean up the wire collection on the Arduino, it asks for a lot of wires on the breadboards, as can be seen from the photos. With so many small, tight connections, it was difficult to make sure the connections were right the first try. Using the drawing of the shift register above made it easier to lay out where each where should connect to. 

Links:

No comments:

Post a Comment