Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: " Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY."— Presentation transcript:

1

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

3  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

4 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

5 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

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

7 Convert the Decimal numbers to Binary 21 = -16 1 16842u 1100 5 42 = -32 10 3216842u 111 000 Change these Decimal numbers to Binary 1) 152) 643)55 11111000000110111

8  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 01000001 (or 65 in decimal)  If more characters are required all 8 bits can be used allowing 256 possibilities

9  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

10  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

11  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

12  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.

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

14  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

15 Using 4 bits+3 -3 0 0 1 1 +/- 4 2 u 1 0 1 1 Max no in 4 bits 0 1 1 1 1 1 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. 0000 and 1000) Addition +3 -3 0 0 1 1 +/- 4 2 u 1 0 1 1 1 1 1 0-6 Addition gives the WRONG answer (should be 0)

16 Using 8 bits+7 -7 0 0 0 0 0 1 1 1 +/- 64 32 16 8 4 2 u 1 0 0 0 0 1 1 1 Examples – Using 8 bits Sign and Magnitude coding 1)Convert to Binary 21-56100-93-8 0001010110111000011001001101110110001000 2) Convert to Decimal 10010111 00100101 10000000 01000000 11111111 -23+37 0 +64 -127 Because of the errors in addition and the 2 different codes to represent zero, Sign and Magnitude coding is not normally used

17 In 2’s Complement the Most Significant Bit (LHS) represents a NEGATIVE QUANTITY Using 4 bits+3 -3 0 0 1 1 -8 4 2 u 1 1 0 1 (-8+5) Max no in 4 bits 0 1 1 1 1 0 0 0Min no in 4 bits- 8 +7 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) 0 0 1 1 -8 4 2 u 1 1 0 1 0 0 = 0 √

18 Using 8 bits+7 -7 0 0 0 0 0 1 1 1 -128 64 32 16 8 4 2 u 1 1 1 1 1 0 0 1 (-128+121) Examples – Using 8 bits 2’s Complement coding 1)Convert to Binary -21-56-100-93-8 1110101111001000100111001010001111111000 2) Convert to Decimal 10010111 10101010 10000000 11000000 11111111 -105 -86-128 -64 2’s Complement is the type of coding normally used to represent Negative numbers

19 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 0 0 1 1 1 0 1 0 -128 64 32 16 8 4 2 u 1 1 0 0 0 1 0 1 Step 1 Convert +58 to binary Step 3 Add 1 +1 1 1 0 0 0 1 1 0 = -58 (-128+70)

20 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 1234.56 Could be written 1.23456 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 1.23456 x 10 3 In Computing we call it FLOATING POINT NOTATION

21 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)56234.1 2)0.0987 3)24534867.6 4)0.00000012 Mantissa = 5.62341 Exponent = +4 = 5.62341 x 10 4 = 9.87 x 10 -2 Mantissa = 9.87 Exponent = -2 = 2.45348676 x 10 7 Mantissa = 2.45348676 Exponent = +7 = 1.2 x 10 -7 Mantissa = 1.2 Exponent = -7

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

23 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) 10.112) 101101.13) 0.001 =.1011 x 2 10 M = 1011 E = 10 =.1011011 x 2 110 M = 1011011 E = 110 =.1 x 2 -2 =.1 x 2 -10 M = 1 E = 11111110 Convert each of the above numbers to decimal 1) 2.752) 45.53) 0.125

24  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

25 DecimalBinary (4 bits)HEX 000000 100011 200102 etc 910019 101010A 111011B 121100C 131101D 141110E 151111F

26 Group Binary in 4 bits Binary -> HexHex ->Binary 8 4 2 1 0 1 1 01 1 0 1 6 D 1 1 0 0 1 0 F 2 1 1 0 00 0 1 1 8 4 2 1 C 3 B 7 1 0 1 10 1 1 1 16 1 128 64 32 16 8 4 2 1 =183 E A 1 1 1 01 0 =234 Decimal 2 0 0 0 1 00 0 = 32

27 Convert the Hex numbers to Binary then Decimal 1) 48 2) E7 3)AB 4) 5C 010010001110011110101011 01011100 7223117192 Convert the Decimal numbers to Binary then Hex 1) 135 2) 67 3)101 4) 300 011001010100001110000111100101100 12C654387 Headings for columns in HEX (base 16) are etc65536 4096256161 (Each column heading is 16 times the column on it’s right)


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

Similar presentations


Ads by Google