Counting bits

hippy

Ex-Staff (retired)
Depends on the PICAXE ... There's the NOB ( number of bits ) unary function for PICAXE X2 ...

Let b1 = NOB b0

or, assuming the byte is in b0 ...

Let b1 = bit7+bit6+bit5+bit4+bit3+bit2+bit1+bit0
 
Top