DOC-20240924-WA0023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

MECHATRONICS-I

Assignment 1

Number Systems and Logic Gates


Presented By :-
Krity Priya
Saumya Tripathi
NUMBER SYSTEM
Binary (Base 2)
Octal (Base 8)
Decimal (Base 10)
Hexadecimal (Base 16)
NUMBER SYSTEM
A number system is a writing system for expressing numbers using a consistent set of
symbols or digits. It defines how numbers are represented and how mathematical operations
are perform.
The number 25 is represented in different number systems:
Decimal (Base 10):
25 (The number we use in everyday life)
Binary (Base 2):
11001 (In binary, 25 is represented as 1×2⁴ + 1×2³ + 0×2² + 0×2¹ + 1×2⁰)
Octal (Base 8):
31 (In octal, 25 is represented as 3×8¹ + 1×8⁰)
Hexadecimal (Base 16):
19 (In hexadecimal, 25 is represented as 1×16¹ + 9×16⁰)
COMPLEMENT OF NUMBER
One's complement: In binary system, if each 1 is replaced by 0 and each 0 by 1, then resulting
number is called as one's complement of the that number.
One’s compliment of 100101 is 011010
If first number is positive then resulting will be negative with the same magnitude and vice
versa.
In binary arithmetic 1’s complement of a binary number N is obtained by the formula = (2^n –
1) – N where n is the no of bits in binary number N.
Two's complement: If 1 is added to the complement of a number then resulting number is
known as two's complement.
For two’s compliment of 100101
Invert the digits (change 0s to 1s and 1s to 0s): 100101 becomes 011010
Add 1 to the inverted number: 011010 + 1 = 011011.
If MSB is 0 then the number is positive else if MSB is 1 then the number is negative.
2’s complement of a binary number N is obtained by the formula (2^n) – N, where n is the no
of bits in number N
CONVERSION
WHY DO WE NEED CONVERSION METHODS BETWEEN
DIFFERENT NUMBER SYSTEMS?
Different Uses in Computing: Various number systems (binary, octal, decimal, hexadecimal) are used in
computing and electronics for different purposes. For example, binary is used at the machine level,
while hexadecimal is often used for memory addressing.
Data Representation: Different number systems offer more efficient ways to represent data, depending
on the context. Binary is most compact for computer logic, but humans find decimal easier to
understand.
Interfacing Between Humans and Machines: Humans commonly use decimal numbers, while
computers use binary. Conversion is necessary for communication between humans (decimal) and
machines (binary).
Error Detection and Correction: Some number systems are designed to detect errors or make
corrections more straightforward, such as binary in computing.
Storage and Processing Efficiency: Systems like hexadecimal provide a more compact way to
represent binary numbers, reducing error potential in human interaction without sacrificing the precision
machines require.
CONVERSION AMONG BASES

DECIMAL OCTAL

BINARY HEXADECIMAL

NOTE :- 25(base10) = 11001(base2) = 31(base8) = 19(base16)


DECIMAL TO BINARY CONVERSION
a(base10)=b(base2)
Take the number of be converted and divide it by base of the system to be converted to i.e.2.
Arrange all the remainder obtained in reverse order.
The sequence obtained is the binary equivalent of the taken decimal number.

Least Significant Bit (LSB)=1


Most Significant Bit (MSB)=1

In the example above, 125(base10) is divided by 2 for converting it to base2 number until the quotient is less than
the divisor i.e. 2. Thus in the example provided above, 125(base10) = 111101(base2)
DECIMAL TO OCTAL CONVERSION
a(base10)=b(base8)
Take the number of be converted and divide it by base of the system to be converted to i.e. 8.
Arrange all the remainder obtained in reverse order.
The sequence obtained is the octal equivalent of the taken decimal number.

Least Significant Bit (LSB)=5


Most Significant Bit (MSB)=1

In the example above, 125(base10) is divided by 8 for converting it to base8 number until the quotient is less than
the divisor i.e. 8. Thus in the example provided above, 125(base10) = 175(base8)

NOTE :- It can be observed that each digit of the output number is less than 8.
DECIMAL TO HEXADECIMAL CONVERSION
a(base10)=b(base16)
Take the number of be converted and divide it by base of the system to be converted to i.e. 16.
Arrange all the remainder obtained in reverse order.
The sequence obtained is the octal equivalent of the taken decimal number.

Least Significant Bit (LSB)=D

Most Significant Bit (MSB)=7

In the example above, 125(base10) is divided by 16 for converting it to base16 number until the quotient is less
than the divisor i.e. 16. Thus in the example provided above, 125(base10) = 7D(base16)
BINARY TO DECIMAL CONVERSION
a(base2)=b(base10)
To convert a binary number to decimal, 2 is raised to the power of (n-1) for each bit where n is the position of the
bit from right hand side.
Then the outcome of 2 raised to (n-1) for each bit is multiplied with their respective bit values and all the number
are then added to get the final decimal number.

In the example above, 11101(base2), 2 is raised to (n-1) for each bit where n is the position of the bit from right
hand side.
Then the following operation is performed:-
1*16+1*8+1*4+0*2+1*1=29
BINARY TO OCTAL CONVERSION
a(base2)=b(base8)
To convert from binary to octal, we can first of all convert the binary number to decimal and then convert it to
octal.
However, there is another quick method for converting binary to octal. For that we need to divide the number
into group of three bits each, if number of bits in the number is not a multiple of 3, we can proceed after adding
sufficient number of zero bits at the beginning.

After making the groups we just need to take the values written above bit “1” and then add the numbers
obtained.
Then the number obtained from each group are written together to get the final octal number.
BINARY TO HEXADECIMAL CONVERSION
a(base2)=b(base16)
To convert from binary to hexadecimal, we can first of all convert the binary number to decimal and then convert
it to hexadecimal.
However, there is another quick method for converting binary to hexadecimal. For that we need to divide the
number into group of four bits each, if number of bits in the number is not a multiple of 4, we can proceed after
adding sufficient number of zero bits at the beginning.

After making the groups we just need to take the values written above bit “1” and then add the numbers
obtained.
Then the number obtained from each group are written together to get the final hexadecimal number.
OCTAL TO DECIMAL CONVERSION
a(base8)=b(base10)
To convert a octal number to decimal, 8 is raised to the power of (n-1) for each bit where n is the position of the
bit from right hand side.
Then the outcome of 8 raised to (n-1) for each bit is multiplied with their respective bit values and all the number
are then added to get the final decimal number.

In the example above, 125(base8), 8 is raised to (n-1) for each bit where n is the position of the bit from right hand
side.
Then the following operation is performed:-
1*64+2*8+5*1=85
OCTAL TO BINARY CONVERSION
a(base8)=b(base2)
4 2 1 Value

0 0 0 0
To convert from octal to binary, we can first of all convert the octal
number to decimal and then convert it to binary. 0 0 1 1
However, there is another quick method for converting binary to
hexadecimal. For that we need to make an octal table as shown.
0 1 0 2
Then the table is used to match the binary equivalent of each octal
number.
For example 125(base8)=001010101(base2), where 001 is binary of 0 1 1 3
octal 1, 010 is binary of octal 2, 101 is binary of octal 5.
1 0 0 4

1 0 1 5

1 1 0 6

1 1 1 7
OCTAL TO HEXADECIMAL CONVERSION
a(base8)=b(base16)
To convert from octal to hexadecimal, we can first of all convert the octal number to decimal and then convert
it to hexadecimal.
However, there is another quick method for converting octal to hexadecimal. For that we need to divide the
number into group of four bits each, if number of bits in the number is not a multiple of 4, we can proceed
after adding sufficient number of zero bits at the beginning.

After making the groups we just need to take the values written above bit “1” and then add the numbers
obtained.
Then the number obtained from each group are written together to get the final hexadecimal number.
HEXADECIMAL TO DECIMAL CONVERSION
a(base16)=b(base10)
To convert a hexadecimal number to decimal, 16 is raised to the power of (n-1) for each bit where n is the position
of the bit from right hand side.
Then the outcome of 16 raised to (n-1) for each bit is multiplied with their respective bit values and all the number
are then added to get the final decimal number.

In the example above, 125(base16), 16 is raised to (n-1) for each bit where n is the position of the bit from right
hand side.
Then the following operation is performed:-
2*256+D*16+5*1=512+13*16+5=727
HEXADECIMAL TO BINARY CONVERSION
a(base16)=b(base2)

To convert from hexadecimal to binary, we can first of all convert the hexadecimal number to decimal and
then convert it to binary.

Conversion of decimal to binary

Hexadecimal to decimal Final binary number


HEXADECIMAL TO OCTAL CONVERSION
a(base16)=b(base8)

To convert from hexadecimal to octal, we can first of all convert the hexadecimal number to decimal and then
convert it to octal.

Conversion of decimal to octal

Hexadecimal to decimal Final octal number


LOGIC GATES
NOT Gate
AND Gate
OR Gate
NAND Gate
NOR Gate
XOR (Exclusive OR) Gate
XNOR Gate
AOI Gate
LOGIC GATES
The logic gate is the most basic building block of any digital system capable of making
decision including computers.
Each one of the basic logic gates is a piece of hardware or an electronic circuit that can be
used to implement some basic logic expression.
It is an electronic circuit with one or many inputs and only one output. With the help of logic
gates it is possible to implement the most elementary logic expressions, also known as
Boolean expressions.
At any given instance, every input or output terminal is in one of the two logic conditions
True or False which describes Logic value
1 or 0 provides binary value
+5V (+3.3V for new devices) or 0V provides voltage levels
High or Low describes the voltage levels
ON or OFF describes the switch position
The common use of logic gate is to act as switches. Gate opens to pass on logic or close to
shut to keep it off
WHAT IS A TRUTH TABLE?
One of the common tool in specifying a gate function is the truth table
All possible combination of the inputs A, B … etc, are enumerated, one row for each possible combination. Then
a column is used to show the corresponding output value.
If two logic circuits share identical truth table, they are functionally equivalent.
NOT GATE
NOT gate has one-input and one-output.
It is a logic circuit whose output is always the complement of the input.
The NOT gate is popularly known as inverter. It performs logical inversion or complementation.
The purpose of inverter is to change one logic level to opposite level. The LOW level at input produces a HIGH
level and vice versa. In terms of bits, it changes a 0 to a 1 and a 1 to 0.
Boolean Expression: If A is the input X=-A

TRUTH TABLE
NOT GATE DIAGRAM
A X

0 1
A Ā

1 0
AND GATE
AND gate is a logic circuit having two or more inputs and one output.
The AND gate performs logical multiplication i.e. AND function.
The output of an AND gate is HIGH only when all of its inputs are in the HIGH state. In all other cases, the output
is LOW. For AND gate, Y = A.B
If both switches are closed (logic ‘1’) then only lamp is ON (logic ‘1’). If any one or both switches are open (logic’0’)
then lamp will be OFF (logic ‘0’). The AND gate produces a logic 1, if and only if all the inputs are at logic 1.
Boolean Expression: If A and B are two inputs, the output is X=A.B

TRUTH TABLE
AND GATE DIAGRAM
A B A.B

A 0 0 0

A.B
0 1 0
B

1 0 0

1 1 1
OR GATE

An OR gate is a logic circuit with two or more inputs and one output.
The OR gate performs logical addition i.e. OR function.
The output of an OR gate is HIGH only when all of its inputs are in the HIGH state. In all other cases, the output is
LOW.
Boolean Expression: If A and B are the inputs, then the output will be X=A+B

TRUTH TABLE
OR GATE DIAGRAM
A B A+B

A 0 0 0

A+B
0 1 1
B

1 0 1

1 1 1
NAND GATE

NAND gate is combination of AND and NOT gates.


The NAND gate provides AND functions with inverted output
The output of a NAND gate is a logic ‘0’ when all its inputs are a logic ‘1’. For all other input combinations, the
output is a logic ‘1’.
Boolean Expression: If A and B are the inputs, then the output will be X=(A.B)(bar)

TRUTH TABLE
NAND GATE DIAGRAM
A B (A.B​)(bar)

A 0 0 1

(A.B​)(bar)
0 1 1
B

1 0 1

1 1 0
NOR GATE

NOR gate is combination of OR and NOT gates


The NOR gate provides OR function with inverted output.
The output of a NOR gate is a logic ‘1’ when all its inputs are logic ‘0’. For all other input combinations, the output
is a logic ‘0’
Boolean Expression: If A and B are the inputs, then the output will be X=(A+B)(bar)

TRUTH TABLE
NOR GATE DIAGRAM
A B (A+B​)(bar)

A 0 0 1

(A+B​)(bar)
0 1 0
B

1 0 0

1 1 0
XOR (Exclusive OR) GATE
Exclusive OR gate is basically designed to exclude the condition of standard OR gate so as to generate real
binary addition.
An XOR gate is a two inputs and one output logic circuit
The output of an XOR gate is at logic ‘1’ when the inputs are dissimilar and at logic ‘0’ when the inputs are similar
The output of XOR is in logic ‘1’, when one and only one of two inputs are at logic ‘1’. Similarly, the output of XOR
is at logic ‘0’, when both the inputs are at logic ‘0’ or both inputs are at logic ‘1’.
XOR gate generates logic ‘1’ only when inputs are not equal, that is why it is also known as inequality detector
gate.
Boolean Expression: If A and B are the inputs, then the output will be X=A.B(bar)+A(bar).B

TRUTH TABLE
XOR GATE DIAGRAM
A B A.B(bar)+A(bar).B

A 0 0 0
A.B(bar)+A(bar).B
B 0 1 1

1 0 1

1 1 0
XNOR GATE
XNOR is obtained by the combination of NOT and XOR gates.
XNOR gate is a two inputs and one output XOR gate with active low output.
The output of an XNOR gate is at logic ‘1’ when the inputs are similar and at logic ‘0’ when the inputs are
dissimilar.
As XNOR gate generates logic ‘1’ only when both the inputs are equal, hence this gate is also known as equality
detector gate.
Boolean Expression: If A and B are the inputs, then the output will be X=(A.B(bar)+A(bar).B)(bar)

XNOR GATE DIAGRAM TRUTH TABLE

A B (A.B(bar)+A(bar).B)(bar)

A 0 0 1
(A.B(bar)+A(bar).B)(bar)

B 0 1 0

1 0 0

1 1 1
AOI Gate
The figure below indicates the special arrangement of three basic logic gates, which is popularly known as AOI
(AND-OR-Invert) gate. It is used in many applications of combinational systems
Boolean Expression:- f=(A.B+C.D)(bar),
F=f(bar)=(A.B+C.D)(bar)(bar)=A.B+C.D

A.B

(A.B+C.D)(bar)

C.D
THANK
YOU

You might also like