Number Systems and Codes

Slides:



Advertisements
Similar presentations
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Advertisements

Company LOGO Edit your slogan here DKT 122/3 DIGITAL SYSTEM 1 WEEK #3 NUMBER SYSTEMS, OPERATION & CODES (PART 2)
Chapter 1 Digital Systems and Numbers System
CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation in Computers
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Mantıksal Tasarım – BBM231 M. Önder Efe
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Data Representation in Computers
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Programmable Logic Controllers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Data Representation – Binary Numbers
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 1 – Digital Systems and Information Logic.
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Chapter 3 Data Representation
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
Chapter 2 – Number Systems and Codes Copyright © 2011, 2007, 2004, 2001, 1998 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights.
NUMBER SYSTEM AND COMPUTER CODES Chapter 2. Prelude Fingers, sticks, and other things for counting were not enough! Counting large numbers Count in groups.
Number Systems Spring Semester 2013Programming and Data Structure1.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Number systems: binary, decimal, hexadecimal and octal. Conversion between various number systems Number systems: binary, decimal, hexadecimal and octal.
Number systems & Binary codes MODULE 1 Digital Logic Design Ch1-2 Outline of Chapter 1  1.1 Digital Systems  1.2 Binary Numbers  1.3 Number-base Conversions.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
Number systems, Operations, and Codes
Number Systems and Digital Codes
Data Representation, Number Systems and Base Conversions
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
1 CS151 Introduction to Digital Design Chapter 1 Lecture 3.
Introduction To Number Systems Binary System M. AL-Towaileb1.
School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor DKT 122/3 - DIGITAL SYSTEM I Chapter.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
AGBell – EECT by Andrew G. Bell (260) Lecture 2.
Overview 1-1 Information Representation
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Introduction to signals The signals are broadly classified into two categories: 1. Analog Signals. 2. Digital signals.
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Some basic concepts underlying computer archi­tecture
Introduction To Number Systems
Number Systems & Binary Arithmetic
Number Systems and Codes
Lecture No. 4 Number Systems
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
CHAPTER 1 : INTRODUCTION
Introduction to Chapter 2
Introduction The term digital is derived from the way computers perform operation, by counting digits. Application of digital technology: television, communication.
COMPUTING FUNDAMENTALS
Chapter 3 Data Representation
Number System conversions
Number Systems.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
SYEN 3330 Digital Systems Chapter 1 SYEN 3330 Digital Systems.
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Chapter Four Data Representation in Computers By Bezawit E.
COE 202: Digital Logic Design Number Systems Part 2
Presentation transcript:

Number Systems and Codes 3 Number Systems and Codes

Objectives Explain the decimal number system. Explain integer numbers, fractional numbers, and real numbers. Describe the binary number system. Convert decimal numbers to binary and vice versa. Perform binary math operations such as add, subtract, multiply, and divide. © Goodheart-Willcox Co., Inc.

Objectives Explain the hexadecimal number system. Convert binary numbers to hexadecimal numbers and vice versa. Explain the octal number system. Convert binary numbers to octal numbers and vice versa. Explain the binary coded decimal number system and its use. © Goodheart-Willcox Co., Inc.

Objectives Convert decimal numbers to binary coded decimal. Explain the Gray code number system and its use. Explain ASCII and EBCDIC alphanumeric codes. © Goodheart-Willcox Co., Inc.

Decimal Number System Decimal number system: Has ten (10) digits running from zero (0) through nine (9). Decimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each digit's value depends on the position of the digit within the number. © Goodheart-Willcox Co., Inc.

Decimal Number System (Cont.) Base, also called the radix: Multipliers for the digits are numbers constructed of the number system (10 in the decimal system) raised to the appropriate power. 10a 10 = Base or radix a = Power © Goodheart-Willcox Co., Inc.

Decimal Number System (Cont.) Values for the power of ten (10) numbers. © Goodheart-Willcox Co., Inc.

Decimal Number System (Cont.) Example: 6310 = (6 × 103) + (3 × 102) + (1 × 101) + (0 × 100) = (6 × 1000) + (3 × 100) + (1 × 10) + (0 × 1) = 6000 + 300 + 10 + 0 = 6310 © Goodheart-Willcox Co., Inc.

Fractional Numbers Fractional numbers: Have weights that are negative powers of ten (10). Example: 0.812 = (8 × 10-1) + (1 × 10-2) + (2 × 10-3) = (8 × 0.1) + (1 × 0.01) + (2 × 0.001) = 0.8 + 0.01 + 0.002 = 0.812 © Goodheart-Willcox Co., Inc.

Real Numbers Real numbers: Value of digits: Have weights that are both positive and negative powers of ten (10). Integer parts. Fractional parts. Value of digits: Digits. Digits' positions. © Goodheart-Willcox Co., Inc.

Real Numbers (Cont.) Example: 547.165 = (5 × 102) + (4 × 101) + (7 × 100) + (1 × 10–1) + (6 × 10–2) + (5 × 10–3) = (5 × 100) + (4 × 10) + (7 × 1) + (1 × 0.1) + (6 × 0.01) + (5 × 0.001) = 500 + 40 + 7 + 0.1 + 0.06 + 0.005 = 547.165 © Goodheart-Willcox Co., Inc.

Real Numbers (Cont.) Digits to the left of the decimal point represent the integer number. Digits to the right of the decimal point represent the fractional number. © Goodheart-Willcox Co., Inc.

Integer Numbers Integer numbers: Have weights that are positive powers of ten (10). Can be positive or negative. Zero is an integer number. © Goodheart-Willcox Co., Inc.

Binary Number System Binary number system: Has a base, also called a radix, of two (2). Only the digits 1 and 0 are present. All binary numbers are created from combinations of these two digits. © Goodheart-Willcox Co., Inc.

Binary Number System (Cont.) Least significant bit (LSB): Binary digit to the far right-hand side of the number. Rightmost number has the smallest value. Most significant bit (MSB): Binary digit to the far left-hand side. © Goodheart-Willcox Co., Inc.

Binary-to-Decimal Conversion Converting binary-to-decimal: Convert each bit to its equivalent decimal value. Add all of these decimal values. © Goodheart-Willcox Co., Inc.

Decimal-to-Binary Conversion Convert integer part of a decimal number using: Repeated division. Successive division. Convert fractional part using: Repeated multiplication. Successive multiplication. © Goodheart-Willcox Co., Inc.

Decimal-to-Binary Conversion (Cont.) Successive division method: Integer decimal number is divided by two, repeatedly. Remainders make up the new binary number. © Goodheart-Willcox Co., Inc.

Decimal-to-Binary Conversion (Cont.) Successive multiplication method: Convert the fractional part of a decimal number to binary. MSB of the binary number: Decimal number is multiplied by two and the portion that is carried (if the product is greater than 0). Process is continued until the decimal part of the number becomes zero. © Goodheart-Willcox Co., Inc.

Binary Addition Decimal number system: Binary number system: Carry generated when the sum of two digits is equal to 10. Binary number system: Carry generated when the sum of two binary bits is equal to two. © Goodheart-Willcox Co., Inc.

Binary Addition (Cont.) Ways that binary bits are added and how the carry bit is generated: 0 + 0 = 0 0 + 1 = 1 1 + 1 = 0 with carry of 1 1 + 1 + 1 = 1 with carry of 1 © Goodheart-Willcox Co., Inc.

Binary Subtraction In the decimal number system: When the value of a digit is being subtracted (the subtrahend) is greater than the value of the digit that it is being subtracted from (the minuend), a borrow from the next higher column (the column to the left) is required. © Goodheart-Willcox Co., Inc.

Binary Subtraction (Cont.) Subtraction of binary numbers: Ways binary bits are subtracted and when a borrow bit is required: 0 – 0 = 0 no borrow 1 – 1 = 0 no borrow 1 – 0 = 1 no borrow (1) 0 – 1 = 1 with a borrow of 1 © Goodheart-Willcox Co., Inc.

Binary Multiplication In multiplication, the multiplicand is multiplied by each of the multiplier digits. Results of each higher multiplier digit are shifted one place to the left. When each of the multiplicand’s digits have been multiplied by the multiplier digits, all of the numbers are added. © Goodheart-Willcox Co., Inc.

Binary Multiplication (Cont.) How binary bits are multiplied: 0 × 0 = 0 0 × 1 = 0 1 × 0 = 0 1 × 1 = 1 © Goodheart-Willcox Co., Inc.

Binary Division Division: How many times a number called the divisor can be subtracted from another number called the dividend. Similar to decimal division. © Goodheart-Willcox Co., Inc.

Binary Division (Cont.) Subtraction routine: Continues until the remainder is less than the dividend. Quotient: Number of times the divisor can be subtracted from the dividend. © Goodheart-Willcox Co., Inc.

Hexadecimal Number System Used in medium to larger programmable logic controllers (PLCs). Often just called hex. Used to display the PLC memory map and to carry out the math instructions. Created by grouping four binary bits. Hexadecimal numbers use base of 16 and require fifteen digits. © Goodheart-Willcox Co., Inc.

Hexadecimal Number System (Cont.) Uses the numbers zero (0) through nine (9) for the first ten digits. Ten (10) through fifteen (15) are represented by letters A through F. Digits representing 10, 11, 12, 13, 14, and 15 are displayed as A, B, C, D, E, and F respectively. Capital letter H or the small letter h is placed at the end of a hexadecimal number. © Goodheart-Willcox Co., Inc.

Hexadecimal Number System (Cont.) Hexadecimal Binary Decimal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 A 1010 10 B 1011 11 C 1100 12 D 1101 13 E 1110 14 F 1111 15 © Goodheart-Willcox Co., Inc.

Hexadecimal Number System (Cont.) To form hex numbers from binary numbers, group binary number bits in groups of four. Swap out each group of four binary bits with its hex equivalent. Example: 111100010111 becomes 1111 0001 0111 which is transformed to F 1 7 or F13h. © Goodheart-Willcox Co., Inc.

Hexadecimal Number System (Cont.) Reverse the process to convert to binary. Take each hex digit and swap it with the binary 4-bit equivalent. Example: The number 37Ah becomes 0011 0111 1010 or 001101111010. © Goodheart-Willcox Co., Inc.

Octal Number System Octal number system: Has a base of eight. Therefore, only the digits zero (0) through seven (7) are present. Used to display the memory maps and carry out the math instructions in some MicroLogix controllers. © Goodheart-Willcox Co., Inc.

Octal Number System (Cont.) Octal Binary Decimal 0 000 0 1 001 1 2 010 2 3 011 3 4 100 4 5 101 5 6 110 6 7 111 7 © Goodheart-Willcox Co., Inc.

Octal Number System (Cont.) Form an octal number from a binary number by grouping binary number bits in groups of three. Swap out each group of three binary bits with its octal equivalent octal digit. Example: The number 11001111 becomes 011 001 111 which is transformed to 3 1 7 or 317O. © Goodheart-Willcox Co., Inc.

Octal Number System (Cont.) Reverse the process to convert to binary. Take each octal digit and swap it with the binary 3-bit equivalent. Example: The number 246 becomes 010 100 110 or 10100110. The capital letter O is placed at the end of an octal number. © Goodheart-Willcox Co., Inc.

Binary Coded Decimal (BCD) System Each 4 bits of binary numbers are grouped to form a decimal number. Four bit groups representing 10, 11, 12, 13, 14, and 15 are not valid numbers in the BCD number system. Only digits zero (0) through nine (9) are valid. © Goodheart-Willcox Co., Inc.

Binary Coded Decimal (BCD) System (Cont.) Binary Coded Decimal (BCD) Decimal 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 © Goodheart-Willcox Co., Inc.

Binary Coded Decimal (BCD) System (Cont.) To convert a number from any number system to BCD, first convert the number to decimal. Then, represent each decimal digit with a 4-bit binary number code. © Goodheart-Willcox Co., Inc.

Gray Code Servo control: Optical encoders: Closed-loop industrial control system that is used to control the speed and position of an electric motor shaft. Optical encoders: Generate codes that represent the angular positions of the motor shafts. Usually in a format called Gray code. © Goodheart-Willcox Co., Inc.

Gray Code (Cont.) Gray code system: Similar to binary. Converted to binary prior to arithmetic operation. Used for detecting the position of a motor shaft. Only one digit changes state (turns on or off) as a number increments or decrements. © Goodheart-Willcox Co., Inc.

Gray Code (Cont.) Gray code system (continued): Speed of the operation of a control system increases. Only one digit changes with every rotation of the optical encoder disc attached to the motor shaft. Difficulty in doing arithmetic operations. © Goodheart-Willcox Co., Inc.

Gray code Binary Decimal Gray Code (Cont.) Gray code Binary Decimal 0000 0000 0 0001 0001 1 0011 0010 2 0010 0011 3 0110 0100 4 0111 0101 5 0101 0110 6 0100 0111 7 1100 1000 8 1101 1001 9 1111 1010 10 1110 1011 11 1010 1100 12 1011 1101 13 1001 1110 14 1000 1111 15 © Goodheart-Willcox Co., Inc.

Alphanumeric Code Alphanumeric codes represent: Letters Numbers Special symbols © Goodheart-Willcox Co., Inc.

American Standard Code for Information Interchange (ASCII) 7-bit code Used to represent alphabets, numbers, characters, and control codes in computer systems. One hundred and twenty eight (27 = 128) different characters can be represented. Data is often sent in bytes (groups of eight bits). Eighth bit in one byte of transmitted data used for a parity bit. © Goodheart-Willcox Co., Inc.

Extended Binary Coded Decimal Interchange Code (EBCDIC) 8-bit code. Alphanumeric code commonly encountered in computer mainframe equipment. Two hundred and fifty six (28 = 256) different characters can be represented. Uppercase and lowercase. Numbers (1 thru 9). Punctuation, control codes, and other characters. Commonly called Extended ASCII. © Goodheart-Willcox Co., Inc.

Alphanumeric Codes © Goodheart-Willcox Co., Inc.

Control Codes © Goodheart-Willcox Co., Inc.

Glossary American Standard Code for Information Interchange (ASCII): Code that uses seven bits to represent alphabets, numbers, characters, and control words. Base: The number that determines the weight of digits in a given number system. Also called a radix. © Goodheart-Willcox Co., Inc.

Glossary Binary coded decimal (BCD) system: Number system that uses binary numbers to represent decimal digits. Binary number system: Number system that has a base of two. Borrow bit: Bit in a subtraction operation that is required when the subtrahend (bottom number) digit is larger than the minuend (top number) digit. © Goodheart-Willcox Co., Inc.

Glossary Carry bit: Bit in an addition operation that is generated when the sum of two digits is larger than the base. Decimal number system: Number system that has a base of ten (10). Dividend: Number in a division operation from which the divisor can be subtracted repeatedly. © Goodheart-Willcox Co., Inc.

Glossary Divisor: Number in a division operation that can be subtracted from the dividend repeatedly. Extended Binary Coded Decimal Interchange Code (EBCDIC): Often called Extended ASCII, a code that uses eight bits to represent alphabets, numbers, characters, and control words. Fractional numbers: Numbers that have weights with negative powers. © Goodheart-Willcox Co., Inc.

Glossary Gray code system: Number system similar to binary, but bits are changed only one at a time. Hexadecimal number system (hex): Number system that has a base of 16. Integer numbers: Numbers that have weights with positive powers. © Goodheart-Willcox Co., Inc.

Glossary Least significant bit (LSB): Bit in a binary number on the far right-hand side. Minuend: The top number in a subtraction operation. Most significant bit (MSB): Bit in a binary number on the far left-hand side. © Goodheart-Willcox Co., Inc.

Glossary Multiplicand: The top number in a multiplication operation. Multiplier: The bottom number in a multiplication operation. Octal number system: Number system that has a base of 8. © Goodheart-Willcox Co., Inc.

Glossary Quotient: In a division operation, it is the number of times the divisor can be subtracted from the dividend. Real numbers: Numbers that have both integer and fractional parts. Subtrahend: The bottom number in a subtraction operation. © Goodheart-Willcox Co., Inc.

Glossary Successive division method: Method of converting decimal numbers to binary by dividing the decimal number by two repeatedly. © Goodheart-Willcox Co., Inc.