0% found this document useful (0 votes)
31 views

Lecture#2 Hexadecimal Number System

This document discusses the hexadecimal number system and its uses. Hexadecimal represents numbers using a base-16 system with digits 0-9 and A-F. It is useful for representing binary numbers more concisely and is commonly used to display colors in HTML, MAC addresses, memory addresses, and when debugging computer programs.

Uploaded by

bethehero9000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Lecture#2 Hexadecimal Number System

This document discusses the hexadecimal number system and its uses. Hexadecimal represents numbers using a base-16 system with digits 0-9 and A-F. It is useful for representing binary numbers more concisely and is commonly used to display colors in HTML, MAC addresses, memory addresses, and when debugging computer programs.

Uploaded by

bethehero9000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 63

Lecture#2 Hexadecimal

Number system and it’s uses


Hexadecimal
• Hexadecimal is a Base 16 number system, meaning that increases in
powers of 16, with each digit being one of 16 different combinations.
Why do we use A to F instead of 11 to 15?
• We can’t use 11 to 15 because we wouldn’t know what number it
represented. The Digits 13 could be 13 or it could be 19 (1 * 16 + 3),
this is because denary numbers greater than 9 use 2 digits instead of
one digit.
Converting from binary to hexadecimal and
from hexadecimal to binary
Example#1: Convert 1 0 1 1 1 1 1 0 0 0 0 1
from binary to hexadecimal.
Example#2: Convert 1 0 0 0 0 1 1 1 1 1 1 1 0
1 from binary to hexadecimal.
Example:3 Convert this hexadecimal number to its binary
equivalent.
4 5 A
• find the 4-bit code for each digit:
Convert this hexadecimal number to its
binary equivalent. B F 0 8
Uses of Hexadecimal
• Hexadecimal is useful to us as a shorthand way of writing binary, and
makes it easier to work with long binary numbers.
• Why would we use the Hexadecimal system?
Hexadecimal is used for humans, it is easier to understand and write
• Name a use of the hexadecimal system?
Hexadecimal is used for error message codes and memory addresses
HTML Colors
• Html colors representation in hexadecimal
• What is HTML representation presentation
• Html Structure
Why use of hexadecimal in HTML colors?
• One digit takes 4bits.
• For example HTML webpage is able to show 17 millions colors
• 17 million colors can be represented using 24 bits. that is 2^24
• This means every single color that a html programmer wants to show
over screen will require to use 24bits
• Example: RED FF0000
• Blue 00FF00
• GREEN 0000FF
Mac address
• The device that enables your computer to get connected to the
internet
• Media access control card
• It is also known LAN card, NIC(Network interface card) or ethernet
card.
• This device represents every computer over a internet uniquely.
therefore its ID number or address must be unique
• It is held in 6Bytes.(6*8=482^48)
• E.g:C9:B3:A7:45:F1:AD
There are two types of MAC address
• UAA:universally adminintrated MAC add;given by the manufacture
• LAA:Locally adminintrated MAC add,given by the network
administrator.
Why use hexadecimal number to represent
MAC address?
• Since there are billion of MAC card around the globe and they need to
be identified uniquely, they must have numbers which are unique.
• So they become billion of numbers.it means every mac address have a
unique number which is in billions would be large number, so it could
use Hexadecimal number. Because it HD requires fewer digits to
represent any number
Assembly language and machine code
• Assembly language or machine code are low level language
• Assembly language make use of memory address
• These address are in billions
• To show these billions of addresses,assembly language use
Hexadecimal number instead of binary or decimal
• E.g:STO 007A5BF9(an address in HD which is in billion)
• When we convert this address in binary form:
0000 0000 0111 1010 0101 1011 1111 1001
Debugging
• Means finding and removing an error
• In case of system based programming, when microprocessor hangs,
programmers try to capture data in RAM to evaluate it later to
eradicate error from software to work smooth.
• The data in RAM(sometime called image) is captured in binary form
and it is in complex in nature to be understood easily.
• For this reason it is converted to hexadecimal form, called memory
dump.
Why do we use it hexadecimal?
• Given how confusing hexadecimal is you might be forgiven for wondering why we
bother using it at all. Well it has a couple of advantages:
• Large numbers can be represented in a smaller number of digits, making them easier
and more accurately read by humans.
• Binary is very difficult for humans to read (especially larger numbers) but computers
work in binary, so any usage where you need to be able to inspect and edit the binary
directly (such as in machine code/ assembly language) humans can work in
hexadecimal, which is close to the binary representation, but easier for us to read.
• The reason Hexadecimal works so well with binary is because of the similarity
between the number systems.
• binary base 2 –> 2 to the power of 4 is 16, so ever 4 binary digits are equal to one
hexadecimal digit. This makes conversion really easy!!!!

You might also like