Monday, October 24, 2011
Monday, October 17, 2011
Shift Register 74HC595 Tutorials
I am here providing a simple and very good tutorials for Shift register 74HC595
Basically a shift register will, in the end, let you expand on the digital outputs you have on your mictrocontroller.
Each one of these 74HC595s can act like 8 more digital outputs, and you
can daisy chain them. So you could hook 8 of them up next to each other
and have control of 64 outputs.
But the way it works is a little confusing to think of at first, and these are helpful enough that it is really worth understanding what the heck is going on under the hood.
But the way it works is a little confusing to think of at first, and these are helpful enough that it is really worth understanding what the heck is going on under the hood.
You can imagine a shift register as a row of chairs. In this particular case, with the 74HC595, we have a row of 8 chairs. Each chair is either empty (0), or someone is sitting it (1).
Now, every 10 seconds or so, someone rings a bell, and everyone has to get up and move one chair to the right. If there was someone in that rightmost chair, well they just go away. In that leftmost chair, you can either tell someone to sit in it, or just leave it empty.
Now bringing this idea back to the 74HC595: This shift register consists of 8 output pins, which are either high (1) or low (0). When you pull the SRCLK (Serial Clock) pin high (analogy to ringing the bell), every pin moves one to the right. The Last pin drops out, and the new pin’s state is defined by the SER (Serial) pin, and you can set that to either 1 (HIGH) or 0 (LOW).
How does this let me control LEDs again? Well, say you have 8 LEDs hooked up to the shift registers outputs, and we want to turn on the 1st, 3rd and the 8th LED. So… what we can do is clear out the register so all LEDs are off. Then we put in one high, move it right 4 spots, add one high, move it over 1, then add another high. See the image on the right, it will make more sense.
The great thing is that the shift register has this pin called RCLK or register clock. You can hold this pin LOW while you get everything setup and nothing on the display pins will change. Then when you are done, and everything is how you want, you pull the RCLK HIGH and the 74HC595 will display the new settings. So even though we are changing values in the register in 8 steps, it looks like it was just one step.
Now, every 10 seconds or so, someone rings a bell, and everyone has to get up and move one chair to the right. If there was someone in that rightmost chair, well they just go away. In that leftmost chair, you can either tell someone to sit in it, or just leave it empty.
Now bringing this idea back to the 74HC595: This shift register consists of 8 output pins, which are either high (1) or low (0). When you pull the SRCLK (Serial Clock) pin high (analogy to ringing the bell), every pin moves one to the right. The Last pin drops out, and the new pin’s state is defined by the SER (Serial) pin, and you can set that to either 1 (HIGH) or 0 (LOW).
How does this let me control LEDs again? Well, say you have 8 LEDs hooked up to the shift registers outputs, and we want to turn on the 1st, 3rd and the 8th LED. So… what we can do is clear out the register so all LEDs are off. Then we put in one high, move it right 4 spots, add one high, move it over 1, then add another high. See the image on the right, it will make more sense.
The great thing is that the shift register has this pin called RCLK or register clock. You can hold this pin LOW while you get everything setup and nothing on the display pins will change. Then when you are done, and everything is how you want, you pull the RCLK HIGH and the 74HC595 will display the new settings. So even though we are changing values in the register in 8 steps, it looks like it was just one step.
operation of 74HC595
Set MR=1
Set OE=0
Set STCP=0
Set SHCP=0
Give to DS the value of D7
toggle SHCP (to 1 and back to 0)
Give to DS the value of D6
toggle SHCP (to 1 and back to 0)
....
Give to DS the value of D0
toggle SHCP (to 1 and back to 0)
toggle STCP (to 1 and back to 0) to see the data in the output
SHCP shifts the data without changing the output state, when you are done shifting you toggle STCP to output the result
The number of clock pulses required is the larger of the number of inputs and the number of outputs. After this number of clock pulses, all the required output states have been shifted into position in the 74HC597 output shift registers, and another dipping of the "strobe" line is performed to set these states on the shift register output pins.
A timing diagram for this operation is shown below:
The points in this diagram are:
Set MR=1
Set OE=0
Set STCP=0
Set SHCP=0
Give to DS the value of D7
toggle SHCP (to 1 and back to 0)
Give to DS the value of D6
toggle SHCP (to 1 and back to 0)
....
Give to DS the value of D0
toggle SHCP (to 1 and back to 0)
toggle STCP (to 1 and back to 0) to see the data in the output
SHCP shifts the data without changing the output state, when you are done shifting you toggle STCP to output the result
2.2. How to drive it
The circuit description covers use of the 74HC595. Use of the 74HC4094 (which may be cheaper and easier to find) is covered later in this document. First the strobe line is dipped low and back high again. This latches all the inputs into the 74HC165 input shift registers. Then the clocking begins. With each clock pulse, the data line is set to an output, and the appropriate data bit is presented on the line to be clocked into the output shift register. On the same clock pulse, the input shift register presents its next data bit to the microcontroller data pin. The data pin is set to an input, and this data bit read.The number of clock pulses required is the larger of the number of inputs and the number of outputs. After this number of clock pulses, all the required output states have been shifted into position in the 74HC597 output shift registers, and another dipping of the "strobe" line is performed to set these states on the shift register output pins.
A timing diagram for this operation is shown below:

- A: STROBE is pulsed low to latch inputs.
- B: DATA line is set to an output, and appropriate data placed on it. CLOCK is pulsed high to shift this data bit into the chain, and get next bit from the chain.
- C: DATA line is set to an input, and the data bit is read from the chain.
- D: In this example there are more outputs than inputs, so from this point, the rest of the outputs are clocked out.
- E: This is the rest of the outputs being clocked out.
- F: Finally, the STROBE line is pulsed again to latch the outputs onto the output shift register output pins.
Sunday, October 16, 2011
Free Ebook For Microcontroller
Introduction to Microcontrollers: Architecture, Programming, and Interfacing for the Motorola 68HC12

Introduction to Microcontrollers is a comprehensive introductory text/reference for electrical and computer engineers, students, and even hobbyists who have little experience in a high-level programming language. The book helps them understand how a typical microcontroller executes assembly language instructions and addressing modes on microprocessors. The book shows how to program with C++ and compile assembly language statements. The book utilizes the new 16-bit microcontroller, the Motorola 68Hc12, as the primary example. This "chip" replaces the very popular 8-bit microcontroller, the 68Hc11, as the leading microprocessor for a wide variety of applications and as a core tool for teaching engineering students. This new microcontroller is expected to be popular in industry because of its low cost per unit, low power consumption, and high processing speed.
* First introductory level book on the Motorola 68HC12
* Teaches engineers how a computer executes instructions
* Shows how a high-level programming language converts to assembly language
* Teaches the reader how a microcontroller is interfaced to the outside world
* Uses hundreds of examples throughout the text
* Over 200 homework problems give the reader in-depth practice
* A CD-ROM with HiWare's professional C++ compiler is included with the book
* A complete summary chapter on other available microcontrollers
Download Link
PIC Microcontroller: An Introduction to Software & Hardware Interfacing

About the Author
Han-Way Huang is a Professor in the Department of Electrical and Computer Engineering and Technology at Minnesota State University, Mankato, MN. He is a member of both IEEE and ASEE. Dr. Huang has taught microprocessor applications for more than 15 years and has authored several books on microprocessors.
Password = www.freebookspot.com
Download Link
Microcontrollers: Fundamentals and Applications with PIC
.jpg)
While the official documentation provided for the PIC family from Microchip is extensive, it can also be overwhelming. This book gives users the information necessary to understand the architecture and the programming of microcontrollers. Each topic is described using a reader-centered, top-bottom approach. First, the authors describe the concepts that are common to any microcontroller. Each of the topics is then detailed for PIC microcontrollers. Practical applications supplement each topic to provide further clarity. This book does not limit itself to a digital view of microcontrollers. Instead, it includes aspects of analog signals such as the acquisition and processing of external analog signals.
Download Link
Free 8051 Projects
Subscribe to:
Posts (Atom)