Mixing analog and digital inputs/outputs

Thread Starter

Seb0042

Joined Dec 15, 2023
2
Hi,

I'am a beginner so maybe my questions will be dumb but I was wondering how to do the following.

I connected a mcp3008 to the spi bus of a raspberry and could read the data (from potentiometers).
Then I connected a 74hc165 to the spi bus and could read data from differents buttons (when pressed).
I know that I can chain 74hc165 and that I can't chain mcp3008.
But is it possible to connect the mcp3008 as an input of a 74hc165 ? I would say no because of the chip select but I'm not sure.
So if no, what could be the chip(s) to realize that ? I think 8 analogs inputs may be enough, and around 20 for digital.

I will have the same question for the outputs, I was thinking of using chained 74hc595 to light some leds (button pressed light up or down a led).
Thanks in advance for your answers.
 

Ian0

Joined Aug 7, 2020
9,993
You can easily chain shift registers, but if you want to connect several A/D converters to the SPI bus, you can do it by providing a separate CS signal for each one, and connecting all the MOSI/MOSI/CLK pins in parallel. I designed a product that used 74HC597s to connect 72 inputs to the processor, and output to 64 LEDs using eight 74HC595s
 

Thread Starter

Seb0042

Joined Dec 15, 2023
2
Ok thanks, so I should use 74HC597 for mixing entries from the 74hc165 and mcp3008 ? Then it's all about the code ? :)
 
Top