[SOLVED] would someone mind checking this shift register please.

Hi @matelot

My 74HC165 work with the sketches, please try yours again.


All ones implies you do not have these lines as:

#define HC165
//#define CD4021

Well!! I don't know what to say. (yes I do).
I pulled all the wires out and started again.
Wired up for the 165 and I am sure I wired the same as before but I followed your diagram and all three of my 165's work correctly now.
All I needed was perseverance, and a web site consisting of people who have a lot of knowledge and patience to help some one.
Thank you Sir, I am indebted to you.
At least now I can try to find why my prog shift everything along 1 and know I have good chips.
What is the schematic program you used?

Great !


I use the WINQCAD schematic program, but unfortunately it's no longer available. :frowning:

Many here use EAGLE, KICAD and EasyEDA.


I believe the problem where you lost bit 8 was due to the library shifting the register before the bit 8 was read.

The 3 sketches offered you fixes that problem.

The SPI sketch is a much cleaner way to read shift registers, suggest you use it in your projects.


Note: you will observe these 3 sketches 'will show on the serial monitor' leading 0's:

example 00001001 rather than 1001

I refer to my previous question why use delaymicroseconds? Do you realise how short a micro second is it achieves nothing as it t is not long enough for a debounce

Unfortunately many software examples add this short delay thinking that a settling time is needed, it isn’t.

One advantage might be to widen the signal on an oscilloscope but that’s stretching things way too much.