Module1-Number-System
Module1-Number-System
MODULE I
INTRODUCTION
OBJECTIVES
There are three lessons in the module. Read each lesson carefully
then answer the exercises/activities to find out how much you have
benefited from it. Work on these exercises carefully and submit your output
to your instructor or to the COE office.
Lesson 1
Number System
Binary Numbers
A decimal number such as 7,392 represents a quantity equal to 7
thousands, plus 3 hundreds, plus 9 tens, plus 2 units. The thousands,
hundreds, etc., are powers of 10 implied by the position of the coefficients
(symbols) in the number. To be more exact, 7,392 is a shorthand notation
for what should be written as
a5a4a3a2a1a0. a-1a-2a-3
The coefficients aj are any of the 10 digits (0, 1, 2, . . ., 9), and the
subscript value j gives the place value and, hence, the power of 10 by which
the coefficient must be multiplied. Thus, the preceding decimal number can
be expressed as
with a3 = 7, a2 = 3, a1 = 9, and a0 = 2.
coefficient aj is multiplied by a power of the radix, e.g., 2j, and the results
are added to obtain the decimal equivalent of the number. The radix point
(e.g., the decimal point when 10 is the radix) distinguishes positive powers
of 10 from negative powers of 10. For example, the decimal equivalent of
the binary number 11010.11 is 26.75, as shown from the multiplication of
the coefficients by powers of 2:
The coefficient values for base 5 can be only 0, 1, 2, 3, and 4. The octal
number system is a base‐8 system that has eight digits: 0, 1, 2, 3, 4, 5, 6, 7.
An example of an octal number is 127.4. To determine its equivalent
decimal value, we expand the number in a power series with a base of 8:
(110101)2 = 32 + 16 + 4 + 1 = (53)10
There are four 1’s in the binary number. The corresponding decimal number
is the sum of the four powers of two. Zero and the first 24 numbers obtained
from 2 to the power of n are listed in Table 1.1 . In computer work, 210 is
referred to as K (kilo), 220 as M (mega), 230 as G (giga), and 240 as T (tera).
Thus, 4K = 212 = 4,096 and 16M = 224 = 16,777,216. Computer capacity is
usually given in bytes. A byte is equal to eight bits and can accommodate
(i.e., represent the code of) one keyboard character. A computer hard disk
with four gigabytes of storage has a capacity of 4G = 232 bytes
(approximately 4 billion bytes). A terabyte is 1024 gigabytes, approximately
1 trillion bytes. Arithmetic operations with numbers in base r follow the
same rules as for decimal numbers. When a base other than the familiar
base 10 is used, one must be careful to use only the r‐allowable digits.
Examples of addition, subtraction, and multiplication of two binary numbers
are as follows:
The corresponding hexadecimal (or octal) digit for each group of binary
digits is easily remembered from the values listed in Table 1.2. Conversion
from octal or hexadecimal to binary is done by reversing the preceding
procedure. Each octal digit is converted to its three‐digit binary equivalent.
Similarly, each hexadecimal digit is converted to its four‐digit binary
equivalent. The procedure is illustrated in the following examples:
Complements of Numbers
Given a number N in base r having n digits, the (r - 1)’s complement
of N, i.e., its diminished radix complement, is defined as (rn - 1) - N. For
decimal numbers, r = 10 and r - 1 = 9, so the 9’s complement of N is (10n -
1) - N. In this case, 10n represents a number that consists of a single 1
followed by n 0’s. (10n – 1) is a number represented by n 9’s. For example, if
n = 4, we have 104 = 10,000 and 104 - 1 = 9999. It follows that the 9’s
complement of a decimal number is obtained by subtracting each digit from
9. Here are some numerical examples:
Radix Complement
The r’s complement of an n‐digit number N in base r is defined as rn - N for
N≠0 and as 0 for N = 0. Comparing with the (r - 1)’s complement, we note
that the r’s complement is obtained by adding 1 to the (r - 1)’s
complement, since rn - N = [(rn - 1) - N] + 1. Thus, the 10’s complement of
decimal 2389 is 7610 + 1 = 7611 and is obtained by adding 1 to the 9’s
complement value. The 2’s complement of binary 101100 is 010011 + 1 =
010100 and is obtained by adding 1 to the 1’s‐complement value. Since 10 is
a number represented by a 1 followed by n 0’s, 10n - N, which is the 10’s
complement of N, can be formed also by leaving all least significant 0’s
unchanged, subtracting the first nonzero least significant digit from 10, and
subtracting all higher significant digits from 9. Thus,
The 2’s complement of the first number is obtained by leaving the two least
significant 0’s and the first 1 unchanged and then replacing 1’s with 0’s and
0’s with 1’s in the other four most significant digits. The 2’s complement of
the second number is obtained by leaving the least significant 1 unchanged
and complementing all other digits.
In the previous definitions, it was assumed that the numbers did not
have a radix point. If the original number N contains a radix point, the point
should be removed temporarily in order to form the r’s or (r - 1)’s
complement. The radix point is then restored to the complemented number
in the same relative position. It is also worth mentioning that the
complement of the complement restores the number to its original
value. To see this relationship, note that the r’s complement of N is rn - N,
so that the complement of the complement is rn - (rn - N) = N and is equal to
the original number.
method works well when people perform subtraction with paper and pencil.
However, when subtraction is implemented with digital hardware, the
method is less efficient than the method that uses complements. The
subtraction of two n‐digit unsigned numbers M - N in base r can be done as
follows:
Lesson 2
Truth Tables
Truth tables are used to help show the function of a logic gate. If you are
unsure about truth tables and need guidence on how go about drawning
them for individual gates or logic circuits then use the truth table section
link.
Logic gates
Digital systems are said to be constructed by using logic gates. These gates
are the AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic
operations are described below with the aid of truth tables.
AND gate
The AND gate is an electronic circuit that gives a high output (1) only
if all its inputs are high. A dot (.) is used to show the AND operation
i.e. A.B. Bear in mind that this dot is sometimes omitted i.e. AB
OR gate
The OR gate is an electronic circuit that gives a high output (1) if one
or more of its inputs are high. A plus (+) is used to show the OR
operation.
NOT gate
NAND gate
NOR gate
The symbol is an OR gate with a small circle on the output. The small
circle represents inversion.
EXOR gate
EXNOR gate
The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will
give a low output if either, but not both, of its two inputs are high. The
symbol is an EXOR gate with a small circle on the output. The small circle
represents inversion.
The NAND and NOR gates are called universal functions since with either
one the AND and OR functions and NOT can be generated.
Note:
Example
A NAND gate can be used as a NOT gate using either of the following wiring
configurations.
Lesson 3
As well as the logic symbols “0” and “1” being used to represent a digital
input or output, we can also use them as constants for a permanently
“Open” or “Closed” circuit or contact respectively.
A set of rules or Laws of Boolean Algebra expressions have been invented to
help reduce the number of logic gates needed to perform a particular logic
operation resulting in a list of functions or theorems known commonly as
the Laws of Boolean Algebra.
Boolean Algebra is the mathematics we use to analyse digital gates and
circuits. We can use these “Laws of Boolean” to both reduce and simplify a
complex Boolean expression in an attempt to reduce the number of logic
gates required. Boolean Algebra is therefore a system of mathematics based
on logic that has its own set of rules or laws which are used to define and
reduce Boolean expressions.
The variables used in Boolean Algebra only have one of two possible values,
a logic “0” and a logic “1” but an expression can have an infinite number of
variables all labelled individually to represent inputs to the expression, For
example, variables A, B, C etc, giving us a logical expression of A + B = C,
but each variable can ONLY be a 0 or a 1.
Examples of these individual laws of Boolean, rules and theorems for
Boolean Algebra are given in the following table.
A in parallel with
A+1=1 Annulment
closed = “CLOSED”
A in parallel with
A+0=A Identity
open = “A”
A in series with
A.1=A Identity
closed = “A”
A in series with
A.0=0 Annulment
open = “OPEN”
A in parallel with
A+A=A Idempotent
A = “A”
A in series with
A.A=A Idempotent
A = “A”
NOT NOT A
NOT A = A Double Negation
(double negative) = “A”
A in parallel with
A+A=1 Complement
NOT A = “CLOSED”
A in series with
A.A=0 Complement
NOT A = “OPEN”
A in parallel with B =
A+B = B+A Commutative
B in parallel with A
A in series with B=
A.B = B.A Commutative
B in series with A
Annulment Law – A term AND´ed with a “0” equals 0 or OR´ed with a “1”
will equal 1
Identity
Law – A term OR´ed with a “0” or AND´ed with a “1” will always
equal that term
Complement Law – A term AND´ed with its complement equals “0” and a
term OR´ed with its complement equals “1”
Distributive
Law – This law permits the multiplying or factoring out of an
expression.
LEARNING ACTIVITY
Present the truth table for 3-input and AND and 3-input OR
gates.
MODULE SUMMARY
Congratulations! You have just studied Module I. now you are ready
to evaluate how much you have benefited from your reading by answering
the summative test. Good Luck!!!
SUMMATIVE TEST
1. What is the largest binary number that can be expressed with 14 bits?
What are the equivalent decimal and hexadecimal numbers?
2. Convert decimal number 431 in two ways: (a) Convert directly to
binary; (b) convert first to hexadecimal and then from hexadecimal
to binary. Which method is faster?
3. Obtain the 1’s and 2’s complements of the following binary numbers:
a. 10000000
b. 00000000
c. 11011010
d. 01110110
e. 10000101
f. 11111111
4. Find the 9’s and the 10’s complement of the following decimal
number:
a. 52,784,630
b. 63,325,600
c. 25,000,000
d. 00,000,000
5. (a) Find the 16’s complement of B2FA.
(b) Convert B2FA to binary.
(c) Find the 2’s complement of the result in b.
(d) Convert the answer in (c) to hexadecimal and compare with the
answer in (a).
6. Perform subtraction on the given unsigned numbers using 10’s
complement of the subtrahend. When the result should be negative,
find its 10’s complement and affix a minus sign. Verify your answers.
a. 6,428 – 3,409
b. 125 – 1,800
c. 2,043 – 6,152
d. 1,631 – 745
7. Decode the following in ASCII code: