cancel
Showing results for 
Search instead for 
Did you mean: 

GPIOs or serial shift registers

Ehsan Nayeri
Associate II
Posted on June 27, 2018 at 07:33

Hi,

For an application we need a bulk of digital inputs(comes from sensors- about 30 inputs) and a bulk of digital outputs(go to relays- about 15 outputs). which solution would be better?

1- using a high count digital input micro like Stm32f103V/Z

2- using serial shift registers like 74HC595 for inputs and 74HC165 for outputs

thanks for your help

#digital-pins #74hc595 #shift-register
5 REPLIES 5
AvaTar
Lead
Posted on June 27, 2018 at 08:30

This depends on your requirements, especially on rates of change.

With serial shift registers, you will not achieve the throughput as with native GPIO ports.

There is a third alternative: one 8-bit GPIO port, with several latched 8-bit buffers, and a few other GPIO port lines for multiplexing (addressing) and latching.

Danish1
Lead II
Posted on June 27, 2018 at 09:48

When you need to decide which is better, you have to ask what are you trying to optimize for?

  • Speed of control / Ease of programming? I think microcontroller with many pins wins here.
  • Robustness of solution? The coils on relays can and do generate nasty spikes when they are turned off. You do need a robust circuit to switch them, with the current-handling-capacity for the coil and diodes to protect against the switch-off. Will you be using (for example) a few driver array chips e.g. ULN2001 or similar, or do you want to do it with discrete components? Similarly each input might need protection or signal-conditioning.
  • Expansibility of solution? A big-enough microcontroller then however many I/O expander chips (I'm probably out-of-date but last time I had the need I chose MAX6956; MAX7301 is cheaper and probably easier to interface) or shift-registers or whatever as you currently need. It is relatively easy to tack on extra ones as and when the need arises.
  • Cheapness of total bill-of-materials? I know many people like to optimize for this, but it is often a false economy. Unless you are producing the item in huge quantities with no time pressure or the programmer's time-and-trouble are as good as free, something that takes more programming effort will take longer to get working at all, and longer to fix any bugs that are later found.
  • For real cheapness for the hobbyist and only a very few are wanted, what you already have in the 'junk' box might be the deciding factor. If you already have a demo board for a particular microcontroller then you can start playing now, and when you're happy with the design you just need to order enough to duplicate that,

Hope this helps,

Danish

T J
Lead
Posted on June 27, 2018 at 11:11

definitely better to use a high pin count chip.

and better to use the LQFP, its much easier to route a 2 layer board with LQFP

Posted on June 27, 2018 at 09:51

Thanks for reply. rate of change is not so fast(100Hz max). Main consideration is Safety&Integrity and cost of the design.

this board is going to be mass product.  

Posted on June 27, 2018 at 10:13

This would suggest the serial shift register.

In my experience, high-pincount versions of MCUs use to come with larger RAM/FLASH and consequently higher price tag.

I guess you could scale down on performance, trying a M0 like the F0xx series, or 8-bit / 16-bit MCUs, perhaps from other vendors.

Main consideration is Safety&Integrity ...

Or a Cortex R4 MCU with lockstep double core, like a TI Hercules...