0% found this document useful (0 votes)
37 views14 pages

Lab Micro-Processor, Micro-Controller and Interfacing:: Basic Part 2

The document discusses number systems and representations in computing. It covers binary, octal, decimal, and hexadecimal number systems. It also discusses signed and unsigned integer representations. Specifically, it explains two's complement representation for signed integers in binary. It provides examples of converting between different number bases like binary to decimal. It also gives examples of calculating two's complement and interpreting signed integers in two's complement notation.
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)
37 views14 pages

Lab Micro-Processor, Micro-Controller and Interfacing:: Basic Part 2

The document discusses number systems and representations in computing. It covers binary, octal, decimal, and hexadecimal number systems. It also discusses signed and unsigned integer representations. Specifically, it explains two's complement representation for signed integers in binary. It provides examples of converting between different number bases like binary to decimal. It also gives examples of calculating two's complement and interpreting signed integers in two's complement notation.
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/ 14

Lab Micro-processor, Micro-controller and

Interfacing:
Basic part 2

Book read
Assembly language programming Ytha Yu
Chapter 2 Representation of Numbers and Characters

Prepared by:
Nasif M. (Lecturer, Dept. of CSE, UIU.)

Department of Computer Science & Engineering (CSE), United International University (UIU).
Number System
• Consists of TWO Things:
– A BASE
– A SET of DIGITS
• Digits are symbols representing all values less than the
radix value.

• Example is the Common Decimal System:


– The radix or base is the number of unique digits.
– RADIX / BASE = 10
– Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

2
Department of Computer Science & Engineering (CSE), United International University (UIU).
Common Bases

• Binary
– Radix = (2)10
– Digit Set = {0, 1}

• Octal
– Radix = (8)10
– Digit Set = {0, 1, 2, 3, 4, 5, 6, 7}

• Hexadecimal
– Radix = (16)10
– Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}

3
Department of Computer Science & Engineering (CSE), United International University (UIU).
Binary to Decimal

4
Department of Computer Science & Engineering (CSE), United International University (UIU).
Decimal to Binary

4215 d = 1000001110111 b
5
Department of Computer Science & Engineering (CSE), United International University (UIU).
Class Work

• Binary to Hexadecimal
• Hexadecimal to Binary
• Decimal to Hexadecimal
• Hexadecimal to Decimal

• Addition and Subtraction of:


• Hexadecimal numbers

6
Department of Computer Science & Engineering (CSE), United International University (UIU).
Class Work (contd.)

Binary to/from Hexadecimal

7April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).
Unsigned Integer
• An 8 bit number system can be used to create 256
combinations (from 0 to 255)
Binary value Unsigned interpretation
00000000 0
00000001 1
⋮ ⋮
01111110 126
01111111 127
10000000 128
10000001 129
10000010 130
⋮ ⋮
11111110 254
11111111 255

8
Signed Integer
• In computing, signed number representations are required
to encode negative numbers in binary number systems.
Two's complement
Binary value interpretation in decimal
00000000 0
MSB 0 means positive 00000001 1
⋮ …..
MSB 1 means negative 01111110 126
01111111 127
10000000 −128
10000001 −127
10000010 −126
⋮ …….
11111110 -2
11111111 -1

9
Two's complement Unsigned interpretation in
Binary value (8 bit) interpretation in decimal decimal
00000000 0 0
00000001 1 1
⋮ ⋮ ⋮
01111110 126 126
01111111 127 127
10000000 −128 128
10000001 −127 129
10000010 −126 130
⋮ ⋮ ⋮
11111110 −2 254
11111111 −1 255

10
11
2's complement
• To calculate the 2's complement of an integer, invert the
binary equivalent of the number by changing all of the ones
to zeroes and all of the zeroes to ones (also called 1's
complement), and then add one.
• Unsigned
Binary (1000-0000) msb value is 1 so it is negative
NOT 111-1111
+1
------------------------
1000-0000 b
128 Decimal

12
• 16 bit unsigned number range (0 to 65535)

• 16 bit signed number range (-32768 to 32767)

13
Test Your Skill

• What is the maximum & minimum number that can be represented in an 8


bit binary number system? (For both signed and unsigned number).
• Convert the decimal 187 to 8 bit binary number.
• What is the two's complement of value 1110 0111?

April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).

You might also like