 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.

Slides:



Advertisements
Similar presentations
1 Chapter 2 The Digital World. 2 Digital Data Representation.
Advertisements

The Binary Numbering Systems
©1999 Addison Wesley Longman2.1 A Bit About Bits A bit (binary digit) –is the smallest unit of information –can have two values - 1 and 0. Binary digits,
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
Connecting with Computer Science, 2e
Binary Expression Numbers & Text CS 105 Binary Representation At the fundamental hardware level, a modern computer can only distinguish between two values,
Binary and Decimal Numbers
Introduction to Information Technology
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
Representing Information in Binary (Continued)
Binary Number Systems.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Computer Storage & Representing Numbers CE 311 K - Introduction to Computer Methods Daene C. McKinney.
Chapter 5 Data representation.
The Binary Number System
Higher Computing Data Representation.
Computing Higher - Unit 1… Computer Systems 1 Higher Computing Unit 1 – Topic 1 Data Representation.
Bits & Bytes: How Computers Represent Data
Data Representation S2. This unit covers how the computer represents- Numbers Text Graphics Control.
IT253: Computer Organization
Higher Computing Computer Systems S. McCrossan 1 Higher Grade Computing Studies 1. Data Representation Data Representation – Why do we use binary? simplicity,
Data Representation Int 2 Computing Unit 1 – Computer Systems St Kentigern’s Academy.
CS Topic 1 - Data Representation v2 1 Data representation considers how a computer uses numbers to represent data inside the computer. Three types of data.
Shawlands Academy Higher Computing Data Representation.
Data Representation The method of data representation in a computer system depends upon the type of data which is being used. Three types of data are considered.
Fill in the blanks: (1) _________ has only two possible values 0 and 1. (2) There are __________bits in a byte. (3) 1 kilobyte of memory space can store.
Why does it matter how data is stored on a computer? Example: Perform each of the following calculations in your head. a = 4/3 b = a – 1 c = 3*b e = 1.
Text and Graphics September 26, Unit 3.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
The Teacher CP4 Binary and all that… CP4 Revision.
Computer Systems Nat 4/5 Computing Science Data Representation Lesson 2: Floating Point Representation.
The Teacher CP4 Binary and all that… CP4 Revision.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Marr CollegeHigher ComputingSlide 1 Higher Computing: COMPUTER SYSTEMS Part 1: Data Representation – 6 hours.
Data Representation Conversion 24/04/2017.
Int 2/ Higher - Data Representation - 1 Why use Binary? It is a two state system (on/off) which makes it simple to operate Even if degradation of current.
Data Representation The storage of Text Numbers Graphics.
Data Representation (in computer system). Data Representation How do computers represent data? b The computers are digital Recognize.
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
1 Information Representation in Computer Lecture Nine.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Graphics in a computers memory How a picture (i.e. a graphic) is stored in a computers memory A computer screen is made up of little dots, called PICture.
ASCII AND EBCDIC CODES By : madam aisha.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Software Design and Development Storing Data Computing Science.
Binary a. express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal;
Computer Science: An Overview Eleventh Edition
Storing Graphics Nat 5 Data Representation Lesson 4a: Storing Graphics
Data Representation.
Computer Systems Nat 4/5 Data Representation Lesson 4:
3.1 Denary, Binary and Hexadecimal Number Systems
CSCI 198: Lecture 4: Data Representation
Memory Parts of a computer
CSCI 161: Lecture 4: Data Representation
Intermediate 2 Computing
Why use Binary? There are only four rules for addition in binary compared to 100 in decimal [0+0=0 ; 0+1=1 ; 1+0=1; 1+1=10]
How do computers work? Storage.
Computer Systems – Unit 1
Information Representation
Why use Binary? It is a two state system (on/off) which makes it simple to operate Even if degradation of current occurs (ie a slight drop in voltage)
Storing Negative Integers
How Computers Store Data
Computer Systems.
A-level Computer Science
Binary System.
LO1 – Understand Computer Hardware
Computer Systems Nat 4/5 Computing Science Data Representation
Presentation transcript:

 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY

 All data including › Numbers › Letters › Characters (,. = “ etc) › Graphics  Must be changed to patterns of 1’s and 0’s to be stored in a Computer

Each column in a decimal number has a value 10x the column on it’s right So the number 345 i.e.10010U 3 45 Represents 3x100 +4x10 +5units =345

Each column in a binary number has a value 2x the column on it’s right So the binary number 1101 i.e.842U 1101 Represents 1x8 +1x4 +0x2 +1unit = 13 in decimal

Convert the binary numbers to decimal 42u42u u Convert these binary numbers to decimal = 1x4 +1 = 5 = 1x32 + 1x16 + 0x8 + 1x4 + 0x2 + 1 = 53 1) 11002) ) ) 122) 293) 39

Convert the Decimal numbers to Binary 21 = u = u Change these Decimal numbers to Binary 1) 152) 643)

 Each character is represented by a unique pattern of 1’s and 0’s  This code is called ASCII  ASCII – American Standard Code for Information Interchange  Each ASCII code is a pattern of 7 bits (and the 8 th bit used as a parity check)  This allows 128 different possibilities  A is represented by (or 65 in decimal)  If more characters are required all 8 bits can be used allowing 256 possibilities

 Unicode – Universal Character Set  Unicode is a 16-bit code and can represent 65,536 characters  This is designed to represent all the world’s major languages  The first 128 characters are identical to ASCII (to allow compatibility)  Advantage – represents more characters than ASCII  Disadvantage – takes up more storage space

 Smallest graphics dot on screen is called a PIXEL - Picture Element  A Pixel can be lit or not lit  Number of Pixels – RESOLUTION of graphic  High resolution – lots of small pixels  Low resolution – fewer larger pixels

 Resolution measured in dpi (dots per inch) e.g. 300dpi  2 colours (monochrome) uses 1 bit per pixel › 1 – black 0 - white  More colours need more bits per pixel › 2 bits – 4 colours represented by 00,01,10,11 › 3 bits – 8 colours (000,001,010,011,100,101,110,111) › 4 bits – 16 colours etc  True Colour is represented by 24 bits and gives a range of 16,777,216 colours  High resolution and lots of colours requires lots of memory  To save memory one can be traded off against the other

 Each 1 or 0 is called a BIT (short for Binary Digit).  Eight bits are called a BYTE.  1024 (approx 1000) bytes is a KILOBYTE (Kb for short)  1024 kilobytes is a MEGABYTE (Mb for short)  1024 megabytes is a GIGABYTE (Gb for short)  1024 gigabytes is a TERABYTE (Tb for short) These units are used to measure the size of storage (called CAPACITY) or storage requirements e.g. the available memory, hard disk space, program size, file size.

 Calculate the storage requirement for a black and white image 600 pixels by 850 pixels  Answer – Total no of pixels = 600x850 = Each pixel is represented by 1 bit Storage required = bits = /8 bytes = bytes = 63750/1024 Kb = 62.3 Kb (to 1 Dec Pl)

 Calculate the storage requirement for the following black and white graphics 1) An icon 16x24 pixels 2) A photograph 600 x400 pixels 3) A poster 2350 x 1876 pixels  Answers 1) 48 bytes 2) 29.3 Kb 3) 0.53 Mb

Using 4 bits /- 4 2 u Max no in 4 bits Min no in 4 bits-7 +7 Number of values represented by 4 bits = 16 1 to +7, -1 to -7 (i.e. 14 values) and 2 values for 0 (i.e and 1000) Addition /- 4 2 u Addition gives the WRONG answer (should be 0)

Using 8 bits / u Examples – Using 8 bits Sign and Magnitude coding 1)Convert to Binary ) Convert to Decimal Because of the errors in addition and the 2 different codes to represent zero, Sign and Magnitude coding is not normally used

In 2’s Complement the Most Significant Bit (LHS) represents a NEGATIVE QUANTITY Using 4 bits u (-8+5) Max no in 4 bits Min no in 4 bits Number of values represented by 4 bits = 16 1 to +7, -1 to -8 (i.e. 15 values) and 1 value for 0 (i.e. 0000) Addition +3 +(-3) u = 0 √

Using 8 bits u ( ) Examples – Using 8 bits 2’s Complement coding 1)Convert to Binary ) Convert to Decimal ’s Complement is the type of coding normally used to represent Negative numbers

You can use the method of column headings to convert negative numbers to 2’s complement or you can use the following method To find -58 in 8-bit 2’s complement 58 Step 2 Change all 1’s to 0’s and 0’s to 1’s u Step 1 Convert +58 to binary Step 3 Add = -58 ( )

So far we have only dealt with INTEGERS (i.e. numbers without a fraction or decimal point) How would the computer cope with a Decimal Point? Consider Could be written x 1000 EXPONENT MANTISSA In Maths this is called Standard Form or Scientific Notation The Decimal Point is always moved to the same place and the result is always Mantissa x 10 to the power of Exponent Or x 10 3 In Computing we call it FLOATING POINT NOTATION

Computers can deal with very large and very small numbers by converting to Floating Point and storing the Mantissa and the Exponent as 2 separate numbers Examples – Use Floating Point to find the Mantissa and Exponent for each of the following 1) ) ) ) Mantissa = Exponent = +4 = x 10 4 = 9.87 x Mantissa = 9.87 Exponent = -2 = x 10 7 Mantissa = Exponent = +7 = 1.2 x Mantissa = 1.2 Exponent = -7

Binary Point u. ½ ¼ = in Decimal For Floating Point in Binary – Always move the Binary point before the first 1 = x 2 4 = x Mantissa = Exponent = 100 in Binary (As the point is always in the same place it can be missed out and the Mantissa stored as ) Usually - the Mantissa is stored in 4 bytes And the Exponent is stored in 1 byte

Negative Mantissa means – Negative Number Negative Exponent means – Fraction between 0 & 1 Increasing No of Bits for Exponent – Increases Range of numbers stored Increasing No of Bits for Mantissa – Increases Accuracy or Precision of numbers stored Convert the following to Floating point and state the Mantissa and Exponent (use 8-bit 2’s complement for Exponent in 3) 1) ) ) =.1011 x 2 10 M = 1011 E = 10 = x M = E = 110 =.1 x 2 -2 =.1 x M = 1 E = Convert each of the above numbers to decimal 1) 2.752) 45.53) 0.125

 Long strings of 1’s and 0’s are difficult to remember  HEXADECIMAL is a shorthand way of writing binary numbers  HEX is Base 16  In binary – 4 bits can represent 16 different numbers  Each of these numbers can be represented by a HEX digit  HEX uses the digits 0-9 and A-F

DecimalBinary (4 bits)HEX etc A B C D E F

Group Binary in 4 bits Binary -> HexHex ->Binary D F C 3 B =183 E A =234 Decimal = 32

Convert the Hex numbers to Binary then Decimal 1) 48 2) E7 3)AB 4) 5C Convert the Decimal numbers to Binary then Hex 1) 135 2) 67 3)101 4) C Headings for columns in HEX (base 16) are etc (Each column heading is 16 times the column on it’s right)