Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple question about shift registers. 2

Status
Not open for further replies.

Richk67

Electrical
Dec 13, 2007
1
I want to connect 8 on/off spst switches to the inputs of a Piso shift register in a multiplex control system. My question is this. How will the register know when an input changes states? I don't want to have to run a comm line back to the MCU for every switch. If I did that, I wouldn't need the register.
 
Replies continue below

Recommended for you

I'm not sure what a "Piso" shoft register is, but reading the datasheet of any common SR should show you that a clocking line is necessary. Besides, without one, how would you plan on getting the data to your micro?

Dan - Owner
Footwell%20Animation%20Tiny.gif
 
I assume PISO = parallel in, serial out.

You can either have your micro poll the shift register every so often in order to tell when a switch changes state or maybe you can use an I/O expander chip that will cause an interrupt on the micro when a switch changes state.
 
You will also need to account for how you handle de-bouncing the switches. When the switch is pressed or released you will see several very short duration on and off transitions and you will need to make sure your logic is immune to these.

This can be accomplished in either hardware or software and google should provide more than enough information on ways to accomplish this task.

I recently designed a controller where I use a state machine implemented in programmable logic to periodically scan the switches, detect and qualify any switch transitions, save the updated switch readings and then generate an interrupt to the processor. The performance has been great: it is very responsive, can detect when a switch is pressed and released, and does not burden the software with periodic polling.

 
Richk67: With no additional h/w you will need to decode/debounce the switches in software, most likely using a polling method. Using Noway2's advice to use Google I found the following:
I also ran Google searches on 74HC165, a popular PISO and the combined search terms: 74HC165 and code. Of course, the code examples will not include the code you will need to setup your mux before you poll the shift regsiter.
Regards.
 
Hi.

Try using the SPI bus (SCLK,SDI) and either 74HC166 or 74HC589a.

Good luck!

Regards,
Gonzalo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor