-->
Page 2 of 3

Re: Problems with PIN Extender

PostPosted: Tue Oct 09, 2018 12:25 am
by buzzy
martinayotte wrote:Why not using a simple I2C GPIO Expander such MCP23017 ?
It is much simplier to use than trying to mux pins using those 74HC165 ...


Well, according to documentation and videos online, it's not suppose to be hard to use the 74HC165 either. Not sure why it's not working for me. Also, the MCP23017 cost 10 times more than the 74HC165. 10 cents vs 1 dollar. If I need 10 of those in one device, it adds up.

Btw, the 74HC165 is not a multiplexer, it's a shift register. The code of using it is almost identical to the I2C expanders, so it's not clear to me why using the MCP23017 would be easier? In what way? If anything, it's slower than SPI :)

Re: Problems with PIN Extender

PostPosted: Tue Oct 09, 2018 9:37 am
by martinayotte
buzzy wrote:Btw, the 74HC165 is not a multiplexer, it's a shift register.

I know, I've used them more than 30 years ago for video output. But the way you are using it with switches at the inputs is equivalent of a multiplexer ...
buzzy wrote:The code of using it is almost identical to the I2C expanders, so it's not clear to me why using the MCP23017 would be easier? In what way? If anything, it's slower than SPI :)

If it only to read switches, no speed requires, it becomes easier using a MCP23017 since it requires only 2 wires, and a third one if you wish interrupts capabilities...

Re: Problems with PIN Extender

PostPosted: Tue Oct 09, 2018 9:57 am
by buzzy
martinayotte wrote:
buzzy wrote:Btw, the 74HC165 is not a multiplexer, it's a shift register.

I know, I've used them more than 30 years ago for video output. But the way you are using it with switches at the inputs is equivalent of a multiplexer ...
buzzy wrote:The code of using it is almost identical to the I2C expanders, so it's not clear to me why using the MCP23017 would be easier? In what way? If anything, it's slower than SPI :)

If it only to read switches, no speed requires, it becomes easier using a MCP23017 since it requires only 2 wires, and a third one if you wish interrupts capabilities...


Ok, so can you tell what is wrong with my wiring/code? Thanks!

Re: Problems with PIN Extender

PostPosted: Tue Oct 09, 2018 11:52 am
by martinayotte
buzzy wrote:Ok, so can you tell what is wrong with my wiring/code? Thanks!

According to your schematic, it seems that your SW1 switch is shorting power and ground, it is not on the right side of the pulldown resistor.

Also, can you provide the code your are using since the issue maybe there ?