MP Lab Manual
MP Lab Manual
Patil Pratisthan’sCollege of
Engineering, Salokhenagar.
1
Experiment No.1
Aim: To convert the numbers into Decimal, Octal and vice versa and study of Logic Gates
Theory: There are four types of numbers and seven types of Logic Gates
i) Decimal numbers: The technique to represent and work with numbers is called number
system. Decimal number system is the most common number system. Other popular number
systems include binary number system, octal number system, hexadecimal number system, etc.
Decimal number system is a base 10 number system having 10 digits from 0 to 9. This
means that any numerical quantity can be represented using these 10 digits. Decimal number
system is also a positional value system. This means that the value of digits will depend on its
position. Let us take an example to understand this.
Say we have three numbers – 734, 971 and 207. The value of 7 in all three numbers is different
In digital systems, instructions are given through electric signals; variation is done by varying the
voltage of the signal. Having 10 different voltages to implement decimal number system in digital
equipment is difficult. So, many number systems that are easier to implement digitally have been
developed. Let’s look at them in detail.
ii) Binary Number SystemThe easiest way to vary instructions through electric signals is two-
state system – on and off. On is represented as 1 and off as 0, though 0 is not actually no signal
but signal at a lower voltage. The number system having just these two digits – 0 and 1 – is
called binary number system.
2
Each binary digit is also called a bit. Binary number system is also positional value system, where
each digit has a value expressed in powers of 2, as displayed here.
In any binary number, the rightmost digit is called least significant bit (LSB) and leftmost digit
is called most significant bit (MSB).
And decimal equivalent of this number is sum of product of each digit with its positional value.
110102 = 1×24 + 1×23 + 0×22 + 1×21 + 0×20
= 16 + 8 + 0 + 2 + 0
= 2610
Computer memory is measured in terms of how many bits it can store. Here is a chart for memory
capacity conversion.
iii) Octal Number System: Octal number system has eight digits – 0, 1, 2, 3, 4, 5, 6 and 7.
Octal number system is also a positional value system with where each digit has its value
expressed in powers of 8, as shown here −
Decimal equivalent of any octal number is sum of product of each digit with its positional value.
3
7268 = 7×82 + 2×81 + 6×80
= 448 + 16 + 6
= 47010
iv) Hexadecimal Number System :Hexadecimal number system is also a positional value
system with where each digit has its value expressed in powers of 16, as shown here −
Decimal equivalent of any hexadecimal number is sum of product of each digit with its positional
value.
27FB16 = 2×163 + 7×162 + 15×161 + 10×160
= 8192 + 1792 + 240 +10
= 1023410
Logic Gates: Logic gates are idealized or physical devices implementing a Boolean function,
which it performs a logical operation on one or more logical inputs and produce a single output.
Depending on the context, the term may refer to an ideal logic gate, one that has for instance zero
rise time and unlimited fan out or it may refer to anon-ideal physical device. The main hierarchy
is as follows:-1. Basic Gates 2. Universal Gates 3. Advanced Gates
Basic Gates
1. AND gate: - A circuit which performs an AND operation is shown in figure. It has n input
(n >= 2) and one output.
Function of AND gate is to give the output true when both the inputs are true. In all the other
remaining cases output becomes false. Following table justifies the statement
4
Logic diagram:
Truth Table
OR gate: -A circuit which performs an OR operation is shown in figure. It has n input (n >= 2) and
one output.
Function of OR gate is to give output true when one of the either inputs are true .In the remaining
case output becomes false. Following table justify the statement:-
Logic diagram:
Truth Table:
NOT gate: -NOT gate is also known as Inverter. It has one input A and one output Y.
5
Function of NOR gate is to reverse the nature of the input .It converts true input to false and vice
versa. Following table justifies the statement:-
Logic diagram:
Truth Table:
Universal Gates
NAND gate: -A NOT-AND operation is known as NAND operation. It has n input (n >= 2) and one
output.
Function of NAND gate is to give true output when one of the two provided input are false. In the
remaining output is true case .Following table justifies the statement
Logic diagram:
6
Truth Table;
1.
NOR gate: -A NOT-OR operation is known as NOR operation. It has n input (n >= 2) and one output.
NOR gate gives the output true when both the two provided input are false. In all the other cases
output remains false. Following table justifies the statement:-
Logic diagram:
Truth Table:
Advanced Gates:
XOR gate: - XOR or Ex-OR gate is a special type of gate. It can be used in the half adder, full
adder and subtractor. The exclusive-OR gate is abbreviated as EX-OR gate or sometime as X-OR
gate. It has n input (n >= 2) and one output.
7
The function of XOR gate is to give output true only when both the inputs are true. Following table
explains this:-
Logic diagram:
Truth Table:
XNOR Gate:
XNOR gate is a special type of gate. It can be used in the half adder, full adder and subtractor. The
exclusive-NOR gate is abbreviated as EX-NOR gate or sometime as X-NOR gate. It has n input
(n >= 2) and one output.
Logic diagram:
8
Truth Table:
Conclusion: Thus we have studied Conversions of Number system and study of Logic Gates.
9
Experiment No.2
Theory:
Step 1: Search on the Google for the GNU simulator 8085 and download the suitable software
file for your computer
Step 2: Open the setup file and select the language as English
Step 3: Accept the terms of the license agreement and press next button
Step 5 : Set the destination folder for the simulator setup and press next
Step 6 : wait until the installation finish after green bar and installation completed press Next
Step7: After completion finish the setup run 8085 GNU simulator
Conclusion: We performed Hands on experiment for use of 8085 GNU simulator on windows
10.
10
11
12
13
14
15
Experiment 3
Theory:
16
Arithmetic instructions
Conclusion: Thus we have studied different instruction set which include Data transfer and
Arithmetic Instructions.
17
Experiment 4
Title: Study of Practical demonstration of 8085 programs involving Logical instruction set
Theory:
Logical Instructions
Opcode Operand Meaning Explanation
Compare immediate The second byte data is compared with the contents
CPI 8-bit data
with the accumulator of the accumulator.
R Logical AND register The contents of the accumulator are logically AND
ANA or memory with the with M the contents of the register or memory, and
M accumulator the result is placed in the accumulator.
18
R Logical OR register or The contents of the accumulator are logically OR
ORA memory with the with M the contents of the register or memory, and
M accumulator result is placed in the accumulator.
Conclusion: Thus we have studied different instruction set which include logical Instructions.
19
Experiment 5
Theory:
Step1: Download DOSBox:
Under the “DOSBox (specific versions)” section, click on the “Windows” link to download the
installer.
You’ll be greeted with a DOS-like command prompt where you can run your DOS programs or
games.
20
21
22
23
Experiment 6
Theory:
Running DOSBox & Using the Command Line
If everything is configured correctly, when you run DOSBox you'll see something like this:
24
Experimental Procedure
1. Navigating the File System
1. Displaying Directory Contents: Use DOS commands to list files and directories.
dos
C:\> dir
dos
C:\> cd directory_name
dos
C:\> type filename.txt
2. Managing Files and Directories
dos
C:\> mkdir new_directory
dos
C:\> copy file1.txt destination_folder
dos
C:\> ren oldname.txt newname.txt
25
dos
C:\> del filename.txt
3. Executing Basic DOS Commands
dos
C:\> yourprogram.exe
dos
C:\> echo Hello, DOSBox!
3. Creating and Editing Text Files: Use edit or notepad (if available) to create and edit text
files.
dos
C:\> edit filename.txt
26
Mount the C:\snehal Directory
In DOSBox, the mount command is used to mount a directory on your host machine as a drive
letter within the emulated DOS environment. This allows you to access files and directories on
your computer from within DOSBox. Here’s how you can use the mount command:
dir Command
In DOSBox, the dir command is used to list the contents of a directory within the emulated DOS
environment. It functions similarly to the dir command in MS-DOS or the ls command in Unix-
like systems. Here’s how you can use the dir command in DOSBox:
27
md Command
In DOSBox, the md command is used to create a new directory (folder) within the emulated
DOS environment. It functions similarly to the mkdir command in modern Windows command
prompt or Unix-like systems. Here’s how you can use the md command in DOSBox:
cd Command
In DOSBox, the cd command functions similarly to its counterpart in MS-DOS or Windows
Command Prompt. It allows you to change the current directory within the emulated DOS
environment.
28
29
Step 2: md & rd Command
In DOSBox, the md command (short for Make Directory) is used to create a new directory
(folder) within the emulated DOS environment. It serves the same purpose as the mkdir
command in modern Windows Command Prompt or Unix-like systems.
In DOSBox, the rd command is used to remove or delete a directory (folder) within the emulated
DOS environment. It functions similarly to the rmdir command in modern Windows command
prompt or Unix-like systems.
30
Experiment 7
Theory: The 80386 microprocessor, commonly known as the Intel 386, is a 32-bit
microprocessor introduced by Intel in 1985. It is the third generation in Intel's x86 family of
microprocessors and was a significant advancement over its predecessors, the 8086 and 80286.
Here are some key features and details about the 80386 microprocessor:
1. Architecture:
o 32-bit Architecture: The 80386 was a full 32-bit processor, meaning it could
process 32 bits of data at a time, compared to the 16-bit architecture of its
predecessor, the 80286.
o Protected Mode: Introduced a new operating mode called Protected Mode, which
provided support for virtual memory and multitasking, allowing multiple programs
to run simultaneously without interfering with each other's memory space.
2. Registers:
o General-Purpose Registers: Expanded set of 32-bit general-purpose registers
(EAX, EBX, ECX, EDX, etc.) compared to the 16-bit registers of earlier
processors.
o Segment Registers: Continued use of segment registers (CS, DS, SS, ES) but with
enhancements to support 32-bit addressing.
3. Memory Management:
o Virtual Memory: Supported virtual memory through the use of paging and
segmentation mechanisms, which allowed larger amounts of memory to be
accessed and managed efficiently.
o Address Translation: Used a Memory Management Unit (MMU) to translate
virtual addresses to physical addresses, facilitating efficient memory management.
4. Instruction Set:
31
o Complex Instruction Set Computer (CISC): Retained a complex instruction set with
a wide variety of instructions, including arithmetic, logical, and control
instructions, to handle a broad range of tasks efficiently.
5. Performance:
o Clock Speed: Initially operated at clock speeds ranging from 12 MHz to 33 MHz,
offering significantly higher performance compared to its predecessors.
o Execution Pipelining: Introduced pipelining techniques to improve instruction
throughput and overall performance.
6. Compatibility:
o Backward Compatibility: Maintained backward compatibility with software
designed for earlier Intel processors like the 8086, 80186, 80286, allowing existing
software to run on the 80386 without modification.
1. Memory Addressing
32-Bit Address Bus: The 80386 has a 32-bit address bus, allowing it to directly address up
to 4 GB of physical memory. This was a significant upgrade from the 20-bit address bus
of its predecessor, the 80286, which limited addressing to 1 MB.
2. Segmentation
Segment Registers: The 80386 retains the segment registers (CS, DS, SS, ES) from earlier
processors, but with enhancements for 32-bit addressing. Each segment register holds a
segment selector, which points to a segment descriptor in the Global Descriptor Table
(GDT) or Local Descriptor Table (LDT).
Segment Descriptor: Describes the properties of a segment, such as its base address, limit,
access rights (read, write, execute), and privilege level.
Segmentation Mechanism: Allows the processor to divide memory into logical segments,
providing memory protection and isolation between different parts of a program or between
different programs.
32
3. Paging
Page Tables: The 80386 supports a hierarchical paging structure for virtual memory
management.
Page Directory: Contains entries that point to Page Tables.
Page Table: Contains entries that map virtual addresses to physical addresses.
Address Translation: When the MMU receives a virtual address, it translates it to a
physical address using the paging mechanism. This translation allows the processor to
access physical memory beyond the limits of its address bus.
Page Size: Supports variable page sizes (4 KB, 4 MB) for flexibility in memory
management.
4. Virtual Memory
Virtual Memory Support: Allows the use of virtual memory addresses that map to physical
memory addresses. This enables programs to address more memory than physically
available and facilitates efficient memory allocation and management.
Demand Paging: Pages of memory are only loaded into physical memory when they are
needed (on demand), reducing the amount of physical memory required.
Page Replacement: Handles situations where physical memory becomes full by swapping
out less frequently used pages to disk.
5. Memory Protection
Protection Rings: Supports four privilege levels (0 to 3), known as protection rings or
privilege levels. Each ring has different access rights to system resources, providing a
mechanism for enforcing security and preventing unauthorized access.
Segmentation and Paging for Protection: Combines segmentation and paging to enforce
memory protection, ensuring that programs cannot access memory outside their allocated
segments or pages.
33
6. Control Registers
Control Registers: Includes CR0, CR2, CR3, and CR4, which control various aspects of
memory management and system operation.
CR0: Controls the operating mode (real mode, protected mode) and paging enable/disable.
CR2: Holds the page fault linear address during a page fault.
CR3: Points to the base address of the Page Directory.
8. Performance Considerations
Conclusion: Overall, the 80386 microprocessor was a major milestone in the history of
computing, driving the industry towards the modern era of 32-bit and later 64-bit computing.
34
Experiment 8
Theory:
The Arduino Uno is a popular microcontroller board based on the ATmega328P microcontroller.
It is part of the Arduino family of open-source hardware and software, designed to make
electronics more accessible to hobbyists, students, and professionals. Here are some key features
and details about the Arduino Uno:
Key Features
1. Microcontroller:
o The Arduino Uno uses the ATmega328P microcontroller, a low-power, high-
performance 8-bit AVR RISC-based microcontroller.
2. Digital and Analog I/O:
o It has 14 digital input/output pins (of which 6 can be used as PWM outputs) and 6
analog input pins.
3. Clock Speed:
o The board operates at a clock speed of 16 MHz.
4. Memory:
o It has 32 KB of flash memory for storing code, 2 KB of SRAM for runtime data,
and 1 KB of EEPROM for non-volatile storage.
5. Power Supply:
o The board can be powered via a USB connection or an external power supply. It
has an operating voltage of 5V and can handle an input voltage range of 7-12V.
6. Connectivity:
o The Arduino Uno includes a USB-B port for connecting to a computer for
programming and power, and it has a power jack for external power.
7. Programming:
o The board is programmed using the Arduino Software (IDE), which is an easy-to-
use, open-source development environment. It supports C/C++ programming.
8. Built-in LED:
o The board has a built-in LED connected to digital pin 13, useful for simple testing
and debugging.
9. Reset Button:
o It includes a reset button to restart the program on the board.
Applications
1. Prototyping:
o The Arduino Uno is widely used for prototyping electronic projects, including
interactive objects, sensors, and control systems.
35
2. Education:
o It is a popular tool in educational settings, from high school to university, for
teaching electronics, programming, and embedded systems.
3. DIY Projects:
o Hobbyists and makers use the Arduino Uno for a wide range of DIY projects,
such as home automation, robotics, and wearable technology.
4. Research and Development:
o The board is also used in research and development environments for rapid
prototyping and proof-of-concept demonstrations.
Components:
1. USB Connector
2. Port
3. Microcontroller
4. Analog I/P pin
5. Digital switch
6. Crystal Oscillator
7. USB interface Chip
8. Tx RX LED’s
Experimental Procedure
1. Introduction to Arduino IDE
1. Launch Arduino IDE: Start the Arduino IDE software on your computer.
2. Interface Overview: Familiarize students with the Arduino IDE interface, including the
editor, toolbar, and status bar.
1. Create a New Sketch: Open a new sketch (File -> New) and write a simple program
(referred to as a sketch in Arduino terminology) to blink an LED connected to the Arduino
2. Verify and Compile: Click on the verify (checkmark) button to compile the sketch and
check for any syntax errors.
36
3. Uploading Sketch to Arduino Board
1. Select Board and Port: Go to Tools -> Board and select the appropriate Arduino board
model (e.g., Arduino Uno). Then, select the correct port under Tools -> Port.
2. Upload Sketch: Click on the upload (right arrow) button to compile the sketch and upload
it to the Arduino board.
4. Practical Activities
1. Experiment with Sensors and Actuators: Connect various sensors (e.g., temperature
sensor, ultrasonic sensor) and actuators (e.g., motors, servos) to the Arduino board.
2. Write and Upload Code: Write Arduino sketches to interface with these components and
upload them to the Arduino board to observe their functionality.
37
Diagram: Practical demonstration of Arduino IDE Software
Conclusion
The Arduino Uno is a versatile and user-friendly microcontroller board that has become a
cornerstone of the maker movement and educational electronics. Its simplicity, combined with
the power of the ATmega328P microcontroller, makes it an ideal choice for a wide range of
electronic projects and learning experiences.
38
Experiment 9
Theory:
1. Introduction:
o The first Pentium processor, known as the P5, was launched in March 1993. It
marked the beginning of a new era in Intel’s x86 microprocessor line, succeeding
the Intel 80486.
2. Architecture:
o The Pentium microprocessor is based on a superscalar architecture, which allows
it to execute more than one instruction per clock cycle. This was a major
advancement over the previous generation.
Key Features
1. Superscalar Architecture:
o The Pentium could execute two instructions per clock cycle due to its dual integer
pipelines (U-pipe and V-pipe).
2. 64-bit Data Bus:
o This enabled faster data transfer rates compared to the 32-bit data bus of its
predecessors.
3. 32-bit Address Bus:
o The processor could address up to 4 GB of memory, which was a significant
increase at the time.
4. Branch Prediction:
o Advanced branch prediction algorithms improved the efficiency of the instruction
pipeline by predicting the direction of branches more accurately.
5. Floating-Point Unit (FPU):
o An integrated FPU allowed for efficient processing of floating-point operations,
beneficial for scientific and graphics applications.
6. Cache Memory:
o The Pentium featured a split Level 1 (L1) cache with 8 KB for data and 8 KB for
instructions, reducing access time for frequently used data and instructions.
7. Clock Speeds:
39
o Initial models had clock speeds ranging from 60 MHz to 66 MHz, with later
models reaching speeds up to 300 MHz.
1. Pentium (P5):
o The original Pentium processors introduced dual pipelines and clock speeds
starting at 60 MHz.
2. Pentium Pro (P6):
o Introduced in 1995, the Pentium Pro featured out-of-order execution and an
integrated Level 2 (L2) cache, targeting server and high-end desktop markets.
3. Pentium II:
o Launched in 1997, the Pentium II added MMX technology for better multimedia
performance and was available with clock speeds from 233 MHz to 450 MHz.
4. Pentium III:
o Released in 1999, the Pentium III introduced SSE (Streaming SIMD Extensions)
for improved floating-point and multimedia performance, with clock speeds from
450 MHz to 1.4 GHz.
5. Pentium 4:
o The Pentium 4, introduced in 2000, used the NetBurst microarchitecture,
emphasizing high clock speeds (up to 3.8 GHz) and introduced Hyper-Threading
Technology for improved parallelism.
Technological Innovations
1. Superscalar Execution: The ability to execute multiple instructions per cycle greatly
improved processing efficiency.
2. Out-of-Order Execution: Seen in the Pentium Pro, this allowed the processor to use
available execution units more effectively.
3. Hyper-Threading Technology: Introduced with the Pentium 4, this allowed a single
physical processor to appear as two logical processors, improving multitasking and
parallel processing.
40
Conclusion
41
Experiment 10
Title: To Study practical demonstration of seven segment display with Aurdino IDE
Aim: Study practical demonstration of seven segment display with Aurdino IDE
Theory:
A seven-segment display is an electronic display device used to display decimal numerals and
some alphabetic characters. It is widely used in digital clocks, electronic meters, basic
calculators, and other devices that display numerical information. Here’s a comprehensive
overview of seven-segment displays:
Each segment can be illuminated individually to form numbers and some alphabetic characters.
The segments are labeled from 'a' to 'g' and are typically lit using LEDs.
Common Configurations
Common Anode: In a common anode display, all the anode connections of the LED
segments are tied together to a common point, usually connected to a positive voltage.
Each segment is lit by connecting its cathode to ground (logic low).
42
Common Cathode: In a common cathode display, all the cathode connections of the
LED segments are tied together to a common point, usually connected to ground. Each
segment is lit by connecting its anode to a positive voltage (logic high).
Each numeral from 0 to 9 can be displayed by lighting the appropriate segments. Here’s how the
segments are lit for each numeral:
0: a, b, c, d, e, f
1: b, c
2: a, b, d, e, g
3: a, b, c, d, g
4: b, c, f, g
5: a, c, d, f, g
6: a, c, d, e, f, g
7: a, b, c
8: a, b, c, d, e, f, g
9: a, b, c, d, f, g
Components Needed
Arduino board
Seven-segment display (common anode or common cathode)
Current limiting resistors (typically 220 ohms)
Breadboard and jumper wires
43
Circuit Diagram (Common Cathode Example)
Setup Function: Initializes each segment pin (segmentA to segmentG) as an output pin.
Loop Function: Demonstrates displaying numbers from 0 to 9 sequentially with a 1-
second delay between each number.
Display Number Function: Sets the appropriate segments (a to g) of the display to
display each digit. Each case statement corresponds to a number (0 to 9), and the segment
pins are set HIGH or LOW according to the desired segments lit up to display that
number.
Adjust the pin numbers in the code according to how you have connected your seven-
segment display to the Arduino.
If using a common anode display instead of common cathode, you would need to adjust
the code to use digital Write(pin, LOW) to turn on a segment.
This basic example demonstrates the fundamental concept of controlling a seven-segment
display with Arduino. You can expand upon this by adding buttons to increment or
decrement displayed numbers, or integrating it into larger projects where numerical
output is required.
44
- Connect each segment (a to g and dp) of the display to Arduino digital pins (2 to 8). Also,
connect the common cathode pin of the display to GND.
2. **Resistors**:
- If your display doesn’t have built-in resistors, connect a 220-ohm resistor in series with each
segment to limit the current flowing through them.
3. **Arduino Connections**:
- Connect the Arduino GND to the common cathode pin of the seven-segment display.
```cpp
45
const int segmentF = 7;
void setup() {
pinMode(segmentA, OUTPUT);
pinMode(segmentB, OUTPUT);
pinMode(segmentC, OUTPUT);
pinMode(segmentD, OUTPUT);
pinMode(segmentE, OUTPUT);
pinMode(segmentF, OUTPUT);
pinMode(segmentG, OUTPUT);
void loop() {
displayNumber(0);
delay(1000);
displayNumber(1);
46
delay(1000);
displayNumber(2);
delay(1000);
displayNumber(3);
delay(1000);
displayNumber(4);
delay(1000);
displayNumber(5);
delay(1000);
displayNumber(6);
delay(1000);
displayNumber(7);
delay(1000);
displayNumber(8);
delay(1000);
displayNumber(9);
delay(1000);
47
switch(number) {
case 0:
digitalWrite(segmentA, HIGH);
digitalWrite(segmentB, HIGH);
digitalWrite(segmentC, HIGH);
digitalWrite(segmentD, HIGH);
digitalWrite(segmentE, HIGH);
digitalWrite(segmentF, HIGH);
digitalWrite(segmentG, LOW);
break;
case 1:
digitalWrite(segmentA, LOW);
digitalWrite(segmentB, HIGH);
digitalWrite(segmentC, HIGH);
digitalWrite(segmentD, LOW);
digitalWrite(segmentE, LOW);
digitalWrite(segmentF, LOW);
digitalWrite(segmentG, LOW);
break;
48
case 2:
// Define similar cases for numbers 2 to 9 by setting appropriate segment pins HIGH or LOW
// Example:
digitalWrite(segmentA, HIGH);
digitalWrite(segmentB, HIGH);
digitalWrite(segmentC, LOW);
digitalWrite(segmentD, HIGH);
digitalWrite(segmentE, HIGH);
digitalWrite(segmentF, LOW);
digitalWrite(segmentG, HIGH);
break;
// ...
49
Diagram : Practical demonstration of seven segment display with arduino IDE
Conclusion
In summary, the seven-segment display is a versatile and widely used component for
displaying numeric information in a variety of electronic applications. Its simplicity and ease of
use make it a staple in both educational and practical electronics projects.
50