Hexadecimal tutorial

Indroduction

Hexadecimal – also known as hex or base 16 – is a system we can use to write and share numerical values. In that way it’s no different than the most famous of numeral systems (the one we use every day): decimal. Decimal is a base 10 number system (perfect for beings with 10 fingers), and it uses a collection of 10 unique digits, which can be combined to positionally represent numbers.

Hex, like decimal, combines a set of digits to create large numbers. It just so happens that hex uses a set of 16 unique digits. Hex uses the standard 0-9, but it also incorporates six digits you wouldn’t usually expect to see creating numbers: A, B, C, D, E, and F.

 

NOTE:

we have 4 BASE of the number system, below the descriptions:

hexadecimal: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F (base 16)

binary: 0,1 (base 2)

decimal: 0,1,2,3,4,5,6,7,8,9 (base 10)

octal: 0,1,2,3,4,5,6,7 (base 8)

below from bit to the qword:

1= 1bit

0000 0000 = 1 byte  (max decimal = 255, hex = FF)

0000 0000 0000 0000 = 1 word  (max decimal =  65535, hex = FFFF)

0000 0000 0000 0000 0000 0000 0000 0000 = double word  (max decimal = 4294967295, max hex =  FFFFFFFF)

0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 = Q word (max hex = FFFFFFFFFFFFFFFF)

Bit 0/1 (yes/no)

Byte 00010010 (8 bit)

Kilobyte 210 = 1024 byte

Megabyte 220 ~ 1.000.000 byte

Gigabyte 230 ~ 1.000.000.000 byte

 

The windows calculator is already with the conversion with hex,dec or binary.

See photo below:

 

first step:

open windows calculator

calculator


second step:

select programmer

calculator1

 

third step

will open the calculator below:

calculator2

 

Hexadecimal Number System

 Following are the characteristics of a hexadecimal number system.

  • Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
  • Letters represents numbers starting from 10. "A = 10, B = 11, C = 12, D = 13, E = 14, F = 15".
  • Also called base 16 number system.
  • Each position in a hexadecimal number represents a 0 power of the base (16). Example − 160
  • Last position in a hexadecimal number represents an x power of the base (16). Example − 16x where x represents the last position - 1.

 

Example

Hexadecimal Number − 19FDE16

Calculating Decimal Equivalent :

 

Step Hexadecimal Number Decimal Number
Step 1 19FDE16 ((1 × 164) + (9 × 163) + (F × 162) + (D × 161) + (E × 160))10
Step 2 19FDE16 ((1 × 164) + (9 × 163) + (15 × 162) + (13 × 161) + (14 × 160))10
Step 3 19FDE16 (65536 + 36864 + 3840 + 208 + 14)10
Step 4 19FDE16 10646210

 Note − 19FDE16 is normally written as 19FDE.

 

Hexadecimal Addition

Following hexadecimal addition table will help you greatly to handle Hexadecimal addition.

hexadecimal addition table

 

To use this table, simply follow the directions used in this example − Add A16 and 516. Locate A in the X column then locate the 5 in the Y column. The point in 'sum' area where these two columns intersect is the sum of two numbers.

A16 + 516 = F16.


Example − Addition

hexadecimal addition example

 

Hexadecimal Subtraction

The subtraction of hexadecimal numbers follow the same rules as the subtraction of numbers in any other number system. The only variation is in borrowed number. In the decimal system, you borrow a group of 1010. In the binary system, you borrow a group of 210. In the hexadecimal system you borrow a group of 1610.

Example - Subtraction

hexadecmal substraction example

 

Hex Identifiers

The table below the characters identifier that are used:

 

Identifier Example Notes
0x 0x47DE This prefix shows up a lot in UNIX and C-based programming languages (like Arduino!).
# #FF7734 Color references in HTML and image editting programs.
% %20 Often used in URLs to express characters like "Space" (%20).
\x \x0A Often used to express character control codes like "Backspace" (\x08), "Escape" (\x1B), and "Line Feed" (\x0A).
&#x &#x3A9 Used in HTML, XML, and XHTML to express unicode characters (e.g. Ω prints an Ω).
0h 0h5E A prefix used by many programmable graphic calculators (e.g. TI-89).
Numeral/Text Subscript BE3716, 13Fhex This is more of a mathematical represenatation of base 16 numbers. Decimal numbers can be represented with a subscript 10 (base 10). Binary is base 2.

There are a variety of other prefixes and suffixes that are specific to certain programming languages. Assembly languagues, for example, might use an “H” or “h” suffix (e.g. 7Fh) or a “$” prefix ($6AD). Consult examples if you’re not sure which prefix or suffix to use with your programming language.

The “0x” prefix is one you’ll see a lot, especially if you’re doing any microchip programming. We’ll use that from now on in this tutorial (I prefare the microchip),

In summary: DECAF? A horrible abomination of coffee. 0xDECAF? A perfectly acceptable, 5-digit hexadecimal number.

 

www.bennypass.it

favicon bacd

+(39) 347 051 5328

Italy - Kazakhstan

09.00am to 18.00pm

About

We offer the best and economical solutions, backed by 27+ years of experience and international standards knowledge, echnological changes, and industrial systems.

Marketing Materials

Spring Renovation
Industry
US Gas Company
Construct
Plus Project
Vam Drilling Service
X Project
X Project
Cabrrus Training

Marketing Materials1

Spring Renovation
Industry
US Gas Company
Construct
Plus Project
Vam Drilling Service
ultrasonic sensor
ultrasonic sensor
Cabrrus Training