Not using all pins on Shift in Shift Register

Hello all,

Im using CD4021BCN shift in register and as it has 8 pins and if out of those 8 i have to use only 4/5 input pins then what should i do in circuit and software changes.

attach the unused inputs to GND so they always read 0, or to 5v( or whatever the HIGH voltage is ) for a 1.
Then after reading using shiftIn just ignore the bits in the return value that correspond to the unused pins.
Logic chip inputs should be either HIGH or LOW, floating inputs can cause bad operation in some chips.

Please have Look on the following diagram, i have linked all unused pins with Gnd but im not sure what to do with pin 11?

When the shift register has a bit shifted in, the end bit needs to be replaced, its value is determined by pin 11. If you set it to ground, the value zero is used. If you set it to Q8 of a second shift register, it will pull the second registers bits into the first when they are both clocked.

So if you set it to ground and the shift register contains 10101010

using shiftIn twice with out unlatching will produce

Read 1: 10101010 Read 2: 00000000

If not using an input, tie it to ground or 5V. If the value doesn't matter, then it does matter which. pin 11 is the serial input (so I presume you are doing parallel-input, serial-output. Tie the serial input to ground.

CMOS logic chips are not happy with floating inputs (the gates may end up in the linear region or even oscillate). Unlike some old logic families (TTL basically), its fine to tie inputs directly to either supply rail.

(so I presume you are doing parallel-input, serial-output. Tie the serial input to ground.

yes im doing parallel input serial output so as such pin11 to ground