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

Lecture 2- CSC303

The document provides an overview of number systems including decimal, binary, octal, and hexadecimal, detailing their bases and conversion methods. It also explains Boolean Algebra, focusing on logical functions, truth tables, and the behavior of AND, OR, and NOT gates. Examples illustrate the conversion processes between different number systems and the representation of logical operations in circuits.

Uploaded by

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

Lecture 2- CSC303

The document provides an overview of number systems including decimal, binary, octal, and hexadecimal, detailing their bases and conversion methods. It also explains Boolean Algebra, focusing on logical functions, truth tables, and the behavior of AND, OR, and NOT gates. Examples illustrate the conversion processes between different number systems and the representation of logical operations in circuits.

Uploaded by

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

Revision: Number systems and their representation

A number system is a set of symbols used to represent values derived from a


common base or radix.
For the purpose of this class, number systems can be classified into a followi
major categories:
1. decimal number system - Base 10
2. binary number system - Base 2
3. octal number system - Base 8
4. hexadecimal number system - Base 16

Binary number system


It uses two digits namely, 1 and 0 to represent numbers. unlike in decimal
numbers where the place value goes up in factors of ten, in binary system, the
place values increase by the factor of 2. binary numbers are written as
X2.consider a binary number such as 10112.The right most digit has a place
value of 1×20 while the left most has a place value of 1×23.

Octal number systema

Consists of eight digits ranging from 0-7.the place value of octal numbers goes
up in factors of eight from right to left.

Hexadecimal number system


This is a base 16 number system that consists of sixteen digits ranging from 0-9
and letters A-F where A is equivalent to 10,B to 11 up to F which is equivalent
to 15 in base ten system. The place value of hexadecimal numbers goes up in
factors of sixteen.

• A hexadecimal number can be denoted using 16 as a subscript or capital


letter H to the right of the number. For example, 94B can be written as
94B16 or 94BH.

Further conversion of numbers from one number system to another

• To convert numbers from one system to another. the following


conversions will be considered.

• Converting between binary and decimal numbers.


• Converting octal numbers to decimal and binary form.
• Converting hexadecimal numbers to decimal and binary form.
1. a) Conversion between binary and decimal number
2. Converting binary numbers to decimal numbers

• To convert a binary number to a decimal number, we proceed as follows:

• First, write the place values starting from the right hand side.
• Write each digit under its place value.
• Multiply each digit by its corresponding place value.
• Add up the products. The answer will be the decimal number in base ten.

EXAMPLE

Convert 1011012 to base 10(or decimal) number

Place value 25 24 23 22 21 20
Binary digits 1 0 1 1 0 1

Multiply each digit by its place value

N10=(1*25) +(0*24)+(1*23)+(1*22)+(0*21)+(1*20)

N10=32+0+8+4+0+1

=4510

32*1=32

16*0=0

8*1=8 4*1=4

2*0=0

1*1=1

=4510

NB: remember to indicate the base subscript since it is the value that
distinguishes the different systems.

• The binary equivalent of the fractional part is extracted from the products
by reading the respective integral digits from the top downwards as
shown by the arrow next page.
• Combine the two parts together to set the binary equivalent.

Convert 0.37510 into binary form

Read this digit

0.375×2=0.750

0.750×2=1.500

0.500×2=1.000 (fraction becomes zero)

Therefore 0.37510=0.0112

NB: When converting a real number from binary to decimal, work out the
integral part and the fractional parts separately then combine them.

Example

Convert 11.0112 to a decimal number.

Solution

Convert the integral and the fractional parts separately then add them up.

2×1= 2.000

1×1= +1.000

3.00010

Weight 21 20 . 2-1 2-2 2-3


Binary digit 1 1 .0 1 1
Values in base 10 2 1 . 0 0.25 0.125

0.50×0 =0.000

0.25×1 =0.250

0.125×1=+0.125

0.37510

3.00010+0.37510= 3.37510
Thus 11.0112=3.37510

1. iv) Converting a decimal fraction to binary

Divide the integral part continuously by 2.For the fractional part, proceed as
follows:

Multiply the fractional part by 2 and note down the product

• Take the fractional part of the immediate product and multiply it by 2


again.
• Continue this process until the fractional part of the subsequent product is
0 or starts to repeat itself.

Example

o The following examples illustrate how to convert hexadecimal number to


a decimal numberExample

Convert octal number 3218 to its binary equivalent

Solution

Working from left to the right, each octal number is represented using
three digits and then combined we get the final binary equivalent.
Therefore:

3=0112

2=0102

1=0012

Combining the three from left to right

3 2 1
011 010 001

3218 =0110100012

Converting binary numbers to hexadecimal numbers

▪ To convert binary numbers to their binary equivalents, simply group the


digits of the binary number into groups of four from right to left e.g.
11010001.The next step is to write the hexadecimal equivalent of each
group e.g.

1101- D

0001- 1

The equivalent of 11010001 is D1H or D116

Converting hexadecimal numbers to decimal and binary numbers.

Converting hexadecimal numbers to decimal number

▪ To convert hexadecimal number to base 10 equivalent we proceed as


follows:
▪ First, write the place values starting from the right hand side.
▪ If a digit is a letter such as ‘A’ write its decimal equivalent
▪ Multiply each hexadecimal digit with its corresponding place value and
then add the products

The binary equivalent of the fractional part is extracted from the products
by reading the respective integral digits from the top downwards as
shown by the arrow next pag

• Combine the two parts together to set the binary equivalent.

Convert 0.37510 into binary form

Read this digits

0.375×2=0.750

0.750×2=1.500

0.500×2=1.000 (fraction becomes zero)

Therefore 0.37510=0.0112

Converting octal numbers to decimal and binary numbers

Converting octal numbers to decimal numbers

• To convert a base 8 number to its decimal equivalent we use the same


method as we did with binary numbers. However, it is important to note
that the maximum absolute value of a octal digit is 7.For example 982 Is
not a valid octal number because digit 9 is not an octal digit, but 7368 is
valid because all the digits are in the range 0-7.Example shows how to
convert an octal number to a decimal number.

Example 1.13

Convert 5128 to its base 10 equivalent

Solution

Place value 82 81 80
64 8 1
Octal digit 5 1 2

Write each number under its place value as shown below

Multiply each number by its place value.

N10=(5 x 82)+(1 x 81 )+(2 x 80 )

=(5 x 64)+8+2

=320+8+2

N10=33010

64 x 5=320

8 x 1= 8

1 x 2=+ 2

330

Therefore5128 =33010

Converting octal numbers to binary numbers

• To convert an octal number to binary, each digit is represented by three


binary digits because the maximum octal digit i.e. 7 can be represented
with a maximum of seven digits. See table:

Octal digit Binary equivalents


0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

Example

Convert the hexadecimal number 11116 to its binary equivalent.

Solution

Place each number under its place value.

162 161 160


1 1 1

256 x1= 256

16 x 1 = 16

1 x 1= + 1

273

Therefore 11116 =27310

Example

Convert octal number 3218 to its binary equivalent

Solution

Working from left to the right, each octal number is represented using three
digits and then combined we get the final binary equivalent. Therefore:

3=0112

2=0102
1=0012

Combining the three from left to right

3 2 1
011 010 001

3218 =0110100012

Converting binary numbers to hexadecimal numbers

To convert binary numbers to their binary equivalents, simply group the digits
of the binary number into groups of four from right to left e.g. 11010001.The
next step is to write the hexadecimal equivalent of each group e.g.

1101- D

0001- 1

The equivalent of 11010001 is D1H or D116

Converting hexadecimal numbers to decimal and binary numbers.

Converting hexadecimal numbers to decimal number

To convert hexadecimal number to base 10 equivalent we proceed as follows:

First, write the place values starting from the right hand side.

1. If a digit is a letter such as ‘A’ write its decimal equivalent

• Multiply each hexadecimal digit with its corresponding place value and
then add the products

• The following examples illustrate how to convert hexadecimal number to


a decimal number

Example

Convert the hexadecimal number 11116 to its binary equivalent

Solution

Place each number under its place value.


162 161 160
1 1 1

256 x1= 256

16 x 1 = 16

1 x 1= + 1

273

Therefore 11116 =27310

Converting hexadecimal numbers to binary numbers

• Since F is equivalent to a binary number11112 the hexadecimal number


are therefore represented using4 digits as shown in the table below

Hexadecimal digit Decimal equivalent Binary equivalent


00 00 0000
01 01 0001
02 02 0010
03 03 0011
04 04 0100
05 05 0101
06 06 0110
07 07 0111
08 08 1000
09 09 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
The simplest method of converting a hexadecimal number to binary is to
express each hexadecimal digit as a four bit binary digit number and then
arranging the group according to their corresponding positions as shown in
example

Example 1

Convert 32116

Hexadecimal digit 3 2 1
Binary equivalent 0011 0010 0001

Combining the three sets of bits, we get 0011001000012

32116 = 0011001000012

Example 2

Convert 5E616 into binary

Hexadecimal digit

5 E 6
Binary equivalent 0101 1110 0110

5E616 = 0101111001102
Revision: Boolean Algebra Truth Tables
Boolean Algebra is based around logical functions in which each Boolean
function, such as the logic AND function, typically has one or more input
values and produces an output result based on these input values. The inputs
have one of two values: 0 or 1.
In 1854, George Boole performed an investigation into the “laws of thought”
which were based around a simplified version of the “group” or “set” theory,
and from this Boolean Algebra was developed. Boolean Algebra deals mainly
with the theory that both logic and set operations are either “TRUE” or
“FALSE” but not both at the same time.
Boolean Algebra Expressions can be used to construct digital logic truth tables
for their respective functions
As well as a standard Boolean Expression, the input and output information of
any Logic Gate or circuit can be plotted into standard Boolean Algebra truth
tables to give a visual representation of the switching function of the system.
The table used to represent the Boolean expression of a logic gate function is
commonly called a Truth Table. A logic gate truth table shows each possible
input combination to the gate or circuit with the resultant output depending
upon the combination of these input(s).
For example, consider a single 2-input logic circuit with input variables
labelled as A and B. There are “four” possible input combinations or 22 of
“OFF” and “ON” for the two inputs. However, when dealing with Boolean
expressions and especially logic gate truth tables, we do not general use “ON”
or “OFF” but instead give them bit values which represent a logic level “1” or a
logic level “0” respectively.
Then the four possible combinations of A and B for a 2-input logic gate is given
as:
• Input Combination 1. – “OFF” – “OFF” or ( 0, 0 )
• Input Combination 2. – “OFF” – “ON” or ( 0, 1 )
• Input Combination 3. – “ON” – “OFF” or ( 1, 0 )
• Input Combination 4. – “ON” – “ON” or ( 1, 1 )
Therefore, a 3-input logic circuit would have 8 possible input combinations or
23 and a 4-input logic circuit would have 16 or 24, and so on as the number of
inputs increases. Then a logic circuit with “n” number of inputs would
have 2n possible input combinations of both “OFF” and “ON”.
Boolean Algebra Truth Tables For A 2-input AND Gate
For a 2-input AND gate, the output Q is true if BOTH input A “AND”
input B are both true, giving the Boolean Expression of: ( Q = A and B ).

Symbol Truth Table

A B Q

0 0 0

0 1 0

1 0 0

1 1 1

Boolean Expression Q = A.B Read as A AND B gives Q

Note that the Boolean Expression for a two input AND gate can be written
as: A.B or just simply AB without the decimal point.
Boolean Algebra Truth Tables For A 2-input OR Gate
For a 2-input OR (Inclusive-OR) gate, the output Q is true if EITHER
input A “OR” input B is true, giving the Boolean Expression of: (Q = A or B).

Symbol Truth Table

A B Q

0 0 0

0 1 1

1 0 1

1 1 1

Boolean Expression Q = A+B Read as A OR B gives Q


Switch Representation of the AND Function

Here the two switches, A and B are connected together to form a series circuit.
Therefore, in the circuit above, both switch A AND switch B must be closed
(Logic “1”) in order to put the lamp on. In other words, both switches must be
closed, or at logic “1” for the lamp to be “ON”.
In Boolean Algebra terms the output will be TRUE only when all of its inputs
are TRUE. In electrical terms, the logic AND function is equal to a series circuit
as shown above.

Switch Representation of the OR Function

Here the two switches A and B are connected in parallel and either
Switch A OR Switch B can be closed in order to put the lamp on. In other
words, either switch can be closed, or at logic “1” for the lamp to be “ON”.
Boolean Algebra terms the output will be TRUE when any of its inputs
are TRUE. In electrical terms, the logic OR function is equal to a parallel
circuit.
Boolean Algebra Truth Tables For The NOT Gate
For a single input NOT (Inverter) gate, the output Q is ONLY true when the
input is “NOT” true, the output is the inverse or complement of the input giving
the Boolean Expression of: ( Q = NOT A ).

The NAND and the NOR Gates are a combination of the AND and OR Gates
respectively with that of a NOT Gate (inverter).

Switch Representation of the Logic NOT Function


2-input NAND (Not AND) Gate
For a 2-input NAND gate, the output Q is NOT true if BOTH input A and
input B are true, giving the Boolean Expression of: ( Q = not(A AND B) ).

2-input NOR (Not OR) Gate


For a 2-input NOR gate, the output Q is true if BOTH input A and input B are
NOT true, giving the Boolean Expression of: ( Q = not(A OR B) ).
As well as the standard logic gates there are also two special types of logic gate
function called an Exclusive-OR Gate and an Exclusive-NOR Gate. The
Boolean expression to indicate an Exclusive-OR or Exclusive-NOR function is
to a symbol with a plus sign inside a circle, ( ⊕ ).
The switching actions of both of these types of gates can be created using the
above standard logic gates. However, as they are widely used functions they are
now available in standard IC form and have been included here as reference.

2-input EX-OR (Exclusive OR) Gate


For a 2-input Ex-OR gate, the output Q is true if EITHER input A or if
input B is true, but NOT both giving the Boolean Expression of: ( Q = (A and
NOT B) or (NOT A and B) ).

2-input EX-NOR (Exclusive NOR) Gate


For a 2-input Ex-NOR gate, the output Q is true if BOTH input A and
input B are the same, either true or false, giving the Boolean Expression of: ( Q
= (A and B) or (NOT A and NOT B) ).
Summary of 2-input Logic Gates
The following Boolean Algebra Truth Tables compare the logical functions of
the 2-input logic gates above.
The following Boolean Algebra truth tables gives a list of the common logic
functions and their equivalent Boolean notation.

2-input logic gate truth tables are given here as examples of the operation of
each logic function, but there are many more logic gates with 3, 4 even 8
individual inputs. The multiple input gates are no different to the simple 2-input
gates above, So a 4-input AND gate would still require ALL 4-inputs to be
present to produce the required output at Q and its larger truth table would
reflect that.
Boolean Algebra Examples
Construct a Truth Table for the logical functions below

1.

2.

3.

You might also like