I am breadboarding the controller part of a project for which I need to read 8 switches. They are pulled-up to Vcc through a resistor network, sent to the parallel inputs of a 74hc165, the 74hc165 is connected to an ATMega644p (clock and load configured as outputs, serial data configured as input without pull-up). I'm not using SPI, just bit-banging load and clock.
All my readouts were 0s so I started looking at the voltage at the pin receiving shifted data. I don't have a scope but by slowing down the code that clocks the 74hc165 I could look at the transitions on a multimeter. Here's my weird findings:
- When the 74hc165 is not connected to the mcu, the voltage is, as expected 0 or 4.96V in a sequence that reflects the pressed switches.
- When the 74hc165 is connected to the mcu, the voltage is a sequence of 0 or 0.95V in the same sequence - so the mcu sees only 0s.
I expected the inputs of the mcu to be high impedance, but there seems to be a heavy "load" at the input pin - that or the 74hc165 output is weak. I tried adding an op-amp buffer and it worked. I also tried a simple transistor pulling the output to 5V, and it worked. But it makes little sense to me to have to use a buffer/transistor for such a common task as reading a 74xxx gate.
I swapped-in another 74xxx ; and another 644p, so I have excluded the "damaged chip" theory. I have also tried using other combinations of input/output pins to no avail. Note also that I have a bunch of rotary encoders connected to digital inputs and they work fine, even when connected on the pins on which I tried to read the 74hc165 output.
Any idea what could be wrong ?