1.37k likes | 1.61k Views
CHAPTER 1 : INTRODUCTION. EKT 121 / 4 ELEKTRONIK DIGIT 1. Lecturer : FAIRUL AFZAL Office : KKF 8 ( 04-9854150) Email :fairul@unimap.edu.my. Digital vs. analog quantities Decimal numbering system (Base 10) Binary numbering system (Base 2)
E N D
CHAPTER 1 : INTRODUCTION EKT 121 / 4ELEKTRONIK DIGIT 1 Lecturer : FAIRUL AFZAL Office : KKF 8 (04-9854150) Email :fairul@unimap.edu.my
Digital vs. analog quantities • Decimal numbering system (Base 10) • Binary numbering system (Base 2) • Hexadecimal numbering system (Base 16) • Octal numbering system (Base 8) • Number conversion • Binary arithmetic • 1’s and 2’s complements of binary numbers 1.0 Number & codes
Signed numbers • Arithmetic operations with signed numbers • Binary-Coded-Decimal (BCD) • ASCII codes • Gray codes • Digital codes & parity Number & codes
Digital vs. Analogue • Digital signals are represented by only two possible - • 1 (binary 1) 0r 0 (binary 0) • Sometimes call these values “high” and “low” or “ true” and “false”” • Example : light switch , it can be in just two position – “ on ” or “ off ” • More complicated signals can be constructed from 1s and 0s by stringing them end-to end. Example : 3 binary digits, have 8 possible combinations : • 000,001,010,011,100,101,110 and 111. • The diagram : example a typical digital signal, represented as a series of voltage levels that change as time goes on.
Digital vs. Analogue • Analogue electronics can be any value within limits. • Example : Voltage change simultaneously from one value to the next, like gradually turning a light dimmer switch up or down. • The diagram below shows an analoq signal that changes with time.
Why digital ? • Problem with all signals – noise • Noise isn't just something that you can hear - the fuzz that appears on old video recordings also qualifies as noise. In general, noise is any unwanted change to a signal that tends to corrupt it. • Digital and analogue signals with added noise: Digital vs. Analogue Analog : never get back a perfect copy of the original signal Digital : easily be recognized even among all that noise : either 0 or 1
Two ways of representing the numerical values of quantities : i) Analog (continuous) ii) Digital (discrete) Analog : a quantity represented by voltage, current or meter movement that is proportional to the value that quantity • Digital : the quantities are represented not by proportional quantities but by symbols called digits Digital and analog quantities
Digital system: • combination of devices designed to manipulate logical information or physical quantities that are represented in digital forms • Example : digital computers and calculators, digital audio/video equipments, telephone system. • Analog system: • contains devices manipulate physical quantities that are represented in analog form • Example : audio amplifiers, magnetic tape recording and playback equipment, and simple light dimmer switch Digital and analog systems
Analog Quantities • Continuous values
We are all familiar with decimal number systems - use everyday :calculator, calendar, phone or any common devices use this numbering system : Decimal = Base 10 • Some other number systems: • Binary = Base 2 • Octal = Base 8 • Hexadecimal = Base 16 Introduction to Numbering Systems
0 ~ 9 • 0 ~ 1 • 0 ~ 7 • 0 ~ F Numbering Systems • Decimal • Binary • Octal • Hexadecimal
Dec Hex Octal Binary 0123456789101112131415 0123456789ABCDEF 000001002003004005006007010011012013014015016017 00000000000000010000001000000011000001000000010100000110000001110000100000001001000010100000101100001100000011010000111000001111 N U M B E R S Y S T E M S
Binary: 11101101 Most significant digit Least significant digit Hexadecimal: 1D63A7A Most significant digit Least significant digit Significant Digits
Base 10 - (0,1,2,3,4,5,6,7,8,9) • Example : 39710 3 9 7 Decimal numbering system (Base 10) Weights for whole numbers are positive power of ten that increase from right to left , beginning with 100 + 7 X 100 3 X 102 9 X 101 + = 300 + 90 + 7 39710 =
Base 2 system – (0 , 1) • used to model the series of electrical signals computers use to represent information • 0 represents the no voltage or an off state • 1 represents the presence of voltage or an on state • Example : 1012 1 0 1 Binary Number System Weights in a binary number are based on power of two, that increase from right to right to left,beginning with 20 + 0 X 21 + 1 X 20 1X 22 = 4 + 0 + 1 = 510
Base 8 system – (0,1,2,3,4,5,6,7) • multiplication and division algorithms for conversion to and from base 10 • Example : 7568 convert to decimal: 7 5 6 Octal Number System Weights in a binary number are based on power of eight that increase from right to right to left,beginning with 80 + 7X 82 5 X 81 + 6 X 80 = 448 + 40 + 6 49410 = • Readily converts to binary • Groups of three (binary) digits can be used to represent each octal number • Example : 7568 convert to binary : • 7 5 68 1111011102
Base 16 system • Uses digits 0 ~ 9 & letters A,B,C,D,E,F • Groups of four bitsrepresent eachbase 16 digit Hexadecimal Number System
Base 16 system – • multiplication and division algorithms for conversion to and from base 10 • Example : A9F16 convert to decimal: A 9 F Hexadecimal Number System Weights in a hexadecimal number are based on power of sixteen that increase from right to right to left,beginning with 160 10X 162 9 X 161 + 15 X 160 + = 2560 + 144 + 15 271910 = • Readily converts to binary • Groups of four (binary) digits can be used to represent each hexadecimal number • Example : A9F8 convert to binary : • A 9 F16 1010100111112
Number Conversion • Any Radix (base) to Decimal Conversion
Number Conversion (BASE 2 –BASE 10) • Binary to Decimal Conversion
Convert (10101101)2 to its decimal equivalent: Binary 1 0 1 0 1 1 0 1 Positional Values Binary to Decimal Conversion x x x x x x x x 27 26 25 24 23 22 21 20 128 + 32 + 8 + 4 + 1 Products 17310
Convert 6538 to its decimal equivalent: Octal to Decimal Conversion Octal Digits 6 5 3 x x x Positional Values 82 81 80 Products 384 + 40 + 3 42710
Convert 3B4F16 to its decimal equivalent: Hex Digits Hexadecimal to Decimal Conversion 3 B 4 F x x x x Positional Values 163 162 161 160 12288 +2816 +64 +15 Products 15,18310
Number Conversion • Decimal to Any Radix (Base) Conversion • INTEGER DIGIT: Repeated division by the radix & record the remainder • FRACTIONAL DECIMAL: Multiply the number by the radix until the answer is in integer Example: 25.3125 to Binary
Decimal to Binary Conversion Remainder 2 5 = 12 + 1 2 1 2 = 6 + 0 2 6 = 3 + 0 2 3 = 1 + 1 2 1 = 0 + 1 2 MSB LSB 2510 = 1 1 0 0 1 2
Decimal to Binary Conversion 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
Convert 42710 to its octal equivalent: 427 / 8 = 53 R3 Divide by 8; R is LSD 53 / 8 = 6 R5 Divide Q by 8; R is next digit 6 / 8 = 0 R6 Repeat until Q = 0 Decimal to Octal Conversion 6538
Convert 83010 to its hexadecimal equivalent: 830 / 16 = 51 R14 51 / 16 = 3 R3 3 / 16 = 0 R3 Decimal to Hexadecimal Conversion = E in Hex 33E16
Number Conversion • Binary to Octal Conversion (vice versa) • Grouping the binary position in groups of three starting at the least significant position.
Each octal number converts to 3 binary digits Octal to Binary Conversion To convert 6538 to binary, just substitute code: 6 5 3 110 101 011
Number Conversion • Example: • Convert the following binary numbers to their octal equivalent (vice versa). • 1001.11112 b) 47.38 • 1010011.110112 • Answer: • 11.748 • 100111.0112 • 123.668
Number Conversion • Binary to Hexadecimal Conversion (vice versa) • Grouping the binary position in 4-bit groups, starting from the least significant position.
The easiest method for converting binary to hexadecimal is to use a substitution code Each hex number converts to 4 binary digits Binary to Hexadecimal Conversion
Number Conversion • Example: • Convert the following binary numbers to their hexadecimal equivalent (vice versa). • 10000.12 • 1F.C16 • Answer: • 10.816 • 00011111.11002
Convert 0101011010101110011010102 to hex using the 4-bit substitution code : 0101 0110 1010 1110 0110 1010 Substitution Code 5 6 A E 6 A 56AE6A16
Substitution code can also be used to convert binary to octal by using 3-bit groupings: 010 101 101 010 111 001 101 010 Substitution Code 2 5 5 2 7 1 5 2 255271528
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 0 with a carry of 1 Example: 11001 111 + 1101 + 11 100110 ???
Simple Arithmetic • Example: 5816 + 2416 7C16 • Addition • Example: 100011002 + 1011102 101110102 • Substraction • Example: 10001002 - 1011102 101102
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 0 X 0 = 0 0 X 1 = 0 Example: 1 X 0 = 0 100110 1 X 1 = 1 X 101 100110 000000 + 100110 10111110
Binary Division Use the same procedure as decimal division
Changing all the 1s to 0s and all the 0s to 1s Example: 1 1 0 1 0 0 1 0 1 Binary number 0 0 1 0 1 1 0 1 0 1’s complement 1’s complements of binary numbers
2’s complement • Step 1: Find 1’s complement of the number Binary # 11000110 1’s complement 00111001 • Step 2: Add 1 to the 1’s complement 00111001 + 00000001 00111010 2’s complements of binary numbers
Signed Magnitude Numbers 110010.. …00101110010101 Sign bit 31 bits for magnitude 0 = positive 1 = negative This is your basic Integer format
Left most is the sign bit • 0 is for positive, and 1 is for negative • Sign-magnitude • 0 0 0 1 1 0 0 1 = +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 Sign 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 Sign numbers
Digital Codes • BCD (Binary Coded Decimal) Code • 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 • Used to translate from the keyboard characters to computer language Can convert from ASCII code to binary / hexadecimal/ or any numbering systems and vice versa How to convert ?????
Digital Codes • The Gray Code • Only 1 bit changes • Can’t be used in arithmetic circuits • Can convert from Binary to Gray Code and vice versa. • How to convert ?????