0% found this document useful (0 votes)
1 views

Coding System

Chapter 2 discusses the data coding system used in computers, explaining how data is represented using various number systems such as decimal, binary, octal, and hexadecimal. It outlines the significance of binary coding in computer operations and introduces several computer codes including BCD, ASCII, and EBCDIC. The chapter also includes a conversion table for these number systems and highlights the importance of understanding data representation in computing.

Uploaded by

Jay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Coding System

Chapter 2 discusses the data coding system used in computers, explaining how data is represented using various number systems such as decimal, binary, octal, and hexadecimal. It outlines the significance of binary coding in computer operations and introduces several computer codes including BCD, ASCII, and EBCDIC. The chapter also includes a conversion table for these number systems and highlights the importance of understanding data representation in computing.

Uploaded by

Jay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CHAPTER 2:

THE DATA CODING SYSTEM

Computers are constructed from electronic components that can be either on or off. Data is recorded in
computer as electronic signals in specific circuitry. Representing data within the computer is performed
by assigning a value to each group of components. These components can in one of two possible
conditions at any given time. For example, transistors are either conducting or non-conducting; switches
are either present or absent and so on. The values assigned to individual components or group of
components become the code for representing data. It uses some variations of the number system for
representing characters that may be in the form of letters, digits, or symbols. The number is a convenient
way of representing quantities as a set of symbols or codes.

The knowledge of data representation is helpful in investigating how temporary storage devices store
data and instructions. Moreover, it is also used in debugging programs, understanding how a computer
operates, and in selecting computer equipment

Objectives:
At the end of this chapter, you will be able to:
▪ Define base, weight, point, and binary point.
▪ Identify the various types of computer codes.
▪ Understand the least and most significant bit or digit in a number.
▪ Understand the step-by-step procedures in converting from one number system to another.

A. TYPES OF NUMBER SYSTEM

1. DECIMAL NUMBER SYSTEM — This is the most commonly used number system in the world. It uses
ten different characters to show the values of numbers. Because the system uses ten different
characters, it is called the base 10 system. The base of a number system tells you how many different
characters are used. The mathematical term for the base of a number system is radix. The symbols are
called Arabic numerals consisting of 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). The radix or the base of a
decimal system is ten (10).
2. BINARY NUMBER SYSTEM — In many ways, this system is simpler the decimal number system because
it uses only two characters. The binary number system is used in digital electronics because digital
circuits have only two states (two signal levels). Most of the time, 0 and 1 are the two characters used.
This is ideal for computer processing because the “1”is used to denote electrical pulse or signal and "0"
is used to denote the absence of such signal. The binary notations “0" and "1" are called bits, which is
acronym for BInary digiTs. Often when referring to binary you will hear the terms "LSB" (least
significant bit) and "MSB" (most significant bit). These are very much like terms we use when speaking
of decimal numbers. In decimal numbers we refer to most significant digit (MSD) and least significant
digit (LSD). The LSB is the bit with least weight. The MSB is the bit with the greatest weight. Normally,
binary numbers are shown with the MSB as the leftmost bit.
3. OCTAL NUMBER SYSTEM - This system is shorthand method for replacing groups of binary digits by
single octal digit to reduce the number of digits required in representing any number. It has a radix or
base of eight (8), consisting of 0, 1, 2, 3, 4, 5, 6, 7.
4. HEXADECIMAL NUMBER SYSTEM - refers to the base 16 number system in which 16 different
characters are used, consisting of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Why is the hexadecirnal numbering system used? We know that no electronic system uses 16 different
levels in the way that binary electronics uses two different levels. This system is not required by the

ES 02 – Computer Fundamentals and Programming Page 1


machines. It is a convenience for people. The hexadecimal numbering system is used in the world of
computers as a shorthand technique.

B. CONVERSION TABLE

Comparison table for decimal, binary, octal and hexadecimal numbers.


DECIMAL BINARY OCTAL HEXADECIMAL
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10

C. COMPUTER CODES

The internal circuitry of a computer needs to represent only binary ones and zeros in its operations.
However, several binary-based coding systems have been devised to express the machine language
instruction codes executed by the CPU and to represent the characters of data processed by the
computer. These computer codes make the job of communicating with a computer easier and more
efficient. They should be considered as shorthand methods of expressing the binary patterns within a
computer.

1. BCD (Binary Coded Decimal System) - A method to represent decimal numbers with 4-bit binary
words. BCD uses the words from 0000 to 1001 to represent the decimal numbers O to 9. It uses 0001
0000 to 1001 1001 to represent decimal numbers 10 to 99. Each decimal digit will be represented
using 4-bit binary word.

Decimal Number BCD


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000

ES 02 – Computer Fundamentals and Programming Page 2


9 1001
10 0001 0000
: :
99 1001 1001
100 001 0000 0000
: :
999 1001 1001 1001
1000 0001 0000 0000 0000
Decimal to BCD Conversion

2. ASCII (American Standard Code for Information Interchange)


It was established by the American national Standard Institute (ANSI) in 1962.

Parity bit
bit representing alpha, numeric and special character

This was originally a seven-bit code, which represented 128 (27) different characters. However, eight-bit
versions (sometimes called ASCII-8), which can represent 256 characters, are now widely used. ASCII is
a standardized code first developed for data communications between computers and input/output
devices. However, it is used by most microcomputers and minicomputers, as well as by many larger
computers. ASCII has been as a code by national and international standards organizations.
ASCII-8 was divided into three groups.
▪ ASCII control characters (character code 0-31) - The first 32 characters in the ASCII-table are
unprintable control codes and are used to control peripherals such as printers.
▪ ASCII printable characters (Character code 32-127) - Codes 32-127 are common for all the
different variations of the ASCII table, they are called printable characters, represent letters,
digits, punctuation marks, and a few miscellaneous symbols. You will find almost every character
on your keyboard. Character 127 represents the command DEL.
▪ The extended ASCII codes (character code 128-255) - There are several different variations of
the 8-bit ASCII table. Codes 129-159 contain the Microsoft@ Windows Latin-1 extended
characters.

3. EBCDIC (Extended BCD Interchange code)


This is used by IBM and some other mainframe and mini computers and can provide 256 (28) different
coding arrangements.
DEC OCT Hex BIN Symbol Description
32 040 20 00100000 Space
33 041 21 00100001 ! Exclamation mark
34 042 22 00100010 “ Double quotes (or speech marks)
35 043 23 00100011 # Number
36 044 24 00100100 $ Dollar
37 045 25 00100101 % Procenttecken
38 046 26 00100110 & Ampersand
39 047 27 00100111 ‘ Single quote
40 050 28 00101000 ( Open parenthesis (or open bracket)
41 051 29 00101001 ) Close parenthesis (or close bracket)
42 052 2A 00101010 * Asterisk
43 053 2B 00101011 + Plus

ES 02 – Computer Fundamentals and Programming Page 3


44 054 2C 00101100 , Comma
45 055 2D 00101101 - Hyphen
46 056 2E 00101110 . Period, dot or full stop
47 057 2F 00101111 / Slash or divide
48 060 30 00110000 0 Zero
49 061 31 00110001 1 One
50 062 32 00110010 2 Two
51 063 33 00110011 3 Three
52 064 34 00110100 4 Four
53 065 35 00110101 5 Five
54 066 36 00110110 6 Six
55 067 37 00110111 7 Seven
56 070 38 00111000 8 Eight
57 071 39 00111001 9 Nine
58 072 3A 00111010 : Colon
59 073 3B 00111011 ; Semicolon
60 074 3C 00111100 < Less than (or open angled bracket)
61 075 3D 00111101 = Equals
62 076 3E 00111110 > Greater than (or close angled bracket)
63 077 3F 00111111 ? Question mark
64 100 40 01000000 @ At symbol
65 101 41 01000001 A Uppercase A
66 102 42 01000010 B Uppercase B
67 103 43 01000011 C Uppercase C
68 104 44 01000100 D Uppercase D
69 105 45 01000101 E Uppercase E
70 106 46 01000110 F Uppercase F
71 107 47 01000111 G Uppercase G
72 110 48 01001000 H Uppercase H
73 111 49 01001001 I Uppercase I
74 112 4A 01001010 J Uppercase J
75 113 4B 01001011 K Uppercase K
76 114 4C 01001100 L Uppercase L
77 115 4D 01001101 M Uppercase M
78 116 4E 01001110 N Uppercase N
79 117 4F 01001111 O Uppercase O
80 120 50 01010000 P Uppercase P
81 121 51 01010001 Q Uppercase Q
82 122 52 01010010 R Uppercase R
83 123 53 01010011 S Uppercase S
84 124 54 01010100 T Uppercase T
85 125 55 01010101 U Uppercase U
86 126 56 01010110 V Uppercase V
87 127 57 01010111 W Uppercase W
88 130 58 01011000 X Uppercase X
89 131 59 01011001 Y Uppercase Y

ES 02 – Computer Fundamentals and Programming Page 4


90 132 5A 01011010 Z Uppercase Z
91 133 5B 01011011 [ Opening bracket
92 134 5C 01011100 \ Backslash
93 135 5D 01011101 ] Closing bracket
94 136 5E 01011110 ^ Caret – circumflex
95 137 5F 01011111 _ Underscore
96 140 60 01100000 ` Grave accent
97 141 61 01100001 a Lowercase a
98 142 62 01100010 b Lowercase b
99 143 63 01100011 C Lowercase c
100 144 64 01100100 d Lowercase d
101 145 65 01100101 e Lowercase e
102 146 66 01100110 f Lowercase f
103 147 67 01100111 g Lowercase g
104 150 68 01101000 h Lowercase h
105 151 69 01101001 i Lowercase i
106 152 6A 01101010 J Lowercase j
107 153 6B 01101011 k Lowercase k
108 154 6C 01101100 l Lowercase l
109 155 6D 01101101 m Lowercase m
110 156 6E 01101110 n Lowercase n
111 157 6F 01101111 o Lowercase o
112 160 70 01110000 p Lowercase p
113 161 71 0110001 q Lowercase q
114 162 72 01110010 r Lowercase r
115 163 73 01110011 s Lowercase s
116 164 74 01110100 t Lowercase t
117 165 75 01110101 u Lowercase u
118 166 76 01110110 v Lowercase v
119 167 77 01110111 w Lowercase w
120 170 78 01111000 x Lowercase x
121 171 79 01111001 y Lowercase y
122 172 7A 01111010 z Lowercase z
123 173 7B 01111011 { Opening brace
124 174 7C 01111100 | Vertical bar
125 175 7D 01111101 } Closing brace
126 176 7E 01111110 ~ Equivalency sign – tilde
127 177 7F 01111111 Delete

Example:

1. The following is a message encoded in ASCII-8. What is the message?


01001000 01000101 01001100 01010000
Solution: Convert each eight-code to its hex equivalent. The result is
48 45 4C 50
Now locate these hex values in the ASCII table given on the previous pages and determine the
character represented by each. The result are

ES 02 – Computer Fundamentals and Programming Page 5


H E L P

D. BITS, BYTES, KILOBYTES, MEGABYTES, GIGABYTES, TERABYTES. . .

These terms are usually used in the world of computing to describe disk space, or data storage space,
and system memory. For instance, just a few years ago people were describing hard drive space using
the term Megabytes. Today, Gigabytes is the most common term being used, to describe the size of a
hard drive. In the not so distant future, Terabyte will be common term. But what are they? This is where
it gets confusing because there are at least three accepted definitions of each term.

According to the IBM Dictionary of computing, when used to describe disk storage capacity, a megabyte
is 1,000,000 bytes in decimal notation. But when the term megabyte is used for real and virtual storage,
and channel volume, 2 to the 20th power or 1,048,576 bytes is the appropriate notation. According to
the Microsoft to the Microsoft Press Computer Dictionary, a megabyte means either 1,000,000 bytes or
1,048,576 bytes. According to Eric S. Raymond in the New Hacker’s Dictionary, a megabyte is always
1,048,576 bytes on the augment that bytes should naturally be computed in power of two. So which
definition do most people conform to?

When referring to a megabyte for disk storage, the hard drive manufacturers use the standard that a
megabyte is 1,000,000 bytes. This means that when you buy an 80 Gigabyte Hard drive you will get total
of 80,000,000,000 bytes of available storage.

This is where it gets confusing because Windows uses the 1,048,576byte rule so when you look at the
Windows drive properties an 80 Gigabyte drive will report a capacity of 74.56 Gigabytes and a 250
Gigabyte drive will only yield 232. Gigabytes of available storage space.

The 1000 can be replaced with 1024 and still be correct using the other acceptable standards. Both of
these standards are correct depending on what type of storage you are referring.

Processor or Virtual Storage Disk Storage


1 Bit = Binary Digit 1 Bit = Binary Digit
8 Bits = 1 Byte (28) 8 Bits = 1 Byte
1024 Bytes = 1 Kilobyte (KB) – (210) 1000 Bytes = 1 Kilobyte – (103)
1024 Kilobytes = 1 Megabyte (MB) – (220) 1000 Kilobytes = Megabyte – (106)
1024 Megabytes = 1 Gigabyte (GB) – (230) 1000 Megabytes = 1 Gigabyte – (109)
1024 Gigabytes = 1 Terabyte (TB) – (240) 1000 Gigabytes = 1 Terabyte – (1012)
1024 Terabytes = 1 Petabyte (PT) – (250) 1000 Terabytes = 1 Petabyte – (1015)
1024 Petabytes = 1 Exabyte (EB) – (260) 1000 Petabytes = 1 Exabyte – (1018)
1024 Exabytes = 1 Zettabyte – (270) 1000 Exabytes = 1 Zettabyte – (1021)
1024 Zettabytes = 1 Yottabyte (YB) – (280) 1000 Zettabytes = 1 Yottabyte – (1024)

Bit: A Bit is the smallest unit of data that a computer uses. It can be used to represent two states of
information, such as 1 or 0.

Byte: A byte is equal to 8 Bits. A Byte can represent 256 states of information, for example, numbers or
a combination of numbers and letters. 1 Byte could be equal to one character as discussed in ASCII-8
representation. 10 Bytes could be equal to a word. 100 bytes would be equal an average sentence.

Kilobyte: A Kilobyte is approximately 1,000 Bytes, actually 1,024 Bytes depending on which definition is
used. 1 Kilobyte would be equal to this paragraph you are reading, whereas 100 Kilobytes would equal
an entire page.

ES 02 – Computer Fundamentals and Programming Page 6


Megabyte: A Megabyte is approximately 1,000 Kilobytes. In the early days of computing, a Megabyte
was considered to be large amount of data. These days with a 500 Gigabyte hard drive on a computer
being common, a Megabyte doesn’t seem like much anymore. One of those old 3-1/2 inch floppy disks
can hold 1.44 Megabytes or the equivalent of a small book. 100 Megabytes might hold a couple volumes
of Encyclopedias. 600 Megabytes is about the amount of data that will fit on a CD-ROM disk.

Gigabytes: A Gigabyte is approximately 1,000 Megabytes. A Gigabyte is still a very common term used
these days when referring to disk space or drive storage. 1 Gigabyte of data is almost twice the amount
of data that a CD-ROM can hold. But it’s about one thousand times the capacity of 3-1/2 inch floppy disk.
1 Gigabyte could hold the contents of about 10 yards of books on a shelf. 100 Gigabytes could hold the
entire library floor of academic journals.

Terabyte: A Terabyte is approximately one trillion bytes, or 1,000 Gigabytes. To put it in some
perspective, a Terabyte could hold about 3.6 million 300 Kilobyte images or maybe about 300 hours of
good quality video. A Terabyte could hold 1,000 copies of the Encyclopedia Britannica. Ten Terabytes
could hold the printed collection of the Library of Congress. That’s a lot of data.

Petabyte: A Petabyte is approximately 1,000 Terabytes or one million Gigabytes. It’s hard to visualize
what a Petabyte could hold. 1 Petabyte could hold approximately 20 million 4-door filing cabinets full of
text. It could hold 500 billion pages of standard printed text. It would take about 500 million floppy disks
to store the same amount of data.

Exabyte: An Exabyte is approximately 1,000 Petabytes. Another way to look at it is that an Exabyte is
approximately one quintillion bytes or one billion Gigabytes. There is not much to compare an Exabyte
to. It has been said that 5 Exabytes would be equal to all of the words ever spoken by mankind.

Zettabyte: A Zettabyte is approximately 1,000 Exabytes. There is nothing to compare a Zettabyte to but
to say that it would take a whole lot of ones and zeroes to fill it up.

Yottabyte: A Yottabyte is approximately 1,000 Zettabytes. It would take approximately 11 trillion years
to download a Yottabyte file from the Internet using high-power broadband. You can compare it to the
World Wide Web as the entire Internet almost takes up about a Yottabyte.

Example:

1. How many bytes are in a 32-bit string (a string of 32 bits)?


Solution: 32/8 = 4,so there are four bytes in a 32-bit string
2. What is the largest decimal value that can be represented in binary using two bytes?
Solution: Two bytes is 16 bits, so the largest binary value will be equivalent to decimal
216 – 1 = 65,535
3. How many gigabytes do I have if I have 12000 megabytes?
Solution: 12000/1000 = 12GB
4. How many megabytes do I have if I have 4000 kilobytes?
Solution: 4000/1000 = 4MB

ES 02 – Computer Fundamentals and Programming Page 7


ES 02 – Computer Fundamentals and Programming Page 8

You might also like