Uri_ba's pit

Quick tip – Binary to HEX and DEC conversion

I’ve been doing some work on the code, mostly involving i2c commands and addresses. Those are usually given in Hex in the datasheet, sometimes with binary reference, but you might find yourself needing to convert between the two and sometimes to Decimal.

There is a quick way to convert back and forth between all of them by hand with nothing but a piece of paper (you can do it in your head if you are good with numbers – I’m very bad at it :))

Anyway it’s a good old trick but it works.