## Convert HEX to DEC in your head

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
• #### Proact IMS in Strain Gauge based weight sensor (load cell)

"Great post! I’m curious about how versatile these transducers are. Can they measure other environmental factors besides...

#### Proact IMS in Strain Gauge based weight sensor (load cell)

"Great post! I’m curious about how versatile these transducers are. Can they measure other environmental factors besides...

#### Proact IMS in Strain Gauge based weight sensor (load cell)

"Great post! I’m curious about how versatile these transducers are. Can they measure other environmental factors besides temperature,...

#### Proact IMS in Strain Gauge based weight sensor (load cell)

"Great post! I’m curious about how versatile these transducers are. Can they measure other environmental factors besides temperature,...

#### Proact IMS in Strain Gauge based weight sensor (load cell)

"As a mechanical engineer specializing in aerospace applications, I'm keen to understand how strain gauges are integrated into aircraft...

#### Proact IMS in Strain Gauge based weight sensor (load cell)

Discuss how load cells can be integrated into various agricultural equipment such as harvesters, tractors, and plows to optimize performance and ensure...

#### Mike Johns in Simple library for driving 20x4 LCD with 4bits

Solved, It looks like itoa is the esaiest solution. Works well, and then using lcd.lcdWriteText(&cstr[i]); Once again thanks for your effort. cheers Mike