Number System in Computers:: Decimal and Binary Numbers
Number System in Computers:: Decimal and Binary Numbers
(6B8C)16
To convert a hexadecimal number to a binary number, convert each hexadecimal digit into a group of
4 binary digits.
Example: Convert the hex number (374F)16 into binary
3 7 4 F
Convert the hex digits to binary 0011 0111 0100 1111
(0011011101001111)2
Powers of 2:
20−−−−−−−−−−−1
21−−−−−−−−−−−2
22−−−−−−−−−−−4
23−−−−−−−−−−−8
24 −−−−−−−−−−−16
25−−−−−−−−−−−32
26−−−−−−−−−−−64
27−−−−−−−−−−−128
28−−−−−−−−−−−256
Hexadecimal Digits
0 ......................0 0
0
0 ASCII Character Set
0
High Order Bits
1 ......................1 0
0
Low 000 00 0010 00 01 01 01 01
0
Order 0 01 11 00 01 10 11
1
Bits 0 1
2 ......................2 2 0 3 4 5 6 7
0
000 0 NU DL Spac 0 @ P ` p
1
0 L E e
0
000 SO DC
1 3 ......................3 !0 1 A Q a q
1 H 1 0
1
001 2 ST DC “1 2 B R b r
0 X 2
4 ......................4 0
001 3 ET DC #1 3 C S c s
1 X 3 0
0
010 4 EO DC $ 4 D T d t
5 ......................5
T 4 0
0
1
010 5 EN NA %0 5 E U e u
1 Q K 1
6 ......................6 0
011 6 AC SY &1 6 F V f v
0 K N
1
0
011 7 BE ET ‘ 7 G W g w
1 L B
7 ......................7 0
1
100 8 BS CA (1 8 H X h x
0 N 1
100 9 8 ......................8
HT EM )1 9 I Y i y
1 0
0
101 A LF SU *0 : J Z j z
0 B
9 ......................9 1
101 B VT ES +0 ; K [ k {
C 0
1
1
110 FF FS A
C 10..................... ,1 < L \ l |
0 0
1
110 D CR GS - = M ] m }
0
1
11..................... B 1
111 E SO RS .0 > N ^ n ~
0 1
1
111 F SI US / ? O _ o DE
1 12..................... C 1 L
1
0
0
13..................... D 1 (2)Logics
1
0 SYMBOLIC REPRESENTATION
1 2. :
14..................... E 1 Statements are symbolically represented by letters
1 such as p, q, r,...
1
0
15......................F 1
1
1
1
4.
EXAMPLES:
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”
5.
Disjunction or Vel
7.
TRANSLATING FROM ENGLISH TO SYMBOLS
8. :
Let p = “It is hot”, and q = “It is sunny”
SENTENCE SYMBOLIC FORM
1. It is not hot. ~p
2. It is hot and sunny. p q
3. It is hot or sunny. pq
4. It is not hot but sunny. ~ p q
5. It is neither hot nor sunny. ~p~q
EXAMPLE
9. :
Let h = “Zia is healthy”
w = “Zia is wealthy”
s = “Zia is wise”
Translate the compound statements to symbolic form:
1. Zia is healthy and wealthy but not wise. (h w) (~s)
2. Zia is not wealthy but he is healthy and wise. ~w (h s)
3. Zia is neither healthy, wealthy nor wise. ~h ~w ~s
14.
NEGATION (~)
16. :
If p is a statement variable, then negation of p, “not p”, is denoted as “~p”
It has opposite truth value from p i.e.,
if p is true, ~p is false; if p is false, ~p is true.
TRUTH TABLE FOR ~ p
18.
CONJUNCTION ()
20. :
“If p and q are statements, then the conjunction of p and q is “p and q”, denoted as “p q”.”
It is true when, and only when, both p and q are true. If either p or q is false, or
if both are false, pq is false.
TRUTH TABLE FOR pq
p q p q
T T T
T F F
F T F
F F F
DISJUNCTION () or INCLUSIVE OR
22.
“If p & q are statements, then the disjunction of p and q is “p or q”, denoted as
“p q””.
It is true when at least one of p or q is true and is false only when both p and q are false.
TRUTH TABLE FOR pq
24.
p q p q
T T T
T F T
F T T
Note F F F
It that in the table F is only in that row where both p and q have F and all other values
are T. Thus for finding out the truth values for the disjunction of two statements we
will only first search out where the both statements are false and write down the F in the
corresponding row in the column of p Ú q and in all other rows we will write T in the column of p
Ú q.
Remark:
Note that for Conjunction of two statements we find the T in both the statements, but
in disjunction we find F in both the statements. In other words we will fill T first in the column of
conjunction and F in the column of disjunction.
Truth Tables
Truth Tables for:
1. ~pq
2. ~ p (q ~ r)
3. (pq) ~ (pq)
Truth table for the statement form ~ p q
p q ~p ~p q
T T F F
T F F F
F T T T
F F T F
Double Negative Property ~(~p) p
Example
Solution:
Let p = “I am happy”
Since ~ (~p) p
“I am happy”
p q ~p ~q pq ~(pq) ~p ~q
T T F F T F F
T F F T F T F
F T T F F T F
F F T T F T T
Gates and Circuits
1. NOT-gate
A NOT-gate (or inverter) is a circuit with one input and one output signal. If the input signal is 1,
the output signal is 0. Conversely, if the input signal is 0, then the output signal is 1.
P R
NOT
Input Outp
P R
ut
1 0
0 1
2. AND-gate
An AND-gate is a circuit with two input signals and one output signal.
If both input signals are 1, the output signal is 1. Otherwise the output signal is 0.
If both input signals are 0, then the output signal is 0. Otherwise, the output signal is 1.
P
Inpu Ou
R
Q OR P tQ tpu
R
t
1 1 1
COMBINATIONAL CIRCUIT 1 0 1
:
0 1 1
0 0 0
A Combinational Circuit is a compound circuit consisting of the basic logic gates such as NOT,
AND, OR.
DETERMINING OUTPUT FOR A GIVEN INPUT
Indicate the output of the circuit below when the input signals are P = 1, Q = 0 and R = 0
P
AND NOT
Q
OR
S
R
SOLUTION
:
Output S = 1
P
AND NOT
Q
S
OR
R
P X Y
AND NOT
Q
S
P Q R X Y S
OR
R 1 1 1 1 0 1
1 1 0 1 0 0
1 0 1 0 1 1
1 0 0 0 1 1
0 1 1 0 1 1
0 0 1 0 1 1
0 0 0 0 1 1
P
OR
Q
AND
R OR
SOLUTION
Trace through the circuit from left to right, writing down the output of each logic gate.
P PQ
Q OR
(PQ) (PR)
PR AND
R OR
EXERCISE
Construct circuit for the Boolean expression (PQ) ~R
SOLUTION:
P PQ
Q AND (P Q) ~R
OR
~R
R NOT
CIRCUIT FOR INPUT/OUTPUT TABLE
INPUTS OUTPUT
P Q R S
1 1 1 0
1 1 0 1
1 0 1 0
0 1 1 1
0 1 0 0
0 0 1 0
0 0 0 0
CIRCUIT DIAGRAM
P
:
Q AND S
R
OR
P
~P Q R
Q AND
R
EXERCISE:
P
Q AND
NOT
OR
AND
SOLUTION
AND
:
NOT
We find the Boolean expressions for the circuits and show that they are logically