so PCAOMD is a register on a micro processor. so usually they have an 8 bit register that you can turn a function on or off by binary code so if it was just PCA0MD = 0x40 that would be 01000000 so the seventh bit would be on, which in the actual case would not be correct the 7th bit needs to be off and i think some of the other bits on, so

&= is bitwise AND ? what does ~ mean? could you explain and show the results.