Lecture 2- CSC303
Lecture 2- CSC303
Consists of eight digits ranging from 0-7.the place value of octal numbers goes
up in factors of eight from right to left.
• 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
Place value 25 24 23 22 21 20
Binary digits 1 0 1 1 0 1
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.
0.375×2=0.750
0.750×2=1.500
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
Solution
Convert the integral and the fractional parts separately then add them up.
2×1= 2.000
1×1= +1.000
3.00010
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
Divide the integral part continuously by 2.For the fractional part, proceed as
follows:
Example
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
3 2 1
011 010 001
3218 =0110100012
1101- D
0001- 1
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
0.375×2=0.750
0.750×2=1.500
Therefore 0.37510=0.0112
Example 1.13
Solution
Place value 82 81 80
64 8 1
Octal digit 5 1 2
=(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
Example
Solution
16 x 1 = 16
1 x 1= + 1
273
Example
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
3 2 1
011 010 001
3218 =0110100012
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
First, write the place values starting from the right hand side.
• Multiply each hexadecimal digit with its corresponding place value and
then add the products
Example
Solution
16 x 1 = 16
1 x 1= + 1
273
Example 1
Convert 32116
Hexadecimal digit 3 2 1
Binary equivalent 0011 0010 0001
32116 = 0011001000012
Example 2
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 ).
A B Q
0 0 0
0 1 0
1 0 0
1 1 1
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).
A B Q
0 0 0
0 1 1
1 0 1
1 1 1
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.
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).
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.