74HC165 misses Button 8 and 16.

Hi all sorry if this quastion is ask for the milion times! but i get some problems..

and to give a idea. i made a Controller, with 8 encoders, 8 pots, 16 switches, 16 leds, 2 lcd screens.

i used the 3 wire liabry with a 2x74HC595 for the lcd screens. work OK!!! i like to use the MCP3208 for the 8 pots still need to programm this. i like to have the encoders and buttons on 74HC165 the buttons works only i have a little issue, encoders needs to be programmed. and the leds are on 74HC595. works OK!!

oke i have a issue with the buttons because i miss Button 8 from the shift register. i allready readed a issue report about this but that was back in 2010.

also nice to know i use the CLOCK and LATCH pin for the 74HC165 and 74HC595 as the same...

i also found a libary made for the 74HC165 that worked perfect only that gives strange result on my Leds. 74HC595. so why is the standard "shiftIn" function not working correct.

/Spirit

so why is the standard "shiftIn" function not working correct.

Because you are doing it wrong?

Post schematic, code. Let's see what you have connected up.

You can use 74HC165 and 74HC595 at the same time. SCK goes to both. MOSI to the 74HC595 to send data out, MISO to the 74HC165 to read data back. Then use the SPI hardware for the data transfers.

Latch can go to both - just need to be careful about when it is used. Latch Low then High to capture data at the '165 inputs. Then Read the inputs while you write data to the '595. Then Latch Low & High again to move the data to the '595 output register.

digitalWrite (latchPin, LOW);
digitalWrite (latchPin, HIGH); // capture data at 165 inputs,
incomingByte = SPI.transfer(outgoingByte); // read in MISO while send out on MOSI

// add a 2nd transfer if have 2 of each part daisychained:
incomingByt1e = SPI.transfer(outgoingByte1); // read in MISO while send out on MOSI

//data can also go into an array, and be sent out from an array:

incomingByte[0] = SPI.transfer(outgoingByte[0]); // read in MISO while send out on MOSI
incomingByte[1] = SPI.transfer(outgoingByte[1]); // read in MISO while send out on MOSI

digitalWrite (latchPin, LOW);
digitalWrite (latchPin, HIGH); // capture next data at 165 inputs, move outgoing to output of '595

hi and thanks for the replay

but why does the shiftIn function not woring correct? do i need to do something else? or just dont use the ShiftIn function.

and PFFF maby i'm trying to do something to Hard XD as i never used the SPI before so i realy dont have a clue about that... maby i need to learn that a little better.

and its just a Fun project to see if i could create it... as there is a other project MIDIBOX that can allready do what i'm trying..but its just for the fun..

but just for the fun some pictures XD

/spirit

IMAG0035[1].jpg|3264x1840

IMAG0036[1].jpg|3264x1840

2nd request: Post schematic, code. Let's see what you have connected up.