Just a reminder for myself how to convert HEX to DEC and maybe backwards in my head.

The original article is from stackoverflow, you can find it here though: http://stackoverflow.com/questions/910309/how-to-turn-hexadecimal-into-decimal-using-brain

So here it goes:

this is the equation I'm using in my head

0x15 = 5+(1*16) = 21

For the oposite I just do educated guess in my head

21, that means 16 goes in once so 0x1_

21-16 = 5 so 0x15

How about 4 byte HEX number?

Like this:

0xAB89

0xAB = 11+(10*16) = 171

171*256 = 43776

0x89 = 9+(8*16) = 137

43776+137 = 43913

How about 4 byte DEC to HEX?

38908

38908/256 = 151

151/16 = 9 = 0x9_

151%16 = 7 so upper bytes = 0x97

38908%256 = 252

252/16 = 15  = 0xF_

252%16 = 12 = 0xFC

So 38908 = 0x97FC

• #### Implementing pulse oximeter using MAX30100

Mar 8, 2017 | by Raivis Strogonovs
• #### nRF51 Makefile with Qt Creator

Jun 4, 2016 | by Raivis Strogonovs
• #### USART, FreeRTOS and C++ on nRF51

Dec 14, 2015 | by Raivis Strogonovs
• #### Starting with nRF51 BLE and Qt Creator

Dec 12, 2015 | by Raivis Strogonovs
• #### Touch gesture recognition using body capacitance

Nov 29, 2014 | by Raivis Strogonovs
• #### Introduction to data encryption

Oct 4, 2014 | by Raivis Strogonovs
• #### MEMS (Part 2) – Guide to using gyroscope L3G4200D

Jun 17, 2014 | by Raivis Strogonovs