I am working on a nixie clock. In 12 hour mode I want to blank the leading zero.

This code does not work:

if (hours & 0b00010000 == 0) // check to see if the hours = 10, 11, or 12

{

hoursOut = hours | leadzeroblank; //if it is not 10, 11, or 12 blank the leading zero

}

else

{

hoursOut = hours;

// Serial.println(hours,BIN);

}

and this code does work:

byte tens = hours & 0b00010000; // mask the least sig byte of the 10's data

if (tens == 0) // check to see if the hours = 10, 11, or 12

{

hoursOut = hours | leadzeroblank; //if it is not 10, 11, or 12 blank the leading zero

}

else

{

hoursOut = hours;

}

Anyone have any idea why the first set of code does not give me the desired result?

What I am trying to do is check for the MSB of my hours data being equal to 1 as in 10, 11, or 12 o'clock.

If it is not then I send a code to my nixie driver that it can not understand and it blanks the digit.

First code does not work and the second set does. There is something wrong with the IF statement.

and I do not know what is wrong.

Thanks in advance.

RWW