CHAPTER I
NUMBERS SYSTEMS & CODES
Chapter Outline
Introductory digital concepts
Numbers system
Numbers system conversion Binary arithmetic Digital Codes
Introductory Digital Concepts
Analogue
Analogue
System that deals with continuous varying quantities such as voltage, temperature, pressure, velocity.
Example of analogue concept and application
Mercury-filled tube thermometer A baseball player swing a bat in analogue motion Velocity force with which a musician strikes a piano key
Introductory Digital Concepts
Digital
Digital
System that deals with discrete digits or quantities. Digital electronics deals exclusively with 1s and 0s.
Example of digital concept and application
Compact disks (CD) Digital audio tapes (DATs) Digital watch
Introductory Digital Concepts
Comparison and Limitation
Analogue signal
Higher quality than digital if noise does not interfere
Digital signal
Immune to noise
Can also receive the information
Flexibility storage
Complexity of circuit design
Either 1s or 0s only
Expensive equipment and larger size
Easy to design
Cheaper equipment and smaller size
Chapter Outline
Introductory digital concepts
Numbers system
Numbers system conversion Binary arithmetic Digital Codes
Numbers System
Definition
There are four types of numbering system
Binary (base 2)
Octal (base 8) Decimal (base 10) Hexadecimal (base 16)
Introduction to Number System
Decimal
Ten different possible digits
Uses 0,1,2,3,4,5,6,7,8, and 9
Introduction to Number System
Binary
Two different possible digits
Uses only the digits 0 and 1
1 represent +5V 0 represent 0V
Introduction to Number System
Octal
Eight different possible digits
Uses 0,1,2,3,4,5,6 and 7
10
Introduction to Number System
Hexadecimal
Sixteen different possible digits
Uses 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F
11
Chapter Outline
Introductory digital concepts
Numbers system
Numbers system conversion Binary arithmetic Digital Codes
12
Numbers System Conversion
Decimal conversion to:
Binary Octal Hexadecimal
Binary conversion to:
Decimal Octal Hexadecimal
Octal conversion to:
Decimal Binary Hexadecimal
Hexadecimal conversion to:
Binary Decimal Octal
13
Decimal Conversion
Binary representation
Represent
Base
in binary
Remainder
14
Decimal Conversion
Octal representation
Represent
Base 8 8 8
in octal
Number 80 10 1 0 0 2 1 Remainder
15
Decimal Conversion
Hexadecimal representation
Represent
Base 16 16
in hexadecimal
Number 80 5 0 0 5 Remainder
16
Binary Conversion
Decimal representation
Convert
to decimal number
Method 1
Method 2 2
17
Binary Conversion
Octal representation
Convert
to octal number
Convert to decimal (previous answer : 11) Convert to octal
Base 8 8 Number 11 1 0 3 1 Remainder
18
Binary Conversion
Hexadecimal representation
Every four bit number in binary equal to one digit in hexadecimal Convert to hexadecimal number
BINARY 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010
HEXADECIMAL 0 1 2 3 4 5 6 7 8 9 A
1011
1100 1101 1110 1111
B
C D E F
19
Octal Conversion
Decimal representation
Convert
to decimal number
20
Octal Conversion
Binary representation
Convert
to binary number
Convert to decimal number (Previous answer:80) Convert to binary
Base Remainder
21
Octal Conversion
Hexadecimal representation
Convert
to hexadecimal number
Convert to decimal number (Previous answer:80) Convert to hexadecimal
Base
16 16
Number
80 5 0
Remainder
0 5
Another method?
Convert octal decimal binary hexadecimal So is equal to
22
Hexadecimal Conversion
Binary representation
Convert
Binary 0000 0001 0010 0011 0100 0101 0110
to binary number
Hexadecimal 0 1 2 3 4 5 6 Binary 1000 1001 1010 1011 1100 1101 1110 Hexadecimal 8 9 A B C D E
Refer to binary to hexadecimal table
0111
1111
23
Hexadecimal Conversion
Decimal representation
Convert
to decimal number
24
Hexadecimal Conversion
Octal representation
Convert
to octal number
Convert to decimal number(Previous answer: 90) Convert to octal
Base
8 8 8
Number
90 11 1 0
Remainder
2 3 1
25
Chapter Outline
Introductory digital concepts
Numbers system
Numbers system conversion Binary arithmetic Digital Codes
26
Binary Arithmetic
Basic arithmetic operation
Signed Number
1s Complement of binary number 2s Complement of binary number
27
Binary
Binary Arithmetic
As same as decimal number, binary number also can perform arithmetic operation
Addition Subtraction Multiplication Division
28
Binary
Addition
Basic addition
0+0=0 0+1=1 1+0=1 1 + 1 = 10
How about
1+1+1=?
29
Binary
Addition - Example
Add
and
30
Binary
Subtraction
Basic subtraction
00=0 10=1 11=0 10 0 = 10 10 1 = 1
31
Binary
Subtraction - Example
Subtract
and
32
Binary
Multiplication
Basic multiplication
1X1=1 1X0=0 0X1=0 0X0=0
33
Binary
Multiplication - Example
Multiply
and
34
Binary
Division
Basic division
11=1 0 1 = 0 remainder 1 11 1 = 11 11 11 = 1 11 10 = 1 remainder 1
35
Binary
Division - Example
Divide
and
36
Signed Number
Definition
Most Significant Bit (MSB) used as signed number 0 positive 1 negative
1 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1
37
1s Complement
Definition
Negative number can be present by inverting a positive number Example
1s complement of +3(0011) produce -3(1100)
38
1s Complement
Definition
So, we can present a set of negative number using 1s complement
Number 0 1 2 3 4 5 6 7 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1s Comp 1111 1110 1101 1100 1011 1010 1001 1000 Number 8 9 10 11 12 13 14 15 Binary 1000 1001 1010 1011 1100 1101 1110 1111 1s Comp 0111 0110 0101 0100 0011 0010 0001 0000
39
2s Complement
Definition
Add 1 with 1s complement number
Example
2s complement of +3(0011) produce -3(1101)
40
2s Complement
Example 1
Add
with
using 2s complement
41
2s Complement
Example 2
Add
with
using 2s complement
42
Chapter Outline
Introductory digital concepts
Numbers system
Numbers system conversion Binary arithmetic Digital Codes
43
Digital Codes
Binary Coded Decimal (BCD)
Gray code
ASCII Parity bits
44
Digital Codes
Binary Coded Decimal (BCD)
Translate binary number to decimal number
4-bit binary numbers (one digit) Represent from 0 to 9 in decimal
45
Digital Codes
Summary
Binary
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110
Decimal
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Octal
0 1 2 3 4 5 6 7 10 11 12 13 14 15 16
Hex
0 1 2 3 4 5 6 7 8 9 A B C D E
BCD
0 1 2 3 4 5 6 7 8 9 -
1111
15
17
46
Digital Codes
Gray Code
Reflected binary code
Widely used error correction in digital communication
How to get Gray Code?
Gray Code can be expressed by:
47
Digital Codes
Binary Gray Code
48
Digital Codes
Binary Gray Code
Convert 1001 into gray code
49
Digital Codes
Gray Code Binary
50
Digital Codes
Gray Code Binary
Convert 1101 into binary
51
Digital Codes
Gray Code - Table
DECIMAL 0 1 2 3 4 5 6 7 8
BINARY 0000 0001 0010 0011 0100 0101 0110 0111 1000
GRAY CODE 0000 0001 0011 0010 0110 0111 0101 0100 1100
9
10 11 12
1001
1010 1011 1100
1101
1111 1110 1010
52
Digital Codes
ASCII Code
ASCII American Standard Code for Information Interchange Computer understand numbers only ASCII code numerical representation of a character
53
Digital Codes
ASCII Code - Table
How to present a word UTeM using ASCII code?
U T e M
54
Digital Codes
Parity bits
A method for error detection
Types of parity bits
Even Odd
Count quantities of 1s for every data or information receive (even or odd)
Add extra bit (MSB) with 1s or 0s to perform parity bits selected types Transmitter Receiver (agreed)
55
Digital Codes
Parity bits
Represent a data 10101000001 for receiver part using even and odd parity bits.
56
57