ilium007:
I am already doing the XOR comparison to see if the byte changed, how do I get the position that changed ? Do I just iterate through the byte and look for the 1's ?I will look at your other suggestion as well - thanks.
A bitRead to keep it simple, else a for-loop
for(int bitCnt=0;bitCnt<8;bitCnt++)
{
if((changeBits & (1 << bitCnt)) == (1 << bitCnt))
{
// bit is set
}
}
This is just sucked from the thumb and might contain errors. It masks all bits except for 1 (left hand side) and compares it against the bit that is set (right hand side).
You can also look how the bitRead() function is implemented to get ideas.