Higher Computing COMPUTER SYSTEMS Part 1 Data Representation

  • Slides: 20
Download presentation
Higher Computing: COMPUTER SYSTEMS Part 1: Data Representation – 6 hours Marr College Higher

Higher Computing: COMPUTER SYSTEMS Part 1: Data Representation – 6 hours Marr College Higher Computing Slide 1

INT 2 Positive 8 -bit binary numbers Convert binary to decimal 1. Write place

INT 2 Positive 8 -bit binary numbers Convert binary to decimal 1. Write place headings Data Representation 2. Write binary number 3. Total headings where 1 present (ignore 0 s) Place headings 128 64 32 16 8 4 2 1 0 1 1 1 0 1 => 64 + 16 + 8 + 4 + 1 = 93 Binary number Binary 0101 1101 is Decimal 93 Marr College Higher Computing Slide 2

INT 2 Advantages of Binary Advantages 1 Binary 0 and 1 can be simply

INT 2 Advantages of Binary Advantages 1 Binary 0 and 1 can be simply used to represent OFF or ON Data Representation 2 A “degraded” signal can still be detected as representing 1 3 Binary has only 5 rules for addition making calculations simpler. Marr College Higher Computing Slide 3

Range up to and including 32 -bits Data Representation The range of positive integer

Range up to and including 32 -bits Data Representation The range of positive integer numbers in binary up to 32 bits are detailed in the table below: Unit Range 1 Bit 0 to 21 – 1 (0 to 1) 8 bits (1 Byte) 0 to 28 – 1 (0 to 255) 16 bits (2 bytes) 0 to 216 – 1 (0 to 65, 535) 24 bits (3 bytes) 0 to 224 – 1 (0 to 16, 777, 215) 32 bits (4 bytes) 0 to 232 – 1 (0 to 4, 294, 967, 295) These measurements are used to determine the lower and upper limits of the range numbers possible with a given amount of bits or bytes. Marr College Higher Computing Slide 4

Data Representation Negative numbers and two’s complement Two’s complement Rules of Binary Addition 1

Data Representation Negative numbers and two’s complement Two’s complement Rules of Binary Addition 1 State the positive binary number 0+0=0 1 + 1 = 0 carry 1 2 Invert 0 s and 1 s 0+1=1 1 + 1 = 1 carry 1 3 Add 1 1+0=1 Example: Represent -9 using two’s complement method. 128 64 32 16 8 4 2 1 0 0 1 = +9 1 1 0 = Inversion 0 0 0 0 1 = Add binary 1 1 1 0 1 1 1 = Answer! Indicates sign 0 = +, 1 = - => (-128 )+ 64 + 32 + 16 + 4 + 2 + 1 = - 9 Marr College Higher Computing Slide 5

INT 2 Floating point representation Here is a fractional binary number… 1101. 001101110010 Data

INT 2 Floating point representation Here is a fractional binary number… 1101. 001101110010 Data Representation Binary point Rule: Move the point in front of the digits. So the same number could be written as. . . 1101001101110010 x 2 Mantissa Marr College 0000 0100 Exponent Higher Computing Slide 6

Floating point representation And the same number would be stored in memory as… Data

Floating point representation And the same number would be stored in memory as… Data Representation Byte 1 Byte 2 Byte 3 11010011 01110010 00000100 Mantissa Exponent Therefore… ü The mantissa stores the actual digits of the number. Increasing the number of bits increases the precision (accuracy) of the number. ü The exponent stores the number of places the point has been moved. Increasing the number of bits increases the range of numbers that can be stored. Marr College Higher Computing Slide 7

INT 2 Storage Capacity Data Representation Memory is organised into groups of bytes and

INT 2 Storage Capacity Data Representation Memory is organised into groups of bytes and large files sizes are represented as powers of 2. Unit Bytes 1 Bit 0, 1 1 Byte 8 bits 1 Kilobyte (Kb) 210 = 1024 bytes 1 Megabyte (Mb) 220 = 1, 048, 576 bytes (1024 Kb) 1 Gigabyte (Gb) 230 = 1, 073, 741, 824 bytes (1024 Mb) 1 Terabyte (Tb) 240 = 1, 099, 511, 627, 776 bytes (1024 Gb) These measurements are used in memory (e. g. RAM) and backing storage (e. g. hard disc, DVD etc. ) Marr College Higher Computing Slide 8

INT 2 ASCII - American Standard Code for Information Interchange Data Representation To represent

INT 2 ASCII - American Standard Code for Information Interchange Data Representation To represent text a unique 7 or 8 bit binary code is used for each character on the keyboard. Character ASCII code Decimal Note the leftmost bit is always 0, hence only 7 -bits used in Standard ASCII. The ‘eighth bit’ increases the range of possible characters to 256 and gives Extended ASCII. A 0100 0001 65 B 0100 0010 66 Z 0101 1010 90 a 0110 0001 97 2 0011 0010 50 Beep 0000 0111 7 & 0010 0110 38 Examples of Standard ASCII enables the transfer data from one computer or software package to another e. g. email. It is the simplest form of text with no formatting. A character set is the complete set of characters that are on the keyboard e. g. 1 2 3, a b c, ! ” £, and control characters. A control character is non-printable e. g. RETURN, TAB, ESCAPE, SPACE etc. They are the first 32 characters in ASCII. Marr College Higher Computing Slide 9

Unicode is a 16 -bit code (2 bytes) that supports 65, 536 characters Data

Unicode is a 16 -bit code (2 bytes) that supports 65, 536 characters Data Representation Advantages • A code for every character based alphabet in the world • Has codes for Chinese, Arabic etc. • Covers all punctuation marks and control characters Snapshot of German keyboard Marr College Higher Computing Slide 10

INT 2 Bitmapped graphics Any graphic is made up from a series of pixels

INT 2 Bitmapped graphics Any graphic is made up from a series of pixels (picture elements). Data Representation Each pixel is an individual dot on the screen. Pixel pattern using 8 x 8 grid The BIT MAP of the image In a monochrome graphic, each pixel is represented by either 0 - white Marr College OR 1 - black Higher Computing Slide 11

INT 2 Resolution The quality of the image depends on the number of pixels

INT 2 Resolution The quality of the image depends on the number of pixels Data Representation More pixels means higher resolution and clearer, sharper image. Pixel pattern using 8 x 8 grid Pixel pattern using 16 x 16 grid High resolution = many small pixels, larger file size Low resolution = larger pixels, smaller file size Marr College Higher Computing Slide 12

INT 2 Storage Each pixel requires 1 bit of storage. So, the more pixels

INT 2 Storage Each pixel requires 1 bit of storage. So, the more pixels used, the larger the file size. Data Representation Example 1 8 x 8 = 64 bits / 8 = 8 bytes File size of this graphic is 8 bytes Example 2 16 x 16 = 256 bits / 8 = 32 bytes File size of this graphic is 32 bytes Marr College Higher Computing Slide 13

Bit-depth and no. of colours up to 24 -bits (true colour) Bitmap graphics are

Bit-depth and no. of colours up to 24 -bits (true colour) Bitmap graphics are made up of pixels (dots) and each dot is stored as bits or bytes in memory. Data Representation Bit-depth is the number of bits used to represent shades of colours of a pixel. Colours Bits Bytes 2 1 1/ 8 16 4 1/ 2 256 8 1 65, 536 16 2 16, 777, 216 24 3 The more bits per pixel the more colours can be used - but file size will increase. Marr College Higher Computing Slide 14

Dots per inch (dpi) Dpi is a measure of how many pixels (dots) are

Dots per inch (dpi) Dpi is a measure of how many pixels (dots) are in an square inch. Printers and scanners state resolution in dpi. Data Representation Example The dimensions of an image are 4” x 6”, the resolution is 300 dpi and it is black and white. Calculate the file size. Formula: Pixels / bits = length x breadth x dpi 2 4 x 6 x 300 = 2, 160, 000 bits => 2160000 / 8 = 270, 000 bytes => 270, 000 = 263. 7 kilobytes File size of this graphic is 263. 7 bytes Marr College Higher Computing Slide 15

Bitmapped graphics Advantages ü Individual pixels can be edited Data Representation ü Complexity of

Bitmapped graphics Advantages ü Individual pixels can be edited Data Representation ü Complexity of image does not affect file size ü Can be compressed to JPEG, GIF or TIFF to reduce file size Disadvantages × Large file size e. g. 3 bytes per pixel × Individual objects cannot be edited Pixellated bitmap × Resolution dependent: low resolution = low quality × Image ‘pixellated’ when resized bigger Marr College Higher Computing Slide 16

Need for compression of bitmaps Bitmapped graphics often have a large file size. So.

Need for compression of bitmaps Bitmapped graphics often have a large file size. So. . . Data Representation A 1024 x 768 24 -bit colour graphic has a file size of 2. 25 Megabytes. An image of this size would be slow to transmit across a network or slow to download from the Internet. . Bitmaps can be compressed using compression algorithms into JPEG or GIF to reduce file size and enable faster transfer / download across networks. Marr College Higher Computing Slide 17

Need for compression of bitmaps JPEG (Joint Photographics Expert Group) Data Representation Lossy compression

Need for compression of bitmaps JPEG (Joint Photographics Expert Group) Data Representation Lossy compression algorithm where some pixel data is removed, but retains 24 -bit colour and minimal loss of quality to human eye – ideal for photographs. Marr College Higher Computing Slide 18

Need for compression of bitmaps GIF (Graphics Interchange Format) Data Representation Lossless compression algorithm

Need for compression of bitmaps GIF (Graphics Interchange Format) Data Representation Lossless compression algorithm where colour depth is reduced to 8 -bit resulting in 256 colours – ideal for clip art etc but not for photographs. Marr College Higher Computing Slide 19

Vectored graphics Vectors are stored as a description of the objects that make up

Vectored graphics Vectors are stored as a description of the objects that make up the graphic e. g. start x, start y, line thickness, fill colour etc. Data Representation Advantages ü Individual objects can be edited ü Objects can be grouped and manipulated as one ü Are resolution independent i. e. same quality regardless of resolution ü Do not lose quality when resized ü Small file size as values not stored for every pixel Disadvantages × Cannot be edited at pixel level × File size can be large if many objects / layers Marr College Higher Computing Slide 20