760 likes | 917 Views
COMPUTING (Higher). Unit 1 Computer Systems Topic 1 – Data Representation. DATA REPRESENTATION Systems Booklet - Pages 3-9. Computers can store three main types of data: Numbers, Text Graphics.
E N D
COMPUTING(Higher) Unit 1 Computer Systems Topic 1 – Data Representation
DATA REPRESENTATIONSystems Booklet - Pages 3-9 • Computers can store three main types of data: • Numbers, • Text • Graphics. • These types of data require to be manipulated by computers and as such, they must be represented in a form the computer can understand and use. • Computers ability to perform very complex calculations at high speeds remains one of their main uses.
Text processing is also a major function of computers. From the storage of vast quantities of names and addresses in large databases to using a word-processor, text handling is of vital importance to today’s computers. • Storage of graphics has more recently become important because of the widespread use of desktop publishing and computer-aided design. • All of this information is translated into numbers for storage within the computer.
Bit, Byte and Word • A bit is a binary digit. A binary digit can be either a 1 (one) or a 0 (zero). • A byte is a group of 8 bits. • A word is a group of bits that can be addressed, transferred and manipulated in one operation by the CPU. Computers typically work with 32 bit or 64 bit words. • For example, a computer with a 32 bit word size would be able to store 32 bits in each memory location.
Representing text • Text is found in many different types of data files: in word-processing files, database files, graphics files and spreadsheet files. • Text is represented by a binary code. There are 2 codes commonly used to represent text. • One is called UNICODE • The other is ASCII code. ASCII stands for: A merican S tandard C ode for I nformation I nterchange
Character sets • The character set of a computer is the complete set of characters that the computer can produce. • It includes all the letters of the alphabet (both upper case and lower case), the digits 0 to 9, punctuation marks, special symbols such as &, %, £ and control characters. • Keys such as RETURN, TAB and DELETE that control a particular function are known as control characters.
In the ASCII code, an 8 bit binary number represents each character in the character set. This allows 128 different characters / symbols to be represented. • . • Whenever a key is pressed on the keyboard, the system recognises the key and stores its ASCII code value. • The table below shows a few of the ASCII code values.
Here is a word translated into the ASCII code: This pattern of 4 x 8-bit binary codes is what would be stored in memory to represent the word FACE.
Unicode • Unicode exists because of the need to represent non-Latin characters in computers e.g. Japanese and Chinese • Its characters are encoded using 16 bits. This allows it to represent up to 65,536 symbols. • Many packages, including Microsoft Office store documents in Unicode.
ASCII v UNICODE • Unicode has a much wider range of characters available compared to ASCII • 65,536 v 256 • ASCII normally takes up less memory. • Unicode is designed to be used for languages other than Latin type languages. • Unicode is an accepted world standard, used by most major computer manufacturers / software companies.
Representing numbers • In everyday life, we use the decimal number system for counting. This is made up of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and builds up in units of ten: 10, 20, 30, 40 and so on. • The columns used in the decimal system are those we are familiar with from our days in the primary school: • Thousands Hundreds Tens Units • and so on
The decimal number 4738 means: In other words, 4738 = 4 x 1000 + 7 x 100 + 3 x 10 + 8 x 1 The column headings used in the decimal system are used because they are the powers of 10. To get the next column heading as we go from right to left, we multiply the previous column heading by 10.
Computers use the much simpler binary number system. In the binary system, all numbers are made up of combinations of the digits 0 and 1. • Binary numbers work in a similar way to the decimal system. • Instead of being based on powers of 10, the binary system is based on powers of 2. • To get the next column heading as we go from right to left, we multiply the previous column heading by 2. • The column headings are:
Consider the binary number 1001. To work out the decimal equivalent of this number, place the binary digits under the correct column heading working from right to left. In other words, the binary number 1001 is the same as the decimal number 9.
Consider a second example: the binary number 10101 In other words, the binary number 10101 is the same as the decimal number 21.
If larger numbers are required, additional binary columns must be used - remember to work from right to left. The table below shows the first eight binary columns. 128 64 32 16 8 4 2 Units 7 6 5 4 3 2 1 0 2 2 2 2 2 2 2 2 We can use this table to find the binary equivalent of the decimal number 69.
Why computers use binary • Binary is used in computers because: • · Computers use switches, and switches are set ONand OFF: This matches the binary values of 1 and 0. • · The rules of binary arithmetic are simple. (Compare the number of rules for addition of binary (4) with addition of Decimal (100)) • · With only 2 states existing for any piece of information, electrical variations are less important. (E.G. Something and Nothing) • The problem with this is that the larger a number is the more binary columns it needs – and the more binary columns it needs, the more storage space it takes up in memory.
Representation of Negative Integers • The representation of negative integers (whole numbers) in a computer is a complex problem. There are two main methods of representing integers so that both positive and negative numbers can be shown. These are called: • · Signed Bit and • · Two’s Complement • The simplest method is Signed Bit (also called sign and magnitude).
Signed Bit • This method makes use of 1 bit (Most Significant Bit) to represent the signed bit. (Magnitude) The sign bit is • · 1 for negative and • · 0 for positive. • The rest of the digits show the magnitude of the number. For example, to show both +5 and -5 as 8-bit binary numbers using this method: - • +5 = 0000 0101 • -5 = 1000 0101 • In each case the left-most bit is the sign bit, the other seven digits represent the value 5.
Two’s Complement • The second method of representing negative numbers is two’s complement. To calculate two’s complement of an integer involves inverting (reversing) all the bits of the binary pattern (to find the one’s complement) then adding 1. • For example, to find the two’s complement of the number: • 0101
Rules for binary addition • There are only four rules required for adding binary numbers. These are shown below: • 0+0=0 • 1+0=1 • 0+1=1 • 1+1=0 (with a carry of 1)
Invert all the digits to find the one’s complement: • 0101 1010 • Then add 1 1010 1011 • Using two’s complement the sign bit is · 1 for negative and · 0 for positive. • Using the same examples as before,, +5 and -5 in 8-bit notation would be shown as: • +5 = 0000 0101 • -5 = 1111 1011 • Note that positive numbers are the same using signed bit or two’s complement method but NEGATIVE NUMBERSare different.
Which One Is Best? • The signed bit method is not used very often as it has two main disadvantages: - • Signed bit has 2 values for zero, +0 and –0 • Signed bit does not always give a logical sequence of numbers when adding 1 to a number. • (E.g. O111=+7, • 1000= -0)
Fractions In Binary • A fixed-point number is a number that is represented by a set of digits with the point in the correct position. • E.g. • 146.98 is a fixed point decimal number. • 11101.101 is a fixed point binary number. • The binary digits after the point (Fractions) are calculated using the same method as integers. In this case the digits after the point represent 1/21/41/81/16 etc. • E.G. What value does 101.101 have in decimal?
E.G. What value does 101.101 have in decimal? (1*4)+(1*1)+(1*1/2)+(1*1/8) = 5 5/8 (or 5.625)
e m x b Where m i s called the mantissa b is the base e is the exponent Floating Point Representation • Computers have to store real numbers. (i.e. numbers with a decimal point) • These numbers are stored in FLOATING POINT FORMAT. So called, as the point floats (changes) position in the number. • This is shown using the formula
For example, a decimal number such as 987654321 would be stored as • 0.987654321 x 109. • 0. 987654321 is the MANTISSA • 10 is the BASE and • 9 is the EXPONENT. • In a computer, binary numbers are used. A binary stored in floating point form might be: • .11010110 10010100 x 2 11110110
· The size of the M affects the ANTISSA accuracy of the number stored. · The size of the E affects the range XPONENT of the number stored. Remember !!!
Quick Revision onSizes • Remember that: • Bit smallest unit (1 or 0) • Byte 8 Bits • Kilobyte(Kb) 1024 Bytes • Megabyte(Mb) 1024 Kb • Gigabyte(Gb) 1024 Mb • Terabyte (Tb) 1024 Gb
Representing Graphics • Graphics are made up of pixels. • A pixel (or picture element) is a point on the screen. The quality of a graphical image depends on the number of pixels used to produce the screen display. The greater the number of pixels, the clearer the image will be. The term resolution is used to measure the number of pixels on a screen. The higher the resolution, the clearer and more precisely defined the image is.
Bit Mapped Graphics • In a black and white system, a single bit (a 1 or a 0) is used to represent each pixel. • If the pixel is shaded, a 1 represents it; • if the pixel is blank, a 0 represents it. It is easy to see how the pixels can be translated into the pattern of binary numbers on the left.
This pattern of binary numbers is called a bit map. Each bit that is used to represent a graphical image must be stored in the computer’s memory. • The higher the resolution, the more bits are used to encode the graphic and the more memory space is needed. • When colour is introduced, the memory requirements to store the details of each pixel must be increased. For example, two bits can store four colours: 00 Black • 01 Red • 10 Yellow • 11 White • Similarly, eight bits (1 Byte) can store 256 colours, with 24 bits (3 bytes) allowing 16777216 colours (Known as true colour).
No of Bytes is Pixels Across Pixels down Total Pixels x Bit depth 6 x 500 4 x 500 24 x 250,000 = 6,000,000 6,000,000 x 1 byte = 6,000,000 bytes = 5859Kb or 5.7 Mb Calculating Bit Mapped Storage Requirements • To do this we need to know the • size of the image, • resolution and • bit depth. • E.g. Size – usually inches e.g. 6” x 4” • Resolution – say 500 dpi (pixels per inch) • Bit Depth – e.g. 1 byte for 256 colours
Data Compression • As we have just seen, Bit-mapped images can need a lot of storage. • A colour bit–mapped image with a high resolution and 24 bit colour needs over 50Mb for a smallish photo. • To combat this, File Compression is used to reduce storage requirements. • There are many Different techniques, including coding using an index of colours actually used (Lossless Compression) and not coding differences indistinguishable to the human eye (Lossy Compression).
JPEG Compression • uses Lossy compression • Uses complex mathematical encoding • Loses some information that our eyes and brain usually ignore • The higher the compression ratio – the worse the resulting image is
JPEG Compression ← Saved using lowest compression ratio File size = 1Mb Saved using highest compression ratio → File size = 94Kb
Vector (Object Oriented) Graphics • In draw packages (Object Oriented packages), objects are stored with their attributes. This means the computer is aware of the type of the shape being displayed and is therefore able to resize it more accurately For example, when a rectangle is drawn, the package stores • Rectangle (StartX, StartY, Length, Breadth, Line Thickness, Fill Colour, Pen Colour...)
Other examples could include • Circle (CentreX, CentreY, Radius, Line • Thickness, Fill Colour, Pen Colour ...) • Line (StartX, StartY, EndX, EndY, Line Thickness, Line Colour ...) • Text (StartX, StartY, font, size, style, characters, ...)
Bit Mapped V Vector Graphics
VECTOR GRAPHICS ADVANTAGES Objects can be edited independently of the other objects. Less Storage space required than for the same image in bit-mapped form. Objects can be layered, without affecting other objects. Objects are easier to draw. Not resolution dependent. DISADVANTAGES Can only use mathematically defined shapes. Not as detailed images as bit mapped. Bit Mapped V Vector Graphics
BIT MAPPED GRAPHICS • ADVANTAGES • Better quality pictures. • Allows freehand drawing • DISADVANTAGES • Resolution dependent. • More Storage space required than for the same image in Vector form. (Saves full screen at all times) • When one part of image is placed on top of another (layering), the part of the image being covered is deleted. (Single dimension image) • No resizing of individual objects permitted.
COMPUTING(Higher) Unit 1 Computer Systems Topic 1 – Data Representation
CATEGORIES OFCOMPUTERSSystems Booklet - Pages 10-12 • Computers are normally classified into these categories: • Mainframe - A high-level computer designed for the most intensive computational tasks. • Desktop Computer - Sometimes known as a personal computer, this is a compact system that can fit on your desk at home, work, or school. • Laptop Computer — A computer system designed to be portable, but can still as powerful as desktop systems.
Palmtop Computer — A pocket sized computer, tend to run applications that are useful to individuals, eg diary, address book, calculator, etc. • Embedded Computer — Hardware and software to do a specific function, e.g. in a washing machine. Always part of a larger system, and works in real-time • Networked Computer - A computer (usually a micro) that has access to a network. Networked computers have their own processor and memory and have access to a file server for programs and data. There are 2 main types of network: • Local Area Networks (LAN) and • Wide Area Networks (WAN). Desktop, Laptop, Palmtop and Networked Computers can be classified as types of microcomputers.
Processing Power • The clock speed of the processor is the main indicator of the power of the processor. • It is measured in MHz (Megahertz) or GHz (Gigahertz). • 1 Megahertz is one million clock pulses per second. • 1 Gigahertz is one thousand million clock pulses per second
Computer OrganisationSystems Booklet - Pages 14-18 • Figure 1: Computer Block Diagram 1 PROCESSOR OUTPUT INPUT MEMORY BACKING STORE
INPUT BACKING STORAGE OUTPUT Keyboard Hard Disc Monitor Mouse Floppy Disc Printer Joystick Tape Speakers Scanner CD - ROM Plotter Light Pen Optical Disc Motor (Robot) • Table 1: Common Devices
ROM RAM • Figure 2: Computer Block Diagram 2 PROCESSOR INPUT OUTPUT MEMORY BACKING STORE
Computer Memory • Two types of internal (immediate access) memory exist: • RAM • ROM.