I'm having some problems testing bit 0 of a variable to see if it's a 1. Here's the snippet of the code:
if ((bWork && 0x01)==1) bTemp = bTemp|0x01; else bTemp = bTemp & 0xFE;
You are using a logical AND instead of a bitwise AND. The following code does what you want:
if ((bWork & 0x01)==1) bTemp = bTemp|0x01; else bTemp = bTemp & 0xFE;
bTemp ^= (bWork & 0x01);