From your code I deduce that you are receiving a 16-bit word in the following bit order: 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8. Here is how to read all the bits into a 16-bit unsigned integer:
// Start Reading Byte 0
uint16_t recValLo = 0;
pinMode(lancPin, INPUT);
delayMicroseconds(bitDuration/2);
for (int i=0; i < 8; i++) {
recValLo <<= 1;
if (digitalRead(lancPin) == HIGH)
{
recValLo |= 1;
}
delayMicroseconds(bitDuration);
}
// Start Reading Byte 1
uint16_t recValHi = 0;
pinMode(lancPin, INPUT);
delayMicroseconds(bitDuration/2);
for (int i=0; i < 8; i++) {
recValHi <<= 1;
if (digitalRead(lancPin) == HIGH)
{
recValHi |= 1;
}
delayMicroseconds(bitDuration);
}
uint8_t recVal = (recValHi << 8) | recValLo;
The 2 loops are identical apart from the variables they use, so you should consider writing a function and calling it twice.