Basic Digital - Systems
Basic Digital - Systems
By
X(t) X(t)
t t
Analog signal Digital signal
Binary Digital Signal
An information variable represented by physical quantity.
For digital systems, the variable takes on discrete values.
◆ Two level, or binary values are the most prevalent values.
Binary values are represented abstractly by:
◆ Digits 0 and 1
◆ Words (symbols) False (F) and True (T)
◆ Words (symbols) Low (L) and High (H) V(t)
◆ And words On and Off
Binary values are represented by values Logic 1
or ranges of values of physical quantities.
undefine
Logic 0
t
Binary digital signal
Decimal (Base 10) Number System
Base (also called radix) = 10
◆ 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
Digit Position
◆ Integer & fraction Position 2 1 0 -1 -2
Digit Weight
◆ Weight = (Base) Position
5 1 2 7 4
Magnitude Weight 100 10 1 0.1 0.01
◆ Sum of “Digit x Weight”
Formal Notation
Magnitude 500 10 2 0.7 0.04
d2*B2+d1*B1+d0*B0+d-1*B-1+d-2*B-2
(512.74)10
Octal (Base 8) Number System
Base = 8
◆ 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
Weights
◆ Weight = (Base) Position Weight 64 8 1 1/8 1/64
Magnitude 5 1 2 7 4
◆ Sum of “Digit x Weight” Position 2 1 0 -1 -2
Formal Notation
Magnitude 5 *82+1 *81+2 *80+7 *8-1+4 *8-2
=(330.9375)10
(512.74)8
Hexadecimal (Base 16) Number System
Base = 16
◆ 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
Weights
◆ Weight = (Base) Position 256 16 1 1/16 1/256
Magnitude 1 E 5 7 A
◆ Sum of “Digit x Weight”
2 1 0 -1 -2
Formal Notation
1 *162+14 *161+5 *160+7 *16-1+10 *16-2
=(485.4765625)10
(1E5.7A)16
Binary (Base 2) Number System
Base = 2
◆ 2 digits { 0, 1 }, called binary digits or “bits”
Weights
Position Weight 4 2 1 1/2 1/4
◆ Weight = (Base)
Magnitude 1 0 1 0 1
◆ Sum of “Bit x Weight” Position 2 1 0 -1 -2
Formal Notation 1 *22+0 *21+1 *20+0 *2-1+1 *2-2
Groups of bits =(5.25)10
Summary
(101.01)2
➢ Bit: 1 binary digit (0 or 1)
➢ Nibble: 4 bits 1011
➢ Byte: 8 bits 11000101
➢ Word: Typically 16, 32, or 64 bits (depends on architecture)
Convert binary to decimal
Binary 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 ? ? ? ?
Convert binary to decimal
Example 1: Convert the binary number 10101110 to decimal.
Solution:
Given binary number is 10101110 (110101110) = 430
Using the conversion formula,
10101110 = (1 × 2 7 ) + (0 × 2 6 ) + (1 × 2 5 ) + (0 × 2 4 ) + (1 × 2 3 ) + (1 ×
2 2 ) + (1 × 2 1 ) + (0 × 2 0 )
= 128 + 0 + 32 + 0 + 8 + 4 + 2 + 0
= 174
Solution:
Given binary number is 11010111
Using the conversion formula,
11010111 = (1 × 2 7 ) + (1 × 2 6 ) + (0 × 2 5 ) + (1 × 2 4 ) + (0 × 2 3 ) +
(1 × 2 2 ) + (1 × 2 1 ) + (1 × 2 0 )
= 128 + 64 + 0 + 16 + 0 + 4 + 2 + 1
= 215
2. Nibble
•Definition: A nibble consists of 4 bits.
•Usage: It is often used in computing to represent a single hexadecimal digit, as each
hexadecimal digit corresponds to 4 bits.
3. Byte
•Definition: A byte is a unit of digital information that typically consists of 8 bits.
•Usage: Bytes are commonly used to encode a single character of text in computer systems (e.g.,
ASCII). They are also the standard unit for measuring data storage (e.g., kilobytes, megabytes).
4. Word
•Definition: A word is a unit of data that is typically defined by the architecture of a computer's
CPU. The size of a word can vary, commonly being 16 bits, 32 bits, or 64 bits, depending on the
system.
•Usage: Words are used as the standard data size for processing in a computer's CPU, affecting
how data is handled in memory and how instructions are executed.
The Power of Base 2
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024 Kilo
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M Mega
4 Nybble / Nibble
1 1 Carry
5 5
+ 5 5
1 1 0
Binary Addition
Binary Addition
1 + 1 = 10
1 + 1 + 1 = 11
10 – 1 = 1
11 – 1 = 10
Example 1
Binary Addition
Answers:
Binary Subtraction
Binary Subtraction Table
The subtraction of binary numbers is given by:
0–0 0
1–0 1
1–1 0
Binary Subtraction Key
1 + 1 = 10
1 + 1 + 1 = 11
10 – 1 = 1
11 – 1 = 10
Example 2
Binary Subtraction
(b) 110 – 11
Answers:
Binary Addition
**Reminder: 1 + 1 = 10**
Questions
1. 101 + 11 =
2. 111 + 111 =
3. 1010 + 1010 =
4. 11101 + 1010 =
5. 11111 + 11111 =
Answers for Exercises
Subtraction Exercises
Question 2
Calculate the binary numbers:
(a) 11 – 10
(b) 110 – 10
(c) 1111 – 110
(d) 100 – 10
(e) 100 – 11
(f) 1000 – 11
(g) 1101 – 110
(h) 11011 – 110
(i) 1111 – 111
(j) 110101 – 1010
(k) 11011 – 111
(l) 11110 – 111
Answers for Exercises
Answers for Question 2
Subtraction Exercises
Binary Subtraction
**Reminder: 10 - 1 = 1**
Questions
6. 110 - 10 =
7. 101 - 11 =
8. 1001 - 11 =
9. 1101 - 11 =
10. 10001 - 100 =
Answers for Exercises
Binary Subtraction
Binary Multiplication
Bit by bit
1 0 1 1 1
x 1 0 1 0
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
1 1 1 0 0 1 1 0
Binary Multiplication Exercises
Bit by bit
Binary Multiplication
**Hint: very similar to decimal multiplication**
Questions
11. 10 x 10 =
12. 100 x 11 =
13. 101 x 10 =
14. 1011 x 11 =
15. 11011 x 101 =
Answers
Bit by bit
Binary Division Rules
Bit divided by bit
The binary division is much easier than the decimal division
when you remember the following division rules.
The main rules of the binary division include:
•1÷1 = 1
•1÷0 = Meaningless
•0÷1 = 0
•0÷0 = Meaningless
Binary Division Examples
Example 1: Solve using the long division method: 101101 ÷ 101
Solution:
Evaluate
Magnitude
Decimal Binary
(Base 10) (Base 2)
Hexadecimal
(Base 16)
Evaluate
Magnitude
Decimal (Integer) to Binary Conversion
Example: (13)10
Quotient Remainder Coefficient
13/ 2 = 6 1 a0 = 1
6 /2= 3 0 a1 = 0
3 /2= 1 1 a2 = 1
1 /2= 0 1 a3 = 1
Answer: (13)10 = (a3 a2 a1 a0)2 = (1101)2
MSB LSB
Decimal (Fraction) to Binary Conversion
Example: (0.625)10
Integer Fraction Coefficient
0.625 * 2 = 1 . 25 a-1 = 1
0.25 * 2 = 0 . 5 a-2 = 0
0.5 *2= 1 . 0 a-3 = 1
Answer: (0.625)10 = (0.a-1 a-2 a-3)2 = (0.101)2
MSB LSB
Decimal to Octal Conversion
Example: (175)10
Quotient Remainder Coefficient
175 / 8 = 21 7 a0 = 7
21 / 8 = 2 5 a1 = 5
2 /8= 0 2 a2 = 2
Answer: (175)10 = (a2 a1 a0)8 = (257)8
Example: (0.3125)10
Integer Fraction Coefficient
0.3125 * 8 = 2 . 5 a-1 = 2
0.5 *8= 4 . 0 a-2 = 4
Answer: (0.3125)10 = (0.a-1 a-2 a-3)8 = (0.24)8
Binary − Octal Conversion
8 = 23
Octal Binary
Each group of 3 bits represents an octal digit
0 000
1 001
2 010
Assume Zeros
Example: 3 011
( 1 0 1 1 0 . 0 1 )2 4 100
5 101
6 110
( 2 6 . 2 )8 7 111
( 1 0 1 1 0 . 0 1 )2 8 1000
9 1001
A 1010
B 1011
C 1100
(1 6 . 4 )16 D 1101
E 1110
F 1111
Works both ways (Binary to Hex & Hex to Binary)
Octal − Hexadecimal Conversion
Convert to Binary as an intermediate step
Example:
( 2 6 . 2 )8
( 0 1 0 1 1 0 . 0 1 0 )2
(1 6 . 4 )16
AND OR NOT
x y z x y z x z
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
z=x•y=xy z=x+y z = x = x’
x x x
y z y z z
Examples for Switching Circuits
AND OR
From Boolean Algebra to Ladder Diagram
From Boolean Algebra to Ladder Diagram
Binary Logic
Logic gates
◆ Example of binary signals
3
Logic 1
2
Un-define
1
Logic 0
0
Logic gates
◆ Graphic Symbols and Input-Output Signals for Logic gates:
Logic gates
◆ Graphic Symbols and Input-Output Signals for Logic gates:
Bit LSB
MSB
1 0 1 1 1 0 0 1 1 0 1 0 1 0 1 1
(a) ?
(b) ?
(c) ?