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

CHP 1 NUMBER SYSTEM (UUM) PDF

The document discusses various number systems including binary, decimal, octal and hexadecimal. It covers number conversion between these systems as well as simple arithmetic operations. Binary coded decimal, ASCII, Gray code and seven segment codes are also introduced. The next chapter will cover logic gates and Boolean algebra.

Uploaded by

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

CHP 1 NUMBER SYSTEM (UUM) PDF

The document discusses various number systems including binary, decimal, octal and hexadecimal. It covers number conversion between these systems as well as simple arithmetic operations. Binary coded decimal, ASCII, Gray code and seven segment codes are also introduced. The next chapter will cover logic gates and Boolean algebra.

Uploaded by

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

EKT 121/4

ELEKTRONIK DIGIT 1
Kolej Universiti
Kejuruteraan Utara Malaysia

Chapter 2 :
Number Systems, Operations
and Codes
Number Systems & Codes
„ Introduction to number systems
„ Decimal
„ Binary

„ Octal

„ Hexadecimal

„ Number Conversion
„ Simple Arithmetic
„ Binary Codes
Number Systems

„ Decimal ¾ 0~9

„ Binary ¾ 0~1

„ Octal ¾ 0~7

„ Hexadecimal ¾ 0~F
Dec Hex Octal Binary
N
0 0 000 00000000
U
1 1 001 00000001
M 2 2 002 00000010
B 3 3 003 00000011
E 4 4 004 00000100
R 5 5 005 00000101
6 6 006 00000110
7 7 007 00000111
S 8 8 010 00001000
Y 9 9 011 00001001
S 10 A 012 00001010
T 11 B 013 00001011
E 12 C 014 00001100
M 13 D 015 00001101
14 E 016 00001110
S 15 F 017 00001111
Number Conversion
„ Introduction to bit and byte
„ Introduction to LSB (Least Significant Bit)
& MSB (Most Significant Bit)
„ Any Radix (base) to Decimal Conversion
Number Conversion
„ Binary to Decimal Conversion
Number Conversion
„ Binary to Decimal Conversion
™Example:
Convert binary 1011.10102 to decimal.
1011.10102 = (1) 23 + (1) 21 + (1) 20 + (1) 2-1 +(1)2-3
= 11.62510
Number Conversion
„ Decimal to Any Radix (Base) Conversion
1. INTEGER DIGIT:
Repeated division by the radix &
record the remainder
2. FRACTIONAL DECIMAL:
Multiply the number by the radix
until the answer is in integer
Example:
25.3125 to Binary
Integer Digit
Remainder
2 5 = 12 + 1
2
12 = 6 + 0
2
6 = 3 + 0
2
3 = 1 + 1
2
1 = 0 + 1
2 MSB LSB
2510 = 1 1 0 0 1 2
Integer Digit
MSB LSB
Carry .0 1 0 1
0.3125 x 2 = 0.625 0

0.625 x 2 = 1.25 1

0.25 x 2 = 0.50 0

0.5 x 2 = 1.00 1

The Answer : 1 1 0 0 1.0 1 0 1


Number Conversion
„ Binary to Octal Conversion (vice versa)
1. Grouping the binary position in groups
of three starting at the least significant
position.
™ Example:
„ Convert the following binary numbers to their
octal equivalent (vice versa).
a) 1001.11112 b) 47.38
c) 1010011.110112

„ Answer:

a) 11.748 b) 100111.0112
c) 123.668
Number Conversion
„ Binary to Hexadecimal Conversion (vice
versa)
1. Grouping the binary position in 4-bit
groups, starting from the least
significant position.
™ Example:
„ Convert the following binary numbers to
their hexadecimal equivalent (vice versa).
a) 10000.12
b) 1F.C16
„ Answer:
a) 10.816
b) 00011111.11002
Simple Arithmetic
„ Addition
™ Example: ™ Example:
100011002 5816
+ 1011102 + 2416
101110102 7C16

„ Substraction
™ Example:
10001002
- 1011102
101102
Binary Addition
0 + 0 = 0 Sum of 0 with a carry of 0
0 + 1 = 1 Sum of 1 with a carry of 0
1 + 0 = 1 Sum of 1 with a carry of 0
1 + 1 = 10 Sum of 1 with a carry of 1
Example:
11001 111
+ 1101 + 11
100110 ???
Binary Subtraction
0-0=0
1-1=0
1-0=1
10 -1 = 1 0 -1 with a borrow of 1
Example:
1011 101
- 111 - 11
100 ???
Binary Multiplication
0X0=0
0X1=0 Example:
1X0=0 100110
1X1=1 X 101
100110
000000
+ 100110
10111110
Binary Division
Use the same procedure as decimal division
Binary Multiplication
Example1 : 11112 1510
1 11112 1510
10
1111
11 22510
11
1111
10
1111
Verify !!!
1111
128+64+32+1 = 225
111000012
Binary Multiplication
Example2 : 11112 1510
11012 1310
1
1111
10 19510
10
0000
10
1111
Verify !!!
1111
128+64+2+1 = 19510
110000112
1’s complements of binary numbers
„ Changing all the 1s to 0s and all the 0s to
1s

Example:
110100101 Binary number

001011010 1’s complement


2’s complements of binary numbers

„ By adding 1 to the LSB of the 1’s complement


„ 2’s complement = (1’s complement) + 1

Example:

110100110 Binary number


001011001 1’s complement
+ 1 Add 1
001011010 2’s complement
Alternative method:
„ Start from right (LSB), write all bits until
you find the first bit 1 and then continue
the remaining bits with 1’s complement.

Example: 1st bit 1

110100110 Binary number

You write the 1ST 2


bits from LSB

001011010 2’s complement

1st complement for


the remaining bits
Signed numbers
„ Left most is the sign bit
„ 0 is for positive, and 1 is for negative
„ Sign-magnitude
„ 00011001 = +25
sign bit magnitude bits

„ 1’s complement
„ The negative number is the 1’s complement
of the corresponding positive number
„ Example:

+25 is 00011001 -25 is 11100110


Signed numbers
„ 2’s complement
„ The positive number – same as sign
magnitude and 1’s complement
„ The negative number is the 2’s complement
of the corresponding positive number.
Example:
Express +19 and -19 in
i. sign magnitude
ii. 1’s complement
iii. 2’s complement
Arithmetic Operation With
Signed numbers

„ Addition
„ Subtraction
Find out !!!!
„ Multiplication
„ Division
Digital Codes
„ BCD (Binary Coded Decimal) Code
1. Represent each of the 10 decimal
digits (0~9) as a 4-bit binary code.
™ Example:
„ Convert 15 to BCD.

1 5
0001 0101BCD
„ Convert 10 to binary and BCD.
Digital Codes
„ ASCII (American Standard Code for
Information Interchange) Code
1. Used to translate from the keyboard
characters to computer language
Digital Codes
„ The Gray Code Decimal Binary Gray
„ Only 1 bit changes Code
„ Can’t be used in 0 0000 0000
arithmetic circuits
1 0001 0001
„ Binary to Gray Code
and vice versa. 2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
Digital Codes
„ Seven Segment Code

Arrangements of 7 segment LED display


Binary Codes – Assignment 1

„ Assignment
„ Excess – 3 (XS-3)
„ Parity in Codes
„ Gray Code
„ Due: 25 November 2003
Next Week

Logic Gates
&
Algebra Boolean

- Thank you -

You might also like