74HC595 and 74HC165 combined library.

Hello to all.

I am doing a project on i wanna use one 74HC595 and one 74HC165 for the inputs and outputs. And i will like to use it in one library, like the one is found at the end of that thread.


I have readed many times the entire thread, and the instructions of how to use it, is for the early versions, on which there are two libraries, one for the 165, and another for the 595.

In the combined version i dont know how to initialize the library, neither the functions to read and write on the shift registers.

Maybe the author or someone else can help me to understand better the use of that library? A little drawing showing the shared pins on the ic's will help too.

I wanna apologize for my english, i am a spanish speaker.

Thank you.

How do you want to wire these up as two chained shift registers or as two separate systems?

I wanna use as a separate systems.

The 165 for reading switchwes, and the 595 for general purposes, like driving leds, two optocouplers and other stuff like that.

Just add the two libraries into you sketch and initialises the two devices separately and don't use any common pins.

Reply #24 has an example of using the two together.

I know. And is well explained.

But i am using a uno, with an lcd and other stuff attached, only have 5 free pins.

Did you know the analog pins can also be used for digital out ..., maybe that solves the #free pins?

Well instead of the shift registers why not use a port expander. The MCP23016 gives you 16 input/output pins for just two I2C pins, and you can have up to 8 of them connected at the same time. Where as for faster transfer using SPI you can use the MCP23S13 which again gives 16 I/O with 8 usable at the same time.


No didn’t know. And what pin number is used? A0?


I wanna use the 74HC because i have a bunch of them. And the MCP seems pretty hard to find around here.

And what pin number is used? A0?

Using A0 refer to it as pin14, A1 as pin15 and so on.

the MCP seems pretty hard to find around here.

For Spain:- You can get them here:- http://es.farnell.com/jsp/search/results.jsp?N=0&Ntk=gensearch&Ntt=MCP23016&Ntx=mode+matchallpartial&suggestions=false&ref=globalsearch&_requestid=22843&isGoback=false&displaytext=&isRedirect=false

Farnell is one place to find this in spain, and can be also found on RS.

But, 1.95€ the part. 14.95€ transports.

For one or two ic's is not a big deal.

The MCP23016 already have a library?

Why you prefer the MCP23016 vs a 74HC? The 74HC are cheaper.

Because they use less pins and are easer to use. I use them in a lot of my projects. Yes Farnell have a postage charge but if you buy enough it is postage free. In the UK this works out at about £25.