Serial IN shiftregister + multiplexing

Jun 15, 2006 15 Replies

Hi all,



I need to use it to extend the the number of input pins of my PIC16f628. I need to control 128 push buttons. Which serial IN shift register is commonly used? Do I need other parts, or will push buttons and resistors be enough?



And how does multiplexing multiple inputs work in general?



Thanks in advance, Greetings



Do you need to detect more than one button press at a time?

Dave :)

Yes, thats why I was thinking about serial in shift register, though I've to admit I've never used serial in registers.

Greetings

David L. J> > Hi all,

--- Please bottom post.

You can't use a serial-in shift register for that purpose. What you need is sixteen 8-bit parallel-in serial-out shift registers with serial inputs.

For your purpose, HC165's would work and would require 128 resistors, 128 switches, and 3 I/O's from your µC

Do you wish to continue?

-- John Fields Professional Circuit Designer

Thanx, I indeed meant parallel in serial out.. sorry.. How does multiplexing these work in general? I know how serial in, parallel out multiplexing works but I've never done 'input' multiplexing.. or is this even possible?

Greetings

---

Yes, and it's easy. (View in Courier)

VCC>---------+--+--+--+--+--+--+--+ U1 | | | | | | | | +----------+ [R][R][R][R][R][R][R][R] GND--|SIN | ___ | | | | | | | | | | +--O O---+--|--|--|--|--|--|--|-----------|D0 | | ___ | | | | | | | | | +--O O------+--|--|--|--|--|--|-----------|D1 | | ___ | | | | | | | | + O O---------+--|--|--|--|--|-----------|D2 | | ___ | | | | | | | +--O O------------+--|--|--|--|-----------|D3 | | ___ | | | | | | +--O O---------------+--|--|--|-----------|D4 | | ___ | | | | | +--O O------------------+--|--|-----------|D5 | | ___ | | | | +--O O---------------------+--|-----------|D6 | | ___ | | | +--O O------------------------+-----------|D7 | | |___ | GND VCC----|CLR | | | GND----|INH | | _ | +--------|S/L | | +-----|CLK SOUT|--+ | | +----------+ | | | | | | | | | +----------------+ VCC>---------+--+--+--+--+--+--+--+ | | | U2 | | | | | | | | | | | +----------+ [R][R][R][R][R][R][R][R] | | +--|SIN | ___ | | | | | | | | | | | | +--O O---+--|--|--|--|--|--|--|--|--|-----|D0 | | ___ | | | | | | | | | | | +--O O------+--|--|--|--|--|--|--|--|-----|D1 | | ___ | | | | | | | | | | + O O---------+--|--|--|--|--|--|--|-----|D2 | | ___ | | | | | | | | | +--O O------------+--|--|--|--|--|--|-----|D3 | | ___ | | | | | | | | +--O O---------------+--|--|--|--|--|-----|D4 | | ___ | | | | | | | +--O O------------------+--|--|--|--|-----|D5 | | ___ | | | | | | +--O O---------------------+--|--|--|-----|D6 | | ___ | | | | | +--O O------------------------+--|--|-----|D7 | | | | |___ | GND VCC--|--|-----|CLR | | | | | GND--|--|-----|INH | | | | _ | +--|-----|S/L | | +-----|CLK SOUT|--+ | | +----------+ | | | | . . . . . . . . . | | | | | +----------------+ VCC>---------+--+--+--+--+--+--+--+ | | | U16 | | | | | | | | | | | +----------+ [R][R][R][R][R][R][R][R] | | +--|SIN | ___ | | | | | | | | | | | | +--O O---+--|--|--|--|--|--|--|--|--|-----|D0 | | ___ | | | | | | | | | | | +--O O------+--|--|--|--|--|--|--|--|-----|D1 | | ___ | | | | | | | | | | + O O---------+--|--|--|--|--|--|--|-----|D2 | | ___ | | | | | | | | | +--O O------------+--|--|--|--|--|--|-----|D3 | | ___ | | | | | | | | +--O O---------------+--|--|--|--|--|-----|D4 | | ___ | | | | | | | +--O O------------------+--|--|--|--|-----|D5 | | ___ | | | | | | +--O O---------------------+--|--|--|-----|D6 | | ___ | | | | | +--O O------------------------+--|--|-----|D7 | | | | |___ | GND VCC--|--|-----|CLR | | | | | GND--|--|-----|INH | _ | | | _ | S/L>---------------------------------+--|-----|S/L | CLK>------------------------------------+-----|> SOUT|--+ +----------+ | | SERIAL DATA

Hi John,

Thanks a lot for your help!! But this doesn't look like multiplexing the shift registers are cascaded not multiplexed, right?

btw. Which software did you use for that diagram?

Greetings

Their inputs are being time-division-multiplexed. Won\'t that work for your application?

Please crosspost when you post the same question to two or more NGs. I answered this in s.e.d already - three output bits to drive a 74HC138, to give 8 row drives; a 16 x 8 matrix of switches with isolation diodes, and two shift registers. That's 3 chips instead of 16, but you do need

128 diodes. And 16x 47K pullup resistors.

So the matrix is multiplexed, and the rows are time-division multiplexed, as John said.

Cheers! Rich

In this case the inputs aren't time division multiplexed as they are all sampled at the same time and then shifted out.

Dave :)

Oke thanks a lot for your information. I'm going to order some parts now. Which type of diodes are recommended? And why such a huge resistor of

47K?

Greetings

By the time you've shifed all those inputs, debounced them and decoded them you may well find you have used so much rom/ram and time that you dont have any left for your main application. I would consider a much bigger processor or a second processor dedicated to the pushbuttons sending button presses over the serial link.

It's good desig practice, as anything less is just throwing away current. The CMOS input means you can use a big value resistor and not waste as much current. By all means use a 1K if you are happy to suck 5mA every time a switch is pressed.

It's fun at work reviewing each others designs when you get to take someone to task like "you're pissing away a whole 1uA"!

Dave :)

I\'m confused. What diodes and resistors are you talking about?

I guess, in the strictest sense, you\'re right. It sure comes out TDM though!

24 inputs int three I/O pins looks like multiplexing to me.

Bye. Jasen

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required