Introduction: Shift Register With MSP430
In this instructable we'll see how the 74HC595 shift register works, then we're going to build a circuit with an LED array and connect it to the MSP430 Microcontroller. By writing C code in Code Compose Studio, we'll play with our circuit.
8 LEDs, 8 Current limiting resistors, breadboard, MSP430 Launchpad, jumper cables, code composer studio
Step 1: Basics of the Shift Register
Let's look at some definitions:
•A flip flop is an element which is able to store one bit data. A register contains several flip flops. An n-bit register is consisted of n flip flops and several logic gates that implement their state transitions.
•A register capable of shifting its stored bits is called a shift register. A shift register is formed by chain-connected flip flops, where the output of a flip flop is connected to the input of the other. Flip flops are fed by the same clock source.
The pins of the 74HC595 Shift Reg:
SRCLK–Shift Register Clock
SRCLR–Shift Register Clear
QA-QH - Outputs
Here you should pay attention that the Output Enable and the Shift Register Clear pins are active low, meaning that you have to connect pin 13 to the ground to enable output and you have to connect pin 10 to Vcc in order to avoid clearing the Shift Register’s content.
Step 2: How Shift Register Works
The Working principle of the Serial in Parallel out shift register:
1)The input is fed in the SER pin (a zero or one bit: low or high voltage)
2)SRCLK is triggered with a clock pulse to insert the input to the first stage of the shift register
3)RCLK is triggered with a clock pulse to insert the content of the Shift Register stages to Storage Register and if the Output is enabled we'll be able to see the content.
4)In each new input+SRCLK+RCLK cycle a new input (either a zero or one) is inserted to the first stage and the other stages are shifted to the next stage.
You can see the video for the animation of these steps.
Step 3: Circuit Setup
We'll create our circuit according to the diagram.
connect the VCC and the GND pins of the shift register to the related pins in the MSP430 Launchpad.
connect 8 output pins to 8 resistors and LEDs,
connect P1.0 of the MSP430 to the SER input of the Shift Register.
connect active low OE to ground
connect SRCLK to P1.4 pin of the MSP430
connect RCLK to P1.5 pin of the MSP430
connect active low SRCLR to VCC
Step 4: Programming in Code Composer Studio
You can use the following five example codes to play with the circuit that you've built:
I hope you enjoy this instructable.
See you in another one!