C1 - Conversion of Decimal To hexadecimal-NTHai - 9-2020

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

HCMC University of Technology and Education

University of Technology
Number and
Systems
Faculty of Electrical & Electronics Engineering
Education
and Codes
Faculty of Electrical & Electronic Engineering

Lecture:
DIGITAL SYSTEMS
Chapter 1:
Number Systems and Codes

Assoc. Prof. Nguyen Thanh Hai


1
Assoc. Prof. Nguyen Thanh Hai
HCMC University of Technology and Education

Number Systems and Codes


Faculty of Electrical & Electronics Engineering

Basic Concepts

Bit: a binary digit composed of 0 or 1


Byte: composed of 8 bits
Word: composed of 4 bytes and equal to 32 bits

Base 2 (binary digits): numbers composed of bits

Base 10 (decimal digit): numbers composed of the digits from 0-9


Base 16 (hexa digit or hexadecimal): numbers composed of the
digits from 0-9 and letters A-F

Base 8 (octal digit): numbers composed of the digits from 0-7


2
Assoc. Prof. Nguyen Thanh Hai
HCMC University of Technology and Education

Number Systems and Codes


Faculty of Electrical & Electronics Engineering

Decimal to Hex Conversion


Convert number 145:
Similar to conversion of
145 LSD decimal to binary, the decimal
= 9 + remainder of 1
16 number is divided by 16
MSD (hexadecimal), we obtain a
9
= 0 + remainder of 9
16 quotient and a remainder of a
number (0-15) and then
continue to divide until a
quotient being smaller than
16, we stop and write down
14510 = 9 116
Octal code as example.
Notice: Hexadecimal code contains numbers (0-9) and letters
(A-F). However, in calculation, it means that 0-15, in which
A=10, B=11, C=12, D=13, E=14, F=15 3
Assoc. Prof. Nguyen Thanh Hai
HCMC University of Technology and Education

Number Systems and Codes


Faculty of Electrical & Electronics Engineering

Decimal to Hex Conversion


Convert number 423:

423 LSD Similar to conversion of


= 26 + remainder of 7
16 decimal to Hexadecimal
26 above, we obtain result as
= 1 + remainder of 10
16 example. However, remainder
1 MSD numbers from 10-15 will be
= 0 + remainder of 1
16 convert to letters (A-F) for
representation of
Hexadecimal codes as
example.
42310 = 1 A 716
4
Assoc. Prof. Nguyen Thanh Hai
HCMC University of Technology and Education

Number Systems and Codes


Faculty of Electrical & Electronics Engineering

The End

5
Assoc. Prof. Nguyen Thanh Hai

You might also like