Data Representation

DATA REPRESENTATION IN A COMPUTER.

Digital computers process data that is in discrete form

Analog computers process data that is continuous in nature.

Data and instructions cannot be entered and processed directly into computers using human language. Any type of data be it numbers, letters, special symbols, sound or pictures must be converted into machine readable form i.e binary form

Data representation in electronic circuits

The availability of a high voltage (on) in an electronic circuits is interpreted as ‘1’while a low voltage (off) is interpreted as ‘0’

Data representation on magnetic media

The presence of magnetic field in one direction on magnetic media is interpreted as ‘1’while the field in opposite direction is interpreted as ‘0’. Magnetic technology is mostly used on storage devices which are coated with special magnetic material such as iron oxide. Data is written on material by arranging the magnetic dipoles of some iron oxides particles to face in the same direction and some others in the opposite directions

Data representation on optical media

In optical devices the presences of light is interpreted as ‘1’ while its absences is interpreted as ‘0’. The reflected pattern of light from the rotating disk fall on receiving photoelectrict detector that transforms the pattern into digital form.

Computers handle data by electrical components, e.g. Transistors, Semiconductors, Integrated Circuits or wires, which exist in two conditions (states), ON OFF or “1” & “0”.

Inside the computer, data is represented by storage cells, which are either electronically charged or discharged.

Examples;

¨  In RAM, the cells can be charged and discharged at will, and this can be used to store different data items. The charged state of the cell can be represented by 1 (or ON), while the uncharged state by 0 (or OFF).

In ROM, the cells are permanently set to one state.

¨  A Transistor may be conducting or non-conducting.

¨  A Magnetic material may be magnetized in one direction or the other.

¨  A wire may or may not be carrying a current.

The Main memory of the computer can be considered as a collection of thousands of storage cells, each capable of representing a binary digit.

DATA TYPES.

Data is a term used to describe a set of facts. A single fact is known as Datum.

Data can be in 3 types or forms.

1.  Numeric data (numbers)

2.  Alphabetic data.

3.  Alphanumeric data.

Numbers:

Numbers can be expressed as either;

v  Integers - whole numbers, e.g., 124, -26, or

v  Real numbers - numbers with decimal points, e.g., 1.23, -2.6.

Note. A whole number is Real if it is written with a decimal point, e.g., 25 is an integer, but 25.0 is real.

Alphabetic data:

This is data made from combination of alphabetic characters, such as names, title, marital status, e.g. “John”, “Prof.”, “Married”.

Alphanumeric data (Strings):

A string is any sequence of characters.

This is data made from combination of alphabetic characters, numerals and/or special characters.

Examples;

Names - NG’ANG’A, ANN NDUVA

Address - P.O BOX 299, UGUNJA

Date - November 14, 1990

Account numbers - AO133

Department - Sales department

Messages - Incorrect. Try again

Exercise.

1.  Explain the terms Numeric and Alphanumeric. Illustrate your answers with appropriate examples.

THE BYTE.

The capacity of a computer memory can be measured in terms of Bits (individual memory cells), Bytes (groups of cells or bits) or Words (arrangement of the bytes).

v  A Bit (Binary digit) is the number 0 or 1 in the representation of a value in binary notation.

v  A Byte is a fixed number of adjacent bits that are operated on as a unit.

Usually, a byte is a group of 8 adjacent bits and can store one character, i.e. 1-byte stores 1 character.

The Byte is the most commonly used unit of measuring the capacity of a computer memory.

v  A Word is a group of bits that the computer recognizes and executes (processes) at a time.

To represent characters, the bits are combined together. The group of bits representing characters can also be described as Location.

In a Character machine, a location has 6 bits that represents a Byte, while the Byte machines has 8 bits making up a byte.

Character machines Byte machines.

6 bits = 1 byte 8 bits = 1 byte

12 bits = 2 bytes (½ Word) 16 bits =2 bytes (½ Word)

24 bits = 4 bytes (1 Word) 32 bits = 4 bytes (1 Word)

The memory capacity can be expressed as 32k, 64k, 256k, etc. The ‘K’ is a constant used to represent the Kilobyte, which is made up of 1,024 bytes.

Another unit that can be used to measure the memory is Megabyte (MB). MB is used to denote (stand for / represent / indicate) a million bytes, i.e. 1024 K is equivalent to 1MB.

Note. Half of a byte is described as a NIBBLE. A Nibble can be made up of 3 bits, for Character machines and 4 bits for the Byte machines.

Exercise.

1.  Data in a computer is represented in one major form. Define the term “Data representation” in a computer system.

2.  Define the following terms:

(i).  Bit.

(ii).  Byte.

(iii).  Character.

(iv).  Word.

3.  Explain the term “NIBBLES” as used in data representation in computers.

CODING OF DATA.

A computer can understand only one language consisting of two symbols, 0 & 1(Binary digits).

Since the computer cannot understand data represented in human languages (i.e. numerals 0 - 9, alphabets A – Z, and special symbols such as +, -, /, *, etc), it became necessary to change the data to binary form, a process known as Coding of data.

In other words, to make communication possible between computers and human beings, data must be coded in the form that can be understood by the computer and the information supplied by a computer (after processing) must be coded in the form that can be understood by the user.

The coding and decoding of data in a computer is done by the Input/Output devices.

Codes used in Computer systems.

Input Code converted to CPU Code converted

Computer Code by Input devices to Output Code by

Output devices

Data representation – The representation of normal data in some type of coded form, such as BCD, ASCII or EBCDIC.

NUMBER SYSTEMS.

The design and organization of a computer depends on the number system. The 4 number systems are:-

1.  Binary number system (Base 2).

2.  Octal number system (Base 8).

3.  Decimal number system (Base 10).

4.  Hexadecimal number system (Base 16).

Binary numbers are numbers to base 2, and use only two digits; 0 & 1.

Octal numbers, are numbers to base 8, and consists 8 digits (0 to 7).

The decimal number system consists of 10 digits, 0 to 9.

Hexadecimal numbers are numbers to base 16 and there must be 16 digits. The sixteen symbols used in the Hexadecimal system are; digits 0 to 9 & alphabets A to F.

Number System / Base / Digits and/or symbols represented
Binary / 2 / 0, 1
Octal / 8 / 0, 1, 2, 3, 4, 5, 6, 7
Decimal / 10 / 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal / 16 / 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

DECIMAL NUMBER SYSTEM.

The decimal number system consists of 10 digits, 0 to 9.

In decimal system, each digit has;

•  A Digit value (0 to 9).

•  A Positional value, which is determined by how many places to the left or the right of the decimal point the digit is written.

Note. The Digit value & Positional value for each number system depend on the base of the number system.

Powers of the base increase as we move to the left and decrease as we move to the right.

Summary for decimal number system (Integers only).

7th / 6th / 5th / 4th / 3rd / 2nd / 1st / Position
106 / 105 / 104 / 103 / 102 / 101 / 100 / Power base
1000000 / 100000 / 10000 / 1000 / 100 / 10 / 1 / Value

Summary for Integers as well as Real numbers.

4th / 3rd / 2nd / 1st / . / 1st / 2nd / 3rd / 4th / 5th / Position
103 / 102 / 101 / 100 / . / 10-1 / 10-2 / 10-3 / 10-4 / 10-5 / Power base
1000 / 100 / 10 / 1 / . / 1/10 / 1/100 / 1/1000 / 1/10000 / 1/100000 / Value

Decimal point.

The value of each digit in a number depends on the following:

(i).  The digit itself, i.e. the face value of the digit.

(ii).  The base of the number system.

(iii).  The position of the digit in the number.

Example,

Let us consider the number 8888. All the digits represent the same value of 8. However, the positional values are the absolute values multiplied by 10 raised to the positional power.

103 / 102 / 101 / 100
8 / 8 / 8 / 8

= (8x103) + (8x102) + (8x101) + (8x100)

= (8x1000) + (8x100) + (8x10) + (8x1)

= 8000 + 800 + 80 + 8

= 8888

Since the positional increment is a power of 10, the value 10 is known as the Base of the number system.

Therefore, the Base of a number system is the value whose positional power is used to represent another value. Therefore, in the decimal system, the base is 10.

Example 1. To represent 5621 in the decimal system, it will be:

103 / 102 / 101 / 100
5 / 6 / 2 / 1

= (5x103) + (6x102) + (2x101) + (1x100)

= (5x1000) + (6x100) + (2x10) + (1x1)

= 5000 + 600 + 20 + 1

= 5621

Note. In the Decimal system, the position value of each digit in a number increases 10 times as we move from right to left starting with the rightmost digit.

Example 2: Fractional numbers.

(i).  0.839

100 / 10-1 / 10-2 / 10-3
0 / · / 8 / 3 / 9

= (0x100 ) . (8x10-1) + (3x10-2) + (9x10-3)

= (0) . (8x1/101) + (3x1/102) + (9x1/103)

= (0). (8x1/10) + (3x1/100) + (9x1/1000)

= 0.8 + 0.03 + 0.009

= 0.839

(ii).  342.85

102 / 101 / 100 / 10-1 / 10-2
3 / 4 / 2 / · / 8 / 5

= (3x100) + (4x10) + (2x1) . (8x1/10) + (5x1/100)

= (300 + 40 + 2) + (0.8 + 0.05)

= 342.85

BINARY NUMBER SYSTEM.

Binary is the representation of data by only 2 possible conditions (i.e. combinations of 1 & 0).

Binary system is a number system that uses only two digits; 0 & 1. It has a base of 2, and is therefore called a Base-two system.

In the binary number system, the digits ‘1’ & ‘0’ are referred to as Bits (binary digits).

Exponential value / 25 / 24 / 23 / 22 / 21 / 20
Integer value / 32 / 16 / 8 / 4 / 2 / 0

It is clear that, the positional values of the numbers increase 2 times as we move from right to left. This is because the base is 2.

Points.

Bit (Binary digit) – The digit 0 or 1 in the representation of a value in Binary notation.

Binary numbers are very important in the design, organization, and understanding of computers.

The Binary system is more convenient because the computer storage systems are based on a 2- state principle (digits 1 & 0).

For example;

(i).  Magnetic storage media use the magnetic principles to imitate the states of 1’s 0’s.

A magnetized spot represents a 1, while the non-magnetized spot represents a 0.

(ii).  The computer’s Internal memory uses magnetic polarity in one direction to represent a ‘1’ and in the reverse direction to represent a ‘0’.

(iii).  The computer logical operations are also affected by pulse trains, where a pulse represents a ‘1’ and no pulse represent a ‘0’.

In addition, the Binary code is used only for mathematical applications (it is not intended to handle alphabetic data).

OCTAL NUMBER SYSTEM.

In Octal number system, there are only 8 possible digits (0 to 7).

Each digit (number) in base 8 has its place value determined by 8.

The position value of a digit increases to the left of the octal point in ascending powers of 8.

For example, 21638 can be expressed as:

83 / 82 / 81 / 80
2 / 1 / 6 / 3

Assign the powers to base 8.

Note. Octal number system is more popular with microprocessors, because the number represented in octal system can be used directly for input and output operations.

Complex binary numbers with several 1’s and 0’s can be conveniently handled in base 8. The binary digits are combined into groups of 3 (three), and each group is used to represent an individual octal digit.

HEXADECIMAL NUMBER SYSTEM.

In Hexadecimal number system, the base is 16 and there must be 16 digits.

The sixteen symbols used in the Hexadecimal system are; digits 0 to 9 alphabets A to F.

The equivalence between hexa-numbers and decimal numbers is as shown below:-

Decimal Hexadecimal.

10  A

11  B

12  C

13  D

14  E

15  F

Each digit in the Hex number system has its place value expressed in terms of 16.

E.g. the value 12A0 can be expressed as:

163 / 162 / 161 / 160
1 / 2 / A / 0

Assign the powers to base 16.