Using the shiftIn() function

I have some older circuit boards that were designed to use a serial stream of data bits in and out for I/O (Originally part of an in-house designed control system). I have the output boards working with the shiftOut() function (allowing me to create 32 output channels with only 2 GPIO pins on the Uno), but I can't seem to get shiftIn() to read from the input cards. The best I can get is a one-time read that apparently inserts an extra bit at the beginning. Then it will not read anything until the Uno is reset.

The boards use a missing pulse detection on the clock pulse to detect a read/write cycle, so there is no enable or latch signal from the Uno necessary (or even a place to connect one).

I couldn't find any sample code for the shiftIn() function, so here is what I wrote:

int dataPin = 9;
int clockPin = 7;


void setup() {
  Serial.begin(9600);  // start serial
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, INPUT);
}

void loop()
{
  digitalWrite(clockPin, LOW);
  int temp = shiftIn(dataPin, clockPin, MSBFIRST);
  Serial.println(temp);
  delay(1000);
}

Any ideas if there is something I'm not doing right in the code? I would upload the circuit for the input board, but all I have is a paper copy (it was done with an ancient DOS version of OrCAD 20+ years ago - there isn't even a .pdf of this circuit). I can tell you the the shift register chips are 74HCT165 (chained for 16 inputs - I'm just trying to read the first 8 at this time).

BTW, I did find in the playground a program that used it's own shiftIn function, and I got a better read with it (no extra bits inserted), but it still read only once.

After some more trial and error, it appears that part of the problem is in my input board - it was designed to be daisy-chained with other boards, and for whatever reason it is not resetting. Unless I set the clock pin to an input and back to an output one millisecond later. Not sure what makes that work (magic?), but it does.

Also discovered that the circuit is sending the second bank of 8 channels first. Not sure why, but it was designed that way. And for some reason the first bit is AWOL. I get bits 0-6 of the second bank plus bit 7 of the first bank on the first read, then bits 6-0 of the second bank and a bit apparently from the ether on the second read.

Any ideas why I'm missing my bit 7 from the first read? It looks like there might be a phantom clock pulse before the shiftIn() actually reads the first bit.