NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » How do I interface a Parallel-In Serial Out Shift Register with my microcontroller?

May 31, 2011
by rboggs10
rboggs10's Avatar

I want to hook up buttons to my shift register and have it send serial data to tell which button is pressed. How would I do this?

May 31, 2011
by rboggs10
rboggs10's Avatar

Oh and by the way here is the datasheet for my Shift register: Datasheet

May 31, 2011
by Rick_S
Rick_S's Avatar

Unless you wanted to constantly clock that chip an poll the serial data, there would be no real time way to check for button presses on an input. Now if the goal is to attach that to a dip switch array and read the position of those switches that could be done. Certain port expanders have an interrupt output that will signal a button press to prevent constant polling if you are looking for that.

I guess what it boils down to is this.

  1. You really need to provide a little more specifics if you want help.
  2. You are more apt to get a more helpful response if you present sample code of what you have tried to get code suggestions.
  3. What I do if I have a chip that I don't understand is read the datasheet, search the internet for code examples (of what I'm trying to do), and build from there.

I'm one of the most helpful guys here as most of my fellow Nerds will attest. However, I have enough on my plate with my own projects and such. I don't do peoples projects for them. If I had one of those with some spare time, I might play around with it if I knew exactly what you are trying to do. However by your post, the chip you are trying to use... Which I responded to in another thread... may not be the best for the application.

Rick

May 31, 2011
by rboggs10
rboggs10's Avatar

By port expander is this what you mean?: Port Expander

May 31, 2011
by Rick_S
Rick_S's Avatar

Somewhat like that one. The one you linked doesn't have an interrupt output to let the micro know it has a button pressed. I've used a 7318 in my I2C LCD project. I didn't use inputs on it though. The 7318 has the output. If you search the forum, there was someone else using a different expander with the intent of using inputs. I'm not sure where right now. I may check later and get back to you if you don't find it.

Rick

May 31, 2011
by rboggs10
rboggs10's Avatar

Thanks, I will take a look at expanders and see what I can find. Expanders look more simple than shift registers.

June 01, 2011
by Ralphxyz
Ralphxyz's Avatar

rboggs10, you might want to follow/participate in this thread with Inino.

He is working on using switch input on a I2C port expander, he has the output working.

Ralph

June 01, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi rboggs10,

Just to throw another example out there we used the SPI bus to drive a shift register in our Xylophone project. That might give you some ideas.

Humberto

Post a Reply

Please log in to post a reply.

Did you know that a square wave sounds different than a sine wave? Learn more...