You're on the right track. And it's easy to get those bits out. Here's how:
16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
1 1 1
The top line is the bit position and the bottom line is the value 7...let's say you're interest in bit 2, the third from the right. Let's make a bit mask for that bit by taking a 1 and shifting it over n times, where n is the bit position. So we want to shift it 2 times:
int mask = (1 << 2);
This will yield:
16 15 14 13 12 11 10 09 09 07 06 05 04 03 02 01 00
1 0 0
Now all we do to determine if bit two is set is to AND the value and the mask
16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
1 1 1 value
1 0 0 mask
--------------------------------------------------
1 0 0 ANDed result
So, in C:
int value = 7; // or any 16-bit value
int mask = (1 << 2); // == 4
if ((value & (1 << 2)) == mask)
// bit is set
else
// bit is not set
Now, sometimes you want to extract more than one bit. Here's an example of how to extract a two-bit combination. First let's stipulate that two bits 11 is the value 3 (one 1 and one 2). So now w're going to do a similar process to extract two bits from the same value (7).
16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
Now we mask with a 3 instead of a 1:
int mask = (3 << 2);
This will yield:
16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
Now all we do to determine if bit two is set is to AND the value and the mask
16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 value
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 mask
--------------------------------------------------
0 1 0 0 ANDed result
But the documentation might say something like bits:3-2 is "status x." values -
00 - a
01 - b
02 - c
03 - d
So now we have to take our final value, 0100 from the ANDed result above, and shift it two to the right to get these possible values:
result = (old_result >> 2);
0100 >> 2 == 01
Since the result is 01, decimal 1, hexadecimal 1, then the result is b from above.
EDIT:
Now the final calculations in python:
>>> value = 0x0007
>>> mask = (3 << 2)
>>> result = value & mask
>>> print (result)
4
>>> shifted_result = result >> 2
>>> print (shifted_result)
1
Same result, bits 3-2 are equal to 1, which means (based on your datasheet) that the diagnostic result is:
bit 0: "running"
bit 1: "fault"
bit 3-2: "float"