I must be misunderstanding how a Mux board works. I imagined that the chip recognizes which input is changing, then sends the selector code to the board along with the output of the potentiometer/button/etc.
So why, when programming the Arduino, do we set the pinMode() as OUTPUT? Are we really just "scanning on all frequencies" for changes rather than sending specific commands to the Arduino?
Most muxes have N inputs, one output, and a set of control inputs that direct which input is tied to the output. The control inputs to the mux need to be outputs from the Arduino. They do NOT "recognize which input is changing."
A mux generally has one of its inputs selected to go to an output pin that the Arduino can read.
Or, in a demux, one of the outputs is selected to follow the input pin, which is an Output from the Arduino.
So, some the input to output channel must be selected, typically with 3 or 4 channel select, or address pins. The Output pins from the Arduino set that address.
There are chips where the inputs are monitored, and an interrupt generated to a microcontroller (uC) to let it know something has happened. The uC can then read a register to see which input changed and go from there.
Which situation are referring to? Which hardware product?
CrossRoads:
A mux generally has one of its inputs selected to go to an output pin that the Arduino can read.
Or, in a demux, one of the outputs is selected to follow the input pin, which is an Output from the Arduino.
So, some the input to output channel must be selected, typically with 3 or 4 channel select, or address pins. The Output pins from the Arduino set that address.
There are chips where the inputs are monitored, and an interrupt generated to a microcontroller (uC) to let it know something has happened. The uC can then read a register to see which input changed and go from there.
Which situation are referring to? Which hardware product?
It is an Arduino Leonardo, and I believe a HP4067.
I am just trying to understand the logic regarding how it knows which port its reading. I understand that there are all the channels, [0,0,0,0] [1,0,0,0], etc, but in which direction is this information being read? Is the arduino polling every channel continuously and reading its state, or is the multiplexer sending channel info when it registers a change. It appears to be the former, I am just making sure I am understanding it correctly because the latter made sense to me first, but I am also a noob
The arduino controls the lines that select the channel. The multiplexer doesn't monitor the 16 channels it's multiplexing - it just listens to the lines that select the channel, and connects whichever channel those specify to the output.
If you want to know the values of each channel continuously, you have to have it poll each channel.
DrAzzy:
The arduino controls the lines that select the channel. The multiplexer doesn't monitor the 16 channels it's multiplexing - it just listens to the lines that select the channel, and connects whichever channel those specify to the output.
If you want to know the values of each channel continuously, you have to have it poll each channel.
Ok, that makes sense. This is really my first ever Arduino project so I wasn't sure how it worked