neroroxxx / RoxMux

Collection of Multiplexer Controllers for some commonly used multiplexer chips.
Other
15 stars 5 forks source link

595 and 165 / Concurrent Usage / Shared CLK? #8

Closed WTFDuck closed 5 months ago

WTFDuck commented 7 months ago

HI! I am trying to get set up with 74hc595 and 74hc165 shift registers on an ESP8266 controller. I seem to be getting hung up on setup() in the mux.begin() functions (two functions because I am trying to initialize two different shift register arrays) the second mux.begin seems to be overwriting the previous causing goofy behavior and stuff doesn't work right. I'm sure I'm doing it wrong.

In addition, I'd like to share the clock pin on them both if possible.

Are Rox74HC595 and Rox74HC165 meant to be used on the same micro-controller concurrently? If so, is there any documentation that I haven't found for this? Thanks in advance!

neroroxxx commented 7 months ago

Please post your code to check it out

WTFDuck commented 7 months ago

Out of frustration, I wiped it all to start over again, it ended up quite a disaster full of "lets try this" kind of stuff. But it should be easy enough to re-create when I sit down at my desk. I'll get back with you in next day or so. Thanks for the SUPER FAST response!

WTFDuck commented 7 months ago

Unrelated, but related.... after more digging I found my switches are really dirty, the brand new ones need debounce, but some of my switches are vintage auto stuff that are almost 70 years old and have been under sea water in a hurricane storm surge back in 2004. While they do work great to the human eye, they're EXCESSIVELY BOUNCY to a computer. I'm not sure if your debounce button library works with 74HC165 shift registers, it doesn't explicitly say it does, but documentation suggests it may not. I may have to develop my own thing here. Any input? I really like what you've created here. Thanks in advance.

neroroxxx commented 7 months ago

Yes they work together, in the RoxMux library examples folder there's a sketch named "RoxButton" you can use that as an template, you can ifnore the "pinMode" part since the pins will be from the 165, then in the loop replace

button.update(digitalRead(0), 50, LOW);

with

button.update(mux.read(YOUR_PIN_NUMBER_ON_MUX), 50, LOW);

The RoxButton library doesn't setup the pins or reads them directly instead you feed it the value of the pin and that's by design so you can use it with the 165

WTFDuck commented 7 months ago

THAT IS AMAZING! You made me so happy just to tell me this. Now I need to get 595 and 165 tied together properly. If I can make this software work I can finalize my board design.

Anyway, lemme try to wrap this up, and I'll post some code. Thanks again so much!

neroroxxx commented 7 months ago

By the way, i would not recommend mixing the clock or any other pin between them, keep them separate to avoid issues debugging, you can reuse the pins across multiple 165's but don't mix them with 595's