EET 250 Number systems. Introduction to Number Systems While we live in a world where the decimal number is predominant in our lives, computers and digital.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Lecture - 2 Number systems and computer data formats
Data Representation Computer Organization &
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Data Representation COE 205
Assembly Language and Computer Architecture Using C++ and Java
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
Assembly Language and Computer Architecture Using C++ and Java
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Data Representation in Computers
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
Chapter 1 Number Systems and Codes William Kleitz Digital Electronics with VHDL, Quartus® II Version Copyright ©2006 by Pearson Education, Inc. Upper Saddle.
EE 261 – Introduction to Logic Circuits
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Binary Number Systems.
Chapter 1 Number Systems and Codes 1. Outline 1. NUMBER SYSTEMS AND CODES 2. DIGITAL ELECTRONIC SIGNALS AND SWITCHES 3. BASIC LOGIC GATES 4. PROGRAMMABLE.
Number Systems.
Programmable Logic Controllers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis.
Computers Organization & Assembly Language
CSC212 – Computer Organization and Design
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
IT253: Computer Organization
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
The Hexadecimal Number System and Memory Addressing ISAT 121.
Storing and Organizing Data. Why Do I Need to Understand How Data Is Represented? In order to install, program,maintain, and troubleshoot today’s PLCs,
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Data Representation, Number Systems and Base Conversions
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
AEEE2031 Data Representation and Numbering Systems.
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.
ABFC... Home page Introduction Binary number system Hexadecimal number system Binary coded decimal Objectives Octal number system Click.
Computer Organization 1 Data Representation Negative Integers.
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.
CS2100 Computer Organisation
Number Systems and Codes
Lec 3: Data Representation
Data Representation.
Number Representation
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 : INTRODUCTION
Number Systems.
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Number Systems and Codes
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Digital Logic & Design Lecture 03.
COMS 161 Introduction to Computing
COMS 161 Introduction to Computing
2’s Complement form 1’s complement form 2’s complement form
Chapter 3 - Binary Numbering System
Presentation transcript:

EET 250 Number systems

Introduction to Number Systems While we live in a world where the decimal number is predominant in our lives, computers and digital systems work in another number system – Binary. This section will discuss various number systems you will commonly encounter when working with microcontrollers.

Decimal It helps to first take a fresh look at a number system we are familiar with. Decimal. Decimal is a Base-10 number system (Deci meaning 10). We use Base-10 because that is the number of units on the first counting device used…. Fingers! In a Base-10 number system there are 10 unique symbols – 0 through 9.

Any position in a value can only contain one of these symbols, such as There are 4 places, each with one digit. Each place to the left of the decimal point signifies a higher power of = 1= 10= 100= 1000

4 x x x x A number, such as 1354, is each place value multiplied weight of that position. Thus 1354 is

Binary In digital systems, there only only states such as ON/OFF, TRUE/FALSE, HIGH/LOW, or any manner of other terms used… including only the digits of 0 and 1. Having only 2 states or unique values creates a binary number system. In binary, we count and work with values in the same manner as decimal.

Just as in decimal, each place is a higher power, but not of 10, but 2 since binary is a 2-based system = 1= 2= 4= 8

By taking the value,1001, and multiplying each digit by the weight of the position, we can convert a binary value to decimal. 1 x x2 0 0 x4 0 1 x8 8 Thus 1001 in binary is = 9 Decimal Binary to Decimal

Common ways to denote binary are: b 0b1001 Decimal is typically not specially notated, but may be written as:

Bit Groupings Often Bits (Binary Digits) are grouped to form specially sized combinations. Nibble – 4 Bits Byte – 8 Bits Word – 16 Bits Word is actually used to refer to a pre-defined number of bits of any size (16-bit word, 24-Bit word, 32-Bit word, etc).

In a nibble with 4-bits, the range of values is 0000 (Decimal 0) to 1111 (Decimal 15: ). Note there are 16 values: 0 to 15. In a byte with 8-bits, the range of values is (Decimal 0) to (Decimal 255: ) Note there are 256 values: 0 to 255. An equation to find the maximum count for any number of bits is: 2 n -1 where n = number of bits =255.

Hexadecimal Digital systems work in binary because of their nature of having only 2 states, but as humans we have a difficulty dealing with numbers such as It is long and difficult to read. Hexadecimal is good middle between decimal and binary. It allows for easier use, 7C, and relates directly to binary. Hexadecimal is a base-16 number system. It is denoted by 7Ch, 0x7C or 7C 16.

Each place is a higher power of = 1= 16= 256= 4096  But since it is base-16, 16 unique digits are needed. The first 10 are carried over from decimal, 0-9. The last 6 borrow from the alphabet, A-F, where: A = 10 B = 11 C = 12 D = 13 E = 14 F = 15

Hexadecimal to Decimal By taking the value, 7C, and multiplying each digit by the weight of the position, we can convert a hexadecimal value to decimal. C (12) x x Thus 7C in Hexadecimal is = 124 Decimal.

Hexadecimal to Binary Because 16 (hex) is a whole power of 2 (binary), there is a direct correlation between a hexadecimal value and a binary value. Each hex value corresponds to a unique binary nibble, since a nibble has 16 unique states. BinaryHex A 1011B 1100C 1101D 1110E 1111F

Because each nibble is a hexadecimal value, it is simple to convert binary to hexadecimal and vice- versa E2  In programming or computer use many times values are represented in hexadecimal for a good human to computer interface number system. DIRS = 00F0 The COM1 address is 03F8 The MAC address is: 0C12CEF69B01

Binary Coded Decimal (BCD) BCD is used by many devices to have a direct correlation between a binary nibble and a decimal value. BCD is simply a subset of hexadecimal where A (1010) through F (1111) are invalid. It is denoted by 95 BCD hexadecimal or BCD

Conversion Table BinaryHexBCDDecimal AInvalid BInvalid CInvalid DInvalid EInvalid FInvalid15

Conversion Calculators Many scientific calculators can convert between various number systems. The Microsoft Windows® calculator is one example. It must first be placed in scientific mode.

Next, select the number system, enter a value, and select a new number system. Oct is Octal, a Base-8 number system, 0 to 7, where each octal value represents 3 bits.

ASCII Codes A byte doesn't always represent a value. In many cases the value represents a code for a use, such as representing alpha-numeric characters. ASCII is one example. ASCII is a 7-bit code where each value represents a unique character or control function for the transmission of data, such as a text message to terminal. With 7-bits, there are 128 unique codes or characters that may be represented. This is a standard and strictly adhered too. Extended ASCII is an 8-bit code providing 256 unique characters or codes. Different systems use the upper 128 values as they desire.

From Page 337 of the BASIC Stamp Manual Version 2

Summary As programmers, it is important to be able to relate controllers in other number systems, such as binary, hexadecimal and BCD. It is also important to understand the ASCII table and use in representing control and alphanumeric character representations.

Binary Number Powers of Two 1 bit -> 2 states 0,1 (on/off) 2 bits -> 4 states 00, 01, 10,11 3 bits -> 8 states 000,001,010,011,100,101,110,111 4 bits -> 16 states (nibble) 5 bits -> 32 states 8 bits -> 256 states (byte) 10 bits -> 1024 states ( 1K) 16 bits -> 65,536 states (64K) (Word) 20 bits -> 1,048,576 states (1M) 32 bits -> 4,294,967,296 states (4G) (2 words) In general 2 N states are possible with N bits

Example: Binary Addition =

Example: Binary Multiplication

Unsigned Limited to situations when processing and inputs are always positive Important in representation data or signals absolute value Largest number all ones, smallest all zeroes ( byte examples) –FF Max positive – Zero (smallest)

Signed Used when processing negative numbers or doing associated subtraction and multiplication Important in representation data or signals that “go below zero point” Two’s compliment format Most significant bit donates sign ( 0 is positive, 1 is minus) ( byte examples) –7F Max positive – Zero –FF Negative one – Max negative

Signed and Unsigned Format Unsigned Integer Signed

Summary Binary Data Representation Schemes Numbers/data –Signed magnitude ( MSB represents Sign bit) –Unsigned magnitude ( MSB is part of number) –Machine defined ( machine codes or bits mean control/or status for program operation) –ASCII ( pre-defined agreed to symbol to binary table) –Binary Coded Decimal Two nibbles side by side Each nibble represents a binary four bit number from 0-9 Confusing to write out strings of 1’s and 0’s -> best to use HEX shorthand

Machine Codes Machine specific instruction codes Varies in size and definition from machine to machine. –Highly dependent on internal machine registers and computational capabilities

Assignments Complete Handout 1 on Number systems Read Chapter 2 of Bates book do questions 1,2,3