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

Microprocessor Manual Master Copy Final

The document outlines a series of experiments focused on assembly language, microprocessor architecture, and number systems, particularly the EMU 8086 microprocessor. It covers various topics including addressing modes, arithmetic operations, and the conversion between different number systems (binary, decimal, octal, hexadecimal). Additionally, it introduces assembly language concepts, the role of assemblers, and the architecture of computer systems.

Uploaded by

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

Microprocessor Manual Master Copy Final

The document outlines a series of experiments focused on assembly language, microprocessor architecture, and number systems, particularly the EMU 8086 microprocessor. It covers various topics including addressing modes, arithmetic operations, and the conversion between different number systems (binary, decimal, octal, hexadecimal). Additionally, it introduces assembly language concepts, the role of assemblers, and the architecture of computer systems.

Uploaded by

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

Sr No.

Experiments Name

01 Introduction to Assembly Language and Number Systems Conversion.

02 Introduction to MOV Command and Architecture of INTEL 8086


Microprocessor.
03 The brief understanding of different interrupts used in EMU 8086 and their
program implementation.
04 Introduction to Different Addressing Modes in EMU 8086.

05 Implement the Immediate, Direct and Indirect Adressing Modes through


program Examples.

06 To Understand the Architecture of STACK and its opeartions using PUSH and
POP commands.
07 To perform Addition with carry and Subtraction with Borrow in EMU 8086.

08 To understand the Signed and Unsigned Multiplication and Division in EMU


8086.
09 To study and understand the Assembly Language instructions and Basic Logic
Operations.
10 To study and understand the Assembly Language instructions and how to
make if else statements through JUMP instruction.
11 To study and understand the functionality of all five loop instructions and
their implementation in different scenarios.
12 To study the V.S.K-80386N LCD Mode and LED Lamp Mode on trainer.

13 To understand the brief introduction about microcontrollers.

14 To Underrstand how to use Arduino (both programming and


implementation).
15 Introduction to different programming commands used in Arduino IDE.

16 To read an analog input pin, control LED brightness on PWM pin of Arduino
and print the values on the serial monitor of the Arduino Software (IDE).
List of Experiment
Experiment 1

OBJECTIVE:

“ INTRODUCTION TO ASSEMBLY LANGUAGE AND NUMBER


SYSTEM CONVERSION”

Number Systems:
A set of values used to represent different quantities is known as the Number System. For
Example, a number system can be used to represent the number of students in a class or
number of viewers watching a certain TV Program. In short, a number system is a wriiting
system to express the amount or quantity of something. For such type of counting, the Decimal
Number System is most commonly used.

In Computer Systems, Number Systems are the techniques to represent numbers in a


computer system architecture, every value saving or getting intoor from the computer memory
has a defined number system. Electronic Circuit or computer operates based on the ON/OFF
switch. The basic number system of computer is BINARY NUMBER SYSTEM. which consists of
two bits (0 and 1) whereas one binary number is known as BIT.Along chain of bits may be
difficult to be remembered for the computer engineers,so for this purpose the other two
number systems OCTAL and HEXA-DECIMAL are more convenient.

Base of a Number System:


The base of any number system is the total nunber of digits that the specific number system
has. For example, if any number system has 5 digits its Base would be 5.

Types of Number Systems:


Basically there are Four types of number Systems

1- Decimal Number System:


Decimal Number system is used for simple counting. This number system consist of 10
digits (deca->10) that is why it is known as the Decimal Number System. Its digits
are (0—9) tht is why its base is 10. Any number in this system is
represented as (91)10 or simply 91.

2- Binary Number System:


The Binary number system consists of only two digits,0 and 1 that is
why it is known as Binary Number System ( Bi means 2). Its base is 2.
Any number in this system is represented as 1001001b or
(1001001)2.
This Number System is used by the Computers. Consider the following
binary number

Digit Position

16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1000101110000110 1

Most Significant Bit Least Significant Bit

The significance of any bit is determined by its digit


position(started from right from 0). The number at the highest digit
position is known as Most Significant Bit (MSB) and the number with
the lowest digit postion is known as the Least Significant Bit (LSB). In
the above given number 1 at 16 th postion is MSB whereas 1 at 0 th
position is LSB.

4 Bits 1 nibble
8 Bits 1 Byte
16 Bits 1 Word
32 Bits Double Word

3- Octal Number:
The Octal Number System consists of only 8 digits (octa8), its digits
are (07). The base of this number system is 8. Any number in this
number system is written as 371o or (371)8.
4- HexaDecimal Number System:
The HexaDecimal Number System consist of 16 ALPHA-NUMERIC
values
Numeric Values: 09
Alphabetic : AF
Its base is 16. Any number in this Number system is represented as
24Fh or (24F)16.

Note: If any HexaDecimal Number is being started from an alphabet


such as F45h it is suggested to write 0 at the start like this 0F45h.

Following is digramatic Representation of Number Systemand its it


types.

Decimal 0,1,2,3,4,5,6,7,
NumberSystem 10
8,9

Binary Number 0,1 2


System

Number Systems

Octal Number 0,1,2,3,4,5,6,7 8


System

Hexa Decimal 0,1,2,3,4,5,6,7,8,


Number System 9 A,B,C,D,E,F 16
Inter Conversions of Number Systems:
The four number systems can also be interconverted into one another as per requirements.

1- Conversion from any base to base 10:


Any number from any base can be converted in to decimal number system by using the
following Formula

Formula:

Step 1: Identify the base of the number.


Step 2: Multiply each digit of the number by the Base. (d×Bn)
Step 3: Assign the Digit position to the base and start from extreme right.

i- Binary to Decimal:
To convert it into Decimal following the above steps:

TheBase of the number is 2, (identified by the suffix b)


Since Base=2, now we multiply each digit by the base and assigning it the digit
position.

For Example:

Convert 1000110b into Decimal Number system following the above steps.
ii- Octal to Decimal:
The same steps would be followed:
 The base of the given number is 8 (identifiedby the suffix o)
 Since Base=8, multiply each digit of the number by the base
 Assign base the digit position starting from extreme right

For Example:
Convert 243o into Decimal Number System.

iii- HexaDecimal to Decimal:


The following steps will be followed:
 Base of the given number is 16 (identified from the suffix h)
 Multiply each digit of the number by the base
 Assign base the digit position starting from extreme right. Add up all of
them.

For Example:
Convert 24AF into the Decimal Number system.
2- Decimal to any other Number System:
Any decimal number can be converted into any other number system by the following
steps

Step 1: Divide the number by the base into which you want to convert the decimal
number.
Step 2: Keep on dividing until the qoutient becomes less than the base.
Step 3: Now, start writing the number from top to bottom fashion.

i- Decimal To Binary

For Example:

Convert 124 into Binary Number System following the above steps:

ii- Decimal to Octal


For Example:

Convert 654 into the Octal Number System:

iii- Decimal to HexaDecimal

For Example:

Convert 45 into the Hexa Decimal Number System:

3- Conversion from Binary to anyother number system:


Binary number system can also be converted to any other number system.

i- Binary to Decimal:
This is same as discussed earlier in which every digit is multiplied by the base
with the respevctive digit position.

For Example:
Given Binary number is 1001b. Convert it into the Decimal Number System:

ii- Binary to Octal:


It is quite easy to convert a binary number to an octal number just by making
pairs of 3 bits,(from extreme right side) because the base of octal number
system is 8 and

2 3= 8

For Example:

Convert 1001b into the Octal Number system:

iii- Binary to HexaDecimal:


For this pirpose, we need to make pair of 4 bits (from the extreme right) because
the base of hexadecimal is 16 and

24 = 16
For Example:
Convert 10010b into the Hexa Decimal Numb er System:

4- Conversion from any other number system to Binary Number System:

i- Decimal to Binary

For Example:
Convert 109 into the Binary Number System

ii- Octal to Binary

For Example:
Convert 204o into the Binary Number system

iii- HexaDecimal to Binary


For Example:
Convert 2FE into Binary Number System

Summary:

Decimal Hexa Decimal Binary Octal

0 0 0000 0
1 1 0001 1

2 2 0010 2
3 3 0011 3
4 4 0100 4

5 5 0101 5
6 6 0110 6
7 7 0111 7
8 8 1000 10
9 9 1001 11
10 A 1010 12
11 B 1011 13
12 C 1100 14
13 D 1101 15
14 E 1110 16
15 F 1111 17

Assembly Language:
Assembly Language is a low level programming language for Microprocessors and other
programmable devices. It is not just a single language but rather a group of languages.
Assembly language implements a Symbolic Representation of the machine code needed to
programa given CPU Architecture.

Assembly language is the most basic programming language available for any processor.With
assembly language, aprogrammer works onlywith operations that afre implemented directly on
the physical CPU.

Assembler:
An Assembler is a typeof computer program that interprets software programs written in
assembly language int machine language, code and instructions that can be executed by the
computer.The Assembler is the COMPILER of assembly language.

An Assembler primarily serves as the Bridge between the symbolically coded instructions
written in assembly language and the computer processor, memory and other computational
components. “An Assembler works by assembling and converting the source code of assembly
language into object code or an object file that constitutes a stream of zeros and ones of
machine code which are directly executable by the processor.”

SOURCE CODE Assembler Machine Code


8086 Microprocessor Emulator:
8086 Microprocessor Emulator, also known as EMU8086 is an Emulator of the program 8086
Microprosessor. It is developed with a built in 8086 Assembler. This tool is prmarily designed to
copy or emulate hardware. These includes the memory of the program, CPU,RAM input and
output devices and even the display screen

 Works on 16 bits
 Registers= 16 bits
 16 bit ALU (Arithemetic Logic Unit
 16 bit External and Internal Data Bus EMU8086
 20 bit Address line to access memory
 220 = 1MB is the memory location
 16 bit address line to I/O devices
 216 = 64K I/O location

Conclusion:

___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
Experiment 2

OBJECTIVE:

“INTRODUCTION TO MOV COMMAND ARCHITECTURE OF 8086


MICROPROCESSOR”

Computer Architecture:

“Set of rules and methods that describe the


 Functionality
 Organization
 Implementation
of Computer System”.

The Computer Architecture involves

 Instruction set
 Architecture design
 Microarchitecture design
 Logic design
 Implementation

Basically Architecture is the behaviour of working of any device. Computer architecture is


aspecification detailing how a set of software and hardware technology standards interact to
form computer system or platform.In short computer architecture refers to how a computer
system is designed and what technologies are compatible with it.
A computer is a complex device containing many sub system. Each sub system is a piece of
computer hardware, the way these parts interact with each other is called Computer
Architecture.

The hardware of the computer consists of

 CPU – The BRAIN of the computer


 Motherboard – The SPINE of the computer
 Power Supply – The Stomach of the computer
 Bus – makes DATA TRAVEL around the computer
 Clock – tells the CPU to START THE NEXT INSTRUCTION
 Network Card – CONNECTION PROVIDER of the computer
 Monitor – The FACE of the computer
 Fans – For COOLING the system
 I/O Devices
 Memory
 Registers (1 clock cycle)
 Primary Cache
 Secondary Cache
 Fast RAM
 Fast Disk

Computer Memory is used to store data and programs which are the set of instructions, on a
temporary or permanent basis for use in an electronic digital computer.

Multiple functions are performed by the computer in a parallel function.The program for each
function is stored in the memory in the form of a chunks and every part is assigned its own task.
Each part has its own addresss in the memory so that whenever required can be easily
accessed.

Memory Chunks

2A411000 456HYY777 QW998IJ77


X I X
23WSD455Y 45RT6778K 34ERFY67Y

Registers:
A REGISTER is one of the small set of data holding places that are a part of the computer
processor. A register may hold an instruction, a storage address or any kind of datasuch as a
sequence or individual characters.

 Registers temporarirly stores data while processing.


 Register is a very fast computer memory used to store data and instructions while
execution.
 Regsiters are used to quickly accept, store and transfer data and instructions that are
being used immediately by the CPU.

Operations of Registers:
Registers perform the following operations:

 Fetch: The Fetch operation is used for taking instructions those are given
by the user and the instructions that are stored into the main memory will
be fetched by using the registers

 Decode: The decode operation is used for interpreting the instrutions


means the instructions are decoded i.e the processor will find out which
operation is to performed on the instructions.

 Execute: The execute operation is performed by the CPU.

Types of Registers:
With regards to the data and instructions there are 2 types of registers

Registers
Instruction Memory Registers
Registers

1- Instruction Registers:
The instruction registers (IR) fetch instructions from PC(Program Counter) and hold each
instruction as it is executed by the processor. It is also known as the Current Instruction
Registers (CIR) and it is the part of a CPU’s control unir that holds the instructions
currently being executed or decoed. In simple processors each instruction to be
executed is loaded into the instruction register(Loading ofRegister)which holds it
whole it is decoded, prepared and ultimately executed.

2- Memory Registers:
These Registers are used to pass data from the memory to theprocessor. It acts like a
BUFFER and holds any thing that is copied from t he memory ready for the processor to
use it.The Memory Data Register (MDR) holds the information before it goes to the
decoder.

Memory Registers

Memory Data Memory Address Memory Buffer


Registers (MDR) Register(MAR) Registers(MBR)
 16 Bit 8086 Microprocessor’s Registers:
The Registers of a 16 Bit 8086 Microprocessor are also 16 bit. The first CPU in Intel family is
8086. Registers inside 8086 are all 16 bit.
AL
 Categories of Rgisters in 8086 Microprocessor: AX
AH

BL
General Purpose BX
Registers BH

CX CL

CH

DX DL

DH

Code Segment
Segment Registers
Stack Segment
Registers of 8086
Data Segment
Micrprocessor
Extra Segment

Base Pointer
Index Registers
Stack Pointer

Source Index

Destination Index
Program Counter
Status and Control
Registers

Flags
1- GENERAL PURPOSE REGISTER:
8086 has the following 4 General Purpose Registers

i. AX – Accumulator Register.
ii. BX – Base Address Register.
iii. CX – Count Register.
iv. DX – Data Register.

i- AX Register: It is also a 16 bit register


 Generate sthe shortest machine code
 Arithmetic, logic and data transfer
 Least Utilization of Memory.
 Further divided into

1- AL : For the lower 8 bits


2- AH: For the high 8 Bits

For Example, if the number is 24F, converting it into binary we get

2 4 F

0010 0100 1111

00000010 High 8 bits in AH 01001111 Lower 8 Bits in AL


ii- BX Register: It is also a 16 bit Register. This Base Register acts as an
address holder of the base storage location from where data was stored
continuoulsy or serves as an Address register.
It is also divided into BL and BH (each of 8 bits).

Primary Storage Base Register

Base Address: It is a Unique location in primary storage or main memory that serves
as a reference point for other memory locations (absolute addresses).

And

Absolute Address: Absolute Addresses of each individual program instruction can be


specified by adding displacement (off-set) to the base address.

iii- CX Register:It is also a 16 Bit Register (further divided in CL and CH)


 Program Loop Instructions are facilitated by Count Register
 Serves as Loop Counter
 Repetetive operations on String with REP Command
 Count (in CL) for rotating and shifting of bits

Rotation of Bits: A rotation is an operation in which the bits which fall off at one end are put
back to the other end

For Left Rotation:

Suppose following number is given, if we want left rotation by 3, the left will be shifted by 3 and
the first 3 bits are put in the last.

11100101 00101111
For Right Rotation

Suppose following number is given, if we want right roattion by 3, the right will be shifted by 3
and last 3 bits are put in first .

11100101 10111100

Shifting of Bits: Bit Shifting is an operation done on all the bits of a binary value in which they
are moved by a determined number of places to either the left or rigt. It is also known as the bit
wise operation.

For Example,

if the value is 0001 after shifting to left, it becomes, 0010.

iv- DX Register: It is also a 16 bit Register futher divided into DL and DH each of
8 bits
 Used in Multiplication and Division Operations.
 Specifying ports in some IN and OUT operations.

64 Bits 32 Bits 16 Bits 8 Bits (High) 8 Bits (Lower)

RAX EAX AX AH AL

RBX EBX BX BH BL

RCX ECX CX CH CL

RDX EDX DX DH DL

2- SEGMENT REGISTERS:
These are also the 16 Bit Registers which are used as Base location for program instructions,
data or stack. Segment Registers work with the general purpose registers to access any memory
value. The address formed with 2 Registers is known as an Effective Address.

The Segment Registers are furhter divided into 4 Parts:

 CS – Code Segment: Points at the base location containing current program.


 DS – Data Segment: Base Address for data and multiple variables.
 SS – Stack Segement: Base Address for the stack.
 ES – Extra Segment: Additional Base address for the variable in memory (BackUp).

All the four segment registers are also 16 bit.


3. INDEX REGISTERS:
The index registers are also 16 bit registers and they contain the OFF SET from the
segment register for the information that we are interested about. They are further 4:
 BP – Base Pointer: offset from the SS Register to locate variable on the BASE OF
THE STACK.
 SP – Stack Pointer: Always points to the top item of stack.For Empty stack
SP=FFFEh
 SI – Source Index: Used for copying string.
 DI – Destination Index: from source to Destination.

4. STATUS AND CONTROL REGISTERS:


These are the special purpose Registers.

i- PC/IP: Program Counter or Instruction Pointer

“ This reguster stores address of the next instruction to be fetched


for execution. When instruction is fetched the value of IP isincremented
thus, this register always point towards/holds address of next intruction
to be fetched.”

ii- Flags:
They determine the current state of the processor. There are total of 16 flags
which are 16 bit but out of them “9 are Active flags”

 Carry Flag:
The Carry Flag is set to 1 if carry in addition or borrow in subtraction occurs
on the most significant bit during reuslt calculation (unsigned overflow).

For Example, When we add bytes, 255 + 1, the result is not in the range
0-255, therefore CF will set to 1

 Parity Flag:
It is set to 1 if there is EVEN NUMBER OF 1’s in the result

it is reset to 0 if there is ODD NUMBER OF 1’s in the Result

 Auxiliary Carry Flag:


If there is carry or borrow on the 4th bit then this flag
is set to 1.

 Zero Flag:
It is set to 1 when the result is 0.

 Sign Flag:
It is set to 1 when the result is Negative.

 Trap Flag:
It is used for Debugging. 8086 automatically do TYPE ZERO
ERROR.This means after each cycle the interrupt is invoked. This helps for
debugging the code for any error or abnormal condition.

 Interrupt Flag:
When this flag is set to 1, CPU automatically reacts to
Interrupts from external devices

 Direction Flag:
It is sued by some instructions to process data chains
when it is set, processing is done backward.

 OverFlow Flag:
This flag is set to 1 when,
Result is Too large positive number
Or
Result is too small negative number
To fit into the destination.

Status Flag: Reflect the result CarryF, ParityF,


of an operation by AuxiliaryF,ZeroF,
processor. SignF,OverflowF

FLAGS
Control Flag: Enable or
TrapF, InterruptF,
Disable operations executed
DirectionF
by processor
MOV Command:

The MOV instruction is the most important command in the 8086 because it moves data from
one location to another. It also has the widest variety of parameters; so it the assembler
programmer can use MOV effectively, the rest of the commands are easier to understand.

FORMAT:
MOV destination,source

The possible combinations of operands are as follows :

Destination Source Example


Register Register mov ax,bx
Register Immediate mov ax,10h
Register Memory mov ax,es:[bx]
Memory Immediate mov aNumber,10h
Memory Register mov aDigit,ax

MOV copies the data in the source to the destination. The data can be either a byte or a word.
Sometimes this has to be explicitly stated when the assembler cannot determine from the
operands whether a byte or word is being referenced.

The MOV instruction has a few limitations:

 an immediate value cannot be moved into a segment register directly (i.e. mov ds,10)
 segment registers cannot be copied directly (i.e. mov es,ds)
 a memory location cannot be copied into another memory location (i.e. mov
aNumber,aDigit)
 CS cannot be copied to (i.e. mov cs,ax)

These limitations can be overcome using indirect data movement through a general purpose
register as illustrated in the general format given above.

Each of the possible values for the destination and source is called an address. From the above
table it becomes apparent that there are a number of different addressing modes (immediate,
register, memory.

org 100h:
ORG (abbr. for ORiGin) is an assembly directive (not an instruction). It defines where the
machine code (translated assembly program) is to place in memory. As for ORG 100H this deals
with 80x86 COM program format (COMMAND) which consist of only one segment of max. 64k
bytes. 100H says that the machine code starts from address (offset) 100h in this segment,
effective address is CS:100H. For com format the offset is always 100H. Another example is ORG
7C00H for intel exe program format.

Programs:

Perform the following programs:

Program 1:Write a program in which you use MOV command.

Output 1:
Program 2:Write a program in which you MOV values of two different bases in registers and
then add them.

Output 2:

Conclusion:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Experiment 3
OBJECTIVE:

“THE BRIEF UNDERSTANDING OF DIFFERENT INTERRUPTS


USED IN EMU 8086 AND THEIR PROGRAM
IMPLEMENTATION”

INTERRUPTS:
It is a method of creating a temporary halt during program execution and allows peripheral
devices to access Microprocessor. Microprocessor respond to the interrupt with ISR (Interrupt
Service Routine) which is a short program that instructs the processor how to handle the
interrupt.”

An Interrupt is a hardware- or software- I nitiated call that interrupts the currently executing
program at any point and calls a procedure. The procedure is called by the interrupt handler or
an interrupt service procedure.

Interrupts are useful when an I/O device needs to be serviced only ocassionally at low data
transfer rates. An interrupt is a condition that halts the microprocessor temporarily to work on
a different task and then return to its previous task.

Interrupt Service Routine:


Interrupt Service Routine (ISR) is an Interrupt Handler. It is software process invoked by an
interrupt request. It handles the request and sent it to the CPU, interrupting active process.
When the ISR is completed the process is resumed.
Example:
A basic example of an ISR is a routine that handles keyboard events, such as pressing or
releasing a key. Each time a key is pressed, the ISR processes the input. For example, if you
press and hold the right arrow key in a text file, the ISR will signal to the CPU that the right
arrow key is depressed. The CPU sends this information to the active word processor or text
editing program, which will move the cursor to the right. When you let go of the key, the ISR
handles the "key up" event. This interrupts the previous "key down" state, which signals to the
program to stop moving the cursor.

Peripheral Device INTERRUPT


sends an INTERRUPT

The Micrprocessor

Program Currently
Program Resumed
Being Executed
Program currently
being Executed

Temporary halt due


to Interrupt
INTERRUPT
INTERRUPT Interrupt
Handled
SERVICE After being
by
ROUTINE serviced

TYPES OF INTERRUPTS
SOFTWARE HARWARE
INTERRUPTS INTERRUPTS

Software Interrupts:
A Software Interrupt is a type of interrupt that is caused either by a special instruction in the
instruction set or by an exceptional condition in the processor itself. A software interrupt is
invoked by a software, and is considered on of the ways to communicate with the kernel or to
invoke system calls, especially during error or exception handling.It’s also called trap.

EXAMPLES:

1.Acout (or) cin statement would generate a software interrupt because it would make a
system call to print something.

2. A fork() statement in Linux would generate a software interrupt because it would make a
system call to create a new process.

Types:

 Normal Interrupts: Tinterrupts which are caused by the software instructions are
called software instructions.

 Exception:Unplanned interrupts while executing a program is called Exception.


For example: while executing a program if we got a value which should be
divided by zero is called a exception.

Software Interrupt Instructions:

Following five are the Software Interrupt Instructions:

i. BOUND – Compares a Register with two words of memory data.


ii. INTO – Checks or tests the OVERFLOW Flag.
iii. INT – Calls ISR that begins at the address represented in vector number.
iv. INT 3 – Used as BREAKPOINT Interrupt.
v. IRET – Special Return Instruction retrieves return address from the stack.
Hardware Interrupts:
Hardware Interrupt is caused by any peripheral device by sending a signal through a specified
pin. This interrupt may be caused by keyboard, mouse, printer or even scanner.

Types of Hardware Interrupts:


The Hardware Interrupts are further of two types

 Maskable Interrupts
 Non Maskable Interrupts

Maskable Interrupts Non Maskable Interrupts

 A maskable interrupt is one that you  Non-maskable interrupts do not get


can ignore by setting (or clearing) a bit gated by the interrupt control register
in an interrupt control register. -- they ALWAYS interrupt, no matter
Typically your processor might allow what state your processor is in.
multiple interrupt sources, but your Typically these are used for CRITICIAL
design only requires some of them. or FATAL conditions, or for system
You would mask off the unused reset functions. If your system gets
interrupts so that noise on those lines stuck in an infinite loop with interrupts
doesn't cause problems. You might disabled, the NMI is your last hope to
also want to mask off interrupt sources reset the system.
that are real, but of lower priority at
particular points of your process.

 These interrupts can be rejected.  These interrupts can’t be rejected.

 For Example RST6.5,RST7.5, RST5.5 of  For Example Trap of 8085


8085.
Hardware Interrupt Pins:
There are 3 Hardware Interrupt Pins on the Microprocesssor as follows:

i. NMI – For NON MASKABLE INTERRUPTS


ii. INTR – For MASKABLE INTERRUPTS
iii. INTA – For ACKNOWLEDGING the interrupt.

NMI Interrupt Input

INTR

INTA Interrupt Output

Entire Procedure to handle the Interrupt:


Interrupt is a signal sent to the microprocessor by an external device who needs service from
micrprocessor. In response to the Interrupt the micrprocessor excute ISR to serve the interrupt.
ISR are sub routines only and they are different from User Defined Functions.

User Defined functions can be called by user through the instructions but ISR can’t be called by
User Throw Instructions. They are called by CPU when corresponding interrupt occurs.

To serve the interrupt CPU executes ISR by loading the ISR address in Program Counter.

Vector Interrupts: When the ISR addresses are known to CPU, these interrupts are known as
the Vector interrupts

WHEREAS
Non Vector Interrupts: In some cases, CPU simply doesn’t know the ISR addresses for the
particular interrupt. These are the non vector interrupts. In such cases, CPU has to ask the ISR
addresses to the CPU itself whohas generated the interrupts.

When the microprocessor receives an interrupt signal on INTR or NMI pin, it sends an
acknowledgement through INTA pin to the Peripheral devive which is requesting for the
service.

Sequence Of Events:
The following sequence of events occur when int pin goes high:

1. 8086 checks the status of INTR pin during the execution of each instruction.

2. If INTR signal is high, the 8086 completes its current instruction and sends active low
acknowledgement signal if the interrupt is enabled.

3. On receiving the instruction, 8086 save the address of next instructionon stack and
executes the received interrupt

Interrupt Vector Table:


It is a “DATA STRUCTURE” that associates the list of interrupt handles with a list of interrupt
request. Each entry of Interrupt Vector Table is called interrupt vector which is an address of
the interrupt handler.

Interrupt Vector

 It contains 256 different 4 byte interrupt vector (0 – 255).


IR ISR
 It conatins the Address (Segment+Offset) of the ISR.
 Syntax : IR ISR
INT TYPE
IR ISR

For Example:

Interrupt Vectors Purpose


INT 16h Keyboard Control, Read Strokes of Keyboard.
INT 13h For Storage purpose.
INT 21h To accept character from keyboard with echo and store it.
INT 10h Screen Manipulation, for graphing, text and video mode.

Programs executed on EMU 8086:

1- To display character to show on the screen using interrupts:

Output:

2- To change the colour of a single pixel using interrupts

Output:
LAB TASKS:

1- Difference between Error, Interrupt and Exception

2- Program to print “Hello World”using Interrupts:


Conclusion:

Experiment 4

OBJECTIVE:

“ INTRODUCTION TO DIFFERENT ADDRESSING MODES IN


EMU 8086”

ADDRESSING MODES:
The term “addressing modes” refers to the way in which the operand of an instruction is
specified. The addressing mode specifies a rule for interpreting or modifying the address field of
the instruction before the operand is actually executed.

An assembly language program instruction consists of two parts:

ASSEMBLY LANGUAGE
PROGRAM INSTRUCTION

OP- CODE (OPERATION OPERAND (On which the


CODE) operation is performed)
 Op Code: Op Code is the Operation Code which is to be performed.

whereas

 Operand:Operand is data on which the Operation Code is to be performed.

For Example:

MOV AX, 10h


OP-CODE OPERAND

The addressing mode is the method to specify the operand of an instruction. The job of a
microprocessor is to execute a set of instructions stored in memory to perform a specific task.

If we mathematically want to understand what is meant by Op Code or Operand,

2+2 We wanted to perform

Addition on two numbers

Operand Operand

Operation

Addressing Modes provide:


 Access to Operand
 Flexibile access to the memory
 Organized memory

Important Terms for Addressing modes:


 Starting address of memory segment.

 Effective address or Offset: An offset is determined by adding any combination of three


address elements: displacement, base and index.
 Displacement: It is an 8 bit or 16 bit immediate value given in the instruction.

 Base: Contents of base register, BX or BP. (Base Register or Base Pointer)

 Index: Content of index register SI or DI. (Source Index or Destination Index)

Combinations of Displacement, Base and Index Registers:


There are possibly “16 combiantions” of Displacement, Base and Index Registers as follows:

Direct [disp]

[BX]
Register
Indirect [SI]

[BP]

[BX+SI]

Combinations of Base, Based [BX+DI]


Index and Displacement Indexed
[BP+SI]

[BP+DI]

[BX+disp]

Register [BP+disp]
Relative
[SI+disp]

[DI+disp]
Displacement:
It is the 8 bit or 16 bit constant value or expression or label. For Example, 1234h.

Effective Address:

Base + (Index × Scale) + Displacement


Displacement — An 8-, 16-, or 32-bit value.
Base — The value in a general-purpose register.
Index — The value in a general-purpose register.
Scale factor — A value of 2, 4, or 8 that is multiplied by the index value.

The offset which results from adding these components is known as the “Effective Address”.

Note: Unsigned 16 bit number that expresses the operand’s distance in bytes from the
beginning of the segment in which it resides. (Segmentation - Expressed later)

Types of Addressing Modes:


There are the following types of Addressing Modes:

1- Immediate Addressing Mode


2- Implicit Addressing Mode
3- Direct Addressing Mode
4- Indirect Addressing Mode
5- Register Addressing Mode
6- Register Indirect Addressing Mode
7- Base Indexed Addressing Mode
8- Register Relative Addressing Mode
9- Relative Based Index Addressing Mode

These Addressing Modes are expressed as follows

1- Immediate Addressing Mode:

In immediate addressing “the operand is specified in the instruction” itself. In this


mode the data is 8 bits or 16 bits long and data is the part of instruction.

INSTRUCTION
DATA

For Example:

MOV AL, 35h ( MOVE the data 35h into AL Register)

Program Code:
Output:

2- Direct Addressing Mode:

The “operand’s offset is given in the instruction” as an 8 bit or 16 bit displacement


element. In this addressing mode the “16 bit effective address of the data is the
part of the instruction”.

INSTRUCTION MEMORY

OP CodeE.A DATA

For Example:

ADD AL, [0301] (Adds the contents of offset address 0301 to AL)

Program Code:
Output:

3- Register Addressing Mode:

In register addressing “the operand is placed in one of 8 bit or 16 bit general


purposeregisters”. The data is in the register that is specified by the instruction.

INSTRUCTION MEMORY
OP Code Register DATA

For Example:

MOV AX, CX (move the contents of CX register to AX register)

Program Code:
Output:

4- Register Indirect Addressing Mode:

In this addressing the operand’s “offset is placed in any one of the registers
BX,BP,SI,DI” as specified in the instruction. The effective address of the data is in the
base register or an index register that is specified by the instruction.

INSTRUCTION REGISTER MEMORY

OP code Register E.A DATA

For Example:

MOV AX, [BX] (move the contents of memory location addressed by the register
BX to the register AX)

Program Code:
Output:

5- Register Relative:

The operand’s offset is sum of an 8 bit or 16 bit displacement and the contents of
the base register BX or BP.BX is used as a base register for data segment ,and BP is
used as a base register for stack segment.

INSTRUCTION
OP Code Register
Displacement
E.A MEMORY
+ DATA

REGISTER
Address

For Example:

MOV AL, [BX+05] (05 is the displacement)

Program Code:
Output:

6- Based Indexed plus displacement addressing mode:

In this mode of addressing the operand’s offset is given by offset [BX or BP]+[SI or
DI]+8 bit or 16 bit displacement.

For Example

MOV AX, [BX+SI+05]

Program Code:
Output:

7- Based Indexed:

The operand’s offset is sum of the content of a base register BX or BP and an index
register SI or DI.

INSTRUCTION
REGISTER
OP CODE Base Register Index Register
INDEX

MEMORY
+ DATA
REGISTER
BASE
ADDRESS

For Example:
ADD AX, [BX+SI]

Program Code:

Output:

8- Indexed Addressing Mode:

The operand’s offset is the sum of the content of an index register SI or DI and an 8
bit or 16 bit displacement.

For Example:

MOV AX, [SI +05]

Program Code:
Output:

Lab Tasks:

Task No 01:

Write the programs for the following Addressing Modes

i- Base + Index Addressing Mode:

Program Code with its output

ii- Base + Offset Addressing Mode:

Program Code with its Output:


iii- Index + Offset Addressing Mode:

Program Code with its output:

iv- Base + Index + Offset Addressing Mode:

Program Code with its Output:


Task No 02:
What is SEGMENTATION?

Conclusion:

___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
Experiment 5

OBJECTIVE:

“IMPLEMENT THE IMMEDIATE, DIRECT AND INDIRECT


ADDRESSING MODES THROUGH PROGRAM EXAMPLES”

Implementation of Immediate Mode:


The mode in which the instruction contains the both Op-Code and data.

For Example: Write the program for following equation


(27 + 15) x (625 – 259) + 191

Program:
org 100h

MOV AX, 27

MOV BX, 625

SUB BX, 259

ADD AX, 15

MUL BX
MOV BX, 191

ADD AX, BX

RET

Code:

OUTPUT:

Implementation of Direct Mode:


The mode in which the instruction contains the Op-Code and Effective Address of data which is
placed in memory.

For Example: Write the program for Direct Addressing Mode.

Program:
org 100h

MOV AX, [num 1]

MOV BX, [num 2]

ADD AX, BX

MOV [num 4], AX

ADD BX, [num 4]

RET

Num 1 dw 5

Num 2 dw 10

Num 3 dw 15

Num 4 dw 0

Code:

OUTPUT:

Implementation of Indirect Mode:


The mode in which data is transferred to instruction indirectly.

For Example:Write the code for Indirect Addressing Mode

Program:
Org 100h

MOV BX, [num 1]

MOV AX, [BX]

ADD AX, 2

ADD AX, [BX]

ADD AX, 2

ADD AX, [BX]

ADD AX, 2

MOV [BX], AX

RET

num 1 : dw 5, 10, 15, 0

Code:

OUTPUT:
Conclusion:___________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
_________

Experiment 6

OBJECTIVE:

“TO UNDERSTAND THE ARITHMETIC OPERATIONS USING


PUSH AND POP COMMANDS”

Stack Organization:
It is a storage structure that stores information in such a way that the last stored element is the
first term revived and the first element stored is the last term revived.

Stack Principle:
Stack works on the principle of LIFO or FILO.

LIFO Last In First Out

FILO First in Last Out

Stack Pointer:
Stack in digital computers is a group of memory locations wit a register that holds the address
of the top of the element of the stack is called the stack pointer.

Top of the Stack:


The location through which the elements are inserted as well as removed is known as the top of
the stack. There is the restriction that all the insertion and deletion in the stack must be done
from the top. When there is no element in the stack then the top points towards null or void
which means no where.

Explanation:

Memory

SP SP+2 SP+4 SP+6

XYZ1238 XYZ1240 XYZ1242 XYZ1244

D C B A

SP points SP points with SP points with SP points with an


towards the an increment an increment of increment of 2
base address of 2 towards 2 towards the towards the base
of D and hence the base base address of address of A
it is inserted address of C B

A
B B
C C C
D D D D

STACK

Explanation:

TOP

A will be removed B will be removed


A B
B will be at TOP C will be at TOP
B C
C now at B position
C D D now at C position

D now at C position
D

C C will be removed D At the end, D will be


removed
D D now at C position

Resultant Empty Stack


‘A’ was entered LAST and it was revived First(LIFO)

‘D’ was entered FIRST and it was revived LAST (FILO)

Stack Operations:
There are two operations of the stack

1- PUSH: Insert an item on the top of the stack. (Overflow condition must be checked)

Program Code: Perform the “PUSH” Operation

Output:
2- POP: Delete an item from the top of the stack. (Empty stack condition must be checked).

Program Code: Perform the “POP” Operation on Registers:

Output:
Stack Segment:
It defines the area in the memory used for the stack. The stack entry point is determined by the
SS+SP register. Base pointer (BP) also addresses the data within the stack segment.

Operation of Stack Pointer:


A small register that shows the address of the last element, program pr request in the stack is
known as the Stack Pointer denoted by SP.

 When new data item is “pushed” on the top of the stack, the SP increments to the next
physical memory address and next item is copied to that address.

 When data is “popped” from top of the stack, the item is copied from the address of the
SP and the SP is decremented the next available item at the top of the stack.

Push(A) Pop(A)

A A

B B

C C

D D
Push Operation Pop Operation

Stack Implementation:
Stack is implemented in 2 ways:

Stack Implementation

Implementation by Implementation by
Architecture Data Structure

Register Stack Memory Stack By Array By Linked List


Conclusion:

___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________

Experiment 7
OBJECTIVE:

“TO PERFORM ADDITION WITH CARRY AND SUBTRACTION


WITH BORROW”

Addition with-Carry:
“An addition with carry instruction denoted by ADC adds the bit the carry flag (C) to the
operand data”.This instruction mainly appears in software that adds numners that are wider
than 16 bits in 8068-80286 or wider than 32 bits in the 80386-Core2.

The following Table lists several add-with-carry instructions,with comments that explain their
operation .Like the ADD instruction.ADC affects the flags after the addition .

Assembly Language Operation


ADC AL,AH AL = AL + AH + carry

ADC CX,BX CX = CX + BX + carry

ADC EBX,EDX EBX = EBX + EDX + carry

ADC RBX,0 RBX = RBX + 0 + carry (64 bit mode)


ADC DH,[BX] The byte contents of the data segment memory location
addressed by BX add to DH with the sum stored in DH
ADC BX,[BP+2] The word contents of the stack segment memory
locationaddressed by BP add to BX with the sum stored in BX
ADC ECX,[EBX] The doubleword contents of data segment memory location
addressed by EBX add to ECX with sum stored in ECX.

Explanation:
Consider the Fragment of the Code

ADD AX,CX

ADD BX,DX
Operation:
CF
AD
AD

BX AX

DX CX

BX CX

Suppose that a program is written for the 8086-80286 to add the 32 bit number in BX and AX to
the 32 bit number in DX and CX. The addition so that the placement and function of the carry
flag bit because the 8086-80286 onlt adds 8 or 16 bit numbers. The content of registers AX and
CX add to form the least significant 16 bits of the sum.This generation may or may not generate
a carry.A carry appears in the carry flaf if the sum is greater than FFFFH.

Program Code: Addition Without Carry:


Output:

Program Code: Addition with Carry:

Output:
CARRY FLAG:
In computer processors the carry flag (usually indicated as the C flag) is a single bit in a
system status register/flag register used to indicate when an arithmetic carry or borrow has
been generated out of the most significant arithmetic logic unit (ALU) bit position.

The carry flag enables numbers larger than a single ALU width to be added/subtracted by
carrying (adding) a binary digit from a partial addition/subtraction to the least significant
bit position of a more significant word. It is also used to extend bit shifts and rotates in a similar
manner on many processors (sometimes done via a dedicated X flag).

For subtractive operations, two (opposite) conventions are employed as most machines set the
carry flag on borrow while some machines (such as the 6502 and the PIC) instead reset the
carry flag on borrow (and vice versa).

For Example:

An example is what happens if one were to add 255 and 255 using 8-bit registers. The result
should be 510 which is 111111110 in binary, requiring 9 bits. The 8 least significant bits
always stored in the register would be 11111110 binary (254 decimal) but since there is carry
out of bit 7 (the eight bit), the carry is set, indicating that the result needs 9 bits. The valid 9-bit
result is the concatenation of the carry flag with the result.

The rules for turning on the carry flag in binary/integer math are two:

1. The carry flag is set if the addition of two numbers causes a carry
out of the most significant (leftmost) bits added.

1111 + 0001 = 0000 (carry flag is turned on)


2. The carry (borrow) flag is also set if the subtraction of two numbers
requires a borrow into the most significant (leftmost) bits subtracted.

0000 - 0001 = 1111 (carry flag is turned on)

Otherwise, the carry flag is turned off (zero).


* 0111 + 0001 = 1000 (carry flag is turned off [zero])
* 1000 - 0001 = 0111 (carry flag is turned off [zero])

In unsigned arithmetic, watch the carry flag to detect errors.


In signed arithmetic, the carry flag tells you nothing interesting.

Overflow Flag

The rules for turning on the overflow flag in binary/integer math are two:

1. If the sum of two numbers with the sign bits off yields a result number
with the sign bit on, the "overflow" flag is turned on.

0100 + 0100 = 1000 (overflow flag is turned on)

2. If the sum of two numbers with the sign bits on yields a result number
with the sign bit off, the "overflow" flag is turned on.

1000 + 1000 = 0000 (overflow flag is turned on)

Otherwise, the overflow flag is turned off.


* 0100 + 0001 = 0101 (overflow flag is turned off)
* 0110 + 1001 = 1111 (overflow flag is turned off)
* 1000 + 0001 = 1001 (overflow flag is turned off)
* 1100 + 1100 = 1000 (overflow flag is turned off)

Subtration with borrow:


“A subtraction with borrow (SBB) instruction function as a regular subtration,except that the
carry flag (C) ,which holds the borrow,also subtracts from the difference”.

The most common use for this instructions is for subtractions that are wider than 16 bits in the
8086-80286microprocessors or wider than 32 bits in the 80386-Core2.Wide subtractios require
that borrows propagate through the subtraction,just as wide addiitions propagate the carry.

Table lists several SBB instructions with comments that define their operations.
Assembly Language Operations
SBB AH,AL AH = AH – AL - carry

SBB AX,BX AX = AX – BX - carry


SBB EAX, ECX EAX = EAX – ECX - carry

SBB CL,2 CL = CL – 2 - carry

SBB RBP,8 RBP = RBP – 2- carry (64 bit mode)

When the 32 bit number held in BX and AX is subtracted from the 32 bit number held in SI and
DI, the carry flag propagates the borrow between the two 16 bit subtractions.The carry flag
holds the borrow for subtraction.

With wide subtraction,the least significant 16 and 32 bit data are subtracted with the SUB
instruction.All subsequent and more significant data are subtracted by using the SBB
instruction.

The following code explains:

SUB AX, DI

SBB BX,SI

CF
SBB SU

BX AX

SI DI

SI AX
Program Code: Subtraction without Borrow (SUB):

Output:

Program Code: Subtraction with Borrow (SBB)

Output:
Conclusion:

Experiment 8

OBJECTIVE:

“ TO UNDERSTAND SIGNED AND UNSIGNED


MULTIPLICATION AND DIVISION IN 8086”

Multiplication:
In multiplication if a number of 4 bit is multiplied with 4 bit number than answer will be in 8
bits. There are two types of multiplication signed multiplication and unsigned multiplication.

Un-signed Multiplication:
Multiplication of 4-bit by 4-bit. Answer will be in 8-bit.

Program # 01:
Org 100h
MOV AL, 0Ah
MOV BL, 02h
MUL BL
RET

Code and Output:


Program # 02:
Org 100h
MOV AL, 22h
MOV BL, 16h
MUL BL
RET

Code and Output:

Program # 03:
Org 100h
MOV AX, 02ECh
MOV BX, 4289h
MUL BX
RET

Code and Output:


Signed Multiplication:

Program # 04:
Org 100h
MOV AL 04h
MOV BL, 0FEh
iMUL BL
RET

Code and Output:

Division:
In division always a larger number is divided by a smaller number. If a number is completely
divisible on that number than we get 0 reminder and a quotient. The Re is stored in AH and Q is
stored in AL.

Un-signed Division:

Program # 05:
Org 100h
MOV AL, 24h
MOV BL, 08h
DIV BL
RET
Code and Output:

Signed Division:

Program # 06:
Org 100h
MOV AL, 24h
MOV BL, 0F8h
iDIV BL
RET

Code and Output:

Conclusion:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Experiment 9

OBJECTIVE:

“TO STUDY AND UNDERSTAND THE ASSEMBLY LANGUAGE


INSTRUCTIONS FOR BASIC OPERATIONS.”

AND Command:

Program:
Org 100h
MOV AL, 01001010b
AND AL, 11110000b
RET

Code and Output:


OR Command:

Program:
Org 100h
MOV AL, 81
OR AL, 22
RET

Code and Output:

NOT Command:

Program:
Org 100h
MOV AL, 81
NOT AL
RET

Code and Output:


TEST Command:

Program:
Org 100h
MOV AL, 0EF
MOV BL, 22H
Test AL, BL
RET

Code and Output:

Conclusion:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Experiment 10

OBJECTIVE:
“TO UNDERSTAND HOW JUMP COMMAND WORKS IN
ASSEMBLY LANGUAGE”

Jump Command:
The Jump instruction allow the programmer to set the value of EIP register. The EIP Register
always contains the address of the next instruction to be executed.

Syntax:
The syntax of Jump Command is given below:

JMP Variable Name

Types:
There are following two types of jump:

1. Unconditional Jump
2. Conditional Jump
Difference:
The difference between them is given bellow:

Unconditional Jump Conditional Jump


Simple Depends upon Condition
JMP Variable Name JC (Jump if Carry)
JNC (Jump if not Carry)
JZ (Jump if Zero)
JNZ (Jump if not Zero)

Programs of Unconditional Jumps:

Program No 01:
Org 100h

MOV AX, 05

MOV BX, 07

JMP PEN

ADD AX, BX

PEN: MUL BX

RET

Code and Output:


Program No 02:
Org 100h

MOV AX, 05

MOV BX, 02

JMP XYZ

BACK: JMP STOP

XYZ: ADD AX, BX

JMP BACK

STOP: RET

Code and Output:

Program of Conditional Jump:

Program No 03:
Org 100h

MOV AX, 07

MOV BX, 06
COMP AX, BX

JC XYZ

ADD AX, BX

XYZ: SUB AX, BX

Code and Output:

Program No 04:
org 100h

MOV AL, 07

MOV BL, 07

CMP AL, BL

JZ XYZ

ADD AL, BL

XYZ: SUB AX,BX

RET

Code and Output:


CONCLUSION:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Experiment 11
OBJECTIVE:

“TO STUDY AND UNDERSTAND THE FUNCTIONALLY OF ALL


FIVE LOOP INSTRUCTIONS AND THEIR IMPLEMENTATION IN
DIFFERENT SCENARIO.”

Counting Loop:
A common type of program loop is one that is controlled by an integer that counts up from an
initial value to an upper limit. Such a loop is called counting Loop. The integer is called loop
control variable.

Syntax:
Loop PEN

Conditional Loop:
Conditional Loop will execute after fulfilling of a specific condition.

Syntax:
Loopz PEN,

Loope PEN,

Loopnz PEN,
Loopne PEN

Program No. 01: Display ‘a’ five times.


Org 100h

MOV CX,5

PEN:MOV DX, ’a’

MOV AH, 2

Int 21h

LOOP PEN

RET

Code and Output:

Program No. 02:Display Table of 2.


Org 100h

MOV CX, 10

MOV DX, 48

PEN:ADD DX, 2

MOV AH, 2
Int 21h

RET

Code and Output:

Program No. 03:Show in Registers 5 ,10 ,15 ,20 ,25 in hexadecimal


Org 100h

MOV CX, 5

MOV AL, 5

PEN

ADD BL, 1

MUL BL

RET

Code and Output:


Program No. 04
Org 100h

Label 1

INC DX

LOOP Label 1

ADD CX, 4

Label 4:

INC DX

LOOPZ Label 4

Label 3:

SUB AX, BX

RET

Code and Output:

Conclusion:
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
__________________________________________________________________

Experiment 12

OBJECTIVE:

“ TO STUDY THE V. SK- 80386 LCD MODE AND LED LAMP


MODE ON THE TRAINER”

V. SK-80386:
THE 80386 MICROPROCESSOR STRUCTURE, the 80386DX is packaged in a 132-pin PGA (pin grid
array). Two versions of the 80386 are commonly available: the 80386DX, the other is the
80386SX, which is a reduced bus version of the 80386. Anew version of the 80386 Ex-
incorporates the AT bus system, dynamic RAM controller, programmable chip selection logic,
26 address pin, 16 data pins, and 24 I/0 pins . The 80386 DX addresses 4G bytes of memory
through its 32-bit data 32-bit address. The 80386 SK. more like the 80286, addresses 16M bytes
of memory with its 24-bit address bus via its 16-bit data bus. The 80386 SK was developed after
the 80386DX for applications that didn't require the full 32-bit bus version. The 80386SK is
found in many personal computers that use the same basic mother board design as the 80286.
At the time that the 80386SX was popular, most applications including windows required fewer
than 16M bytes of memory, so the 80386SK is a popular and a less costly version of the 80386
microprocessor. Even though the 80486 has become a less expensive upgrade path for newer
system, the 80386 still can be used for many applications. For example, the 80386 EX does not
appear in computer systems.
LED DISPLAY (ANY MESSEGE):

INPUT:
RES ; restart\ reset
2(LCD)
ENT
GO
6(OD)
0(EDIT)
0(EDIT)
0(EDIT)
:
0(EDIT)
ENT
ENT

OUTPUT:

LED GLOW:

INPUT:
RES
2(LED)
ENT
REG
ENT
ENT
ENT
9(IW)
7
4(OB)
ENT
8(IB)
7
4(OB)
ENT
5(OW)
8(IB)
0(EDIT)
.
5(OW)
5(OW)
5(OW)
5(OW)
ENT
OUTPUT:

CONCLUSION:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Experiment 13

OBJECTIVE:

“TO UNDERSTAND THE BRIEF INTRODUCTION ABOUT


MICROCONTROLLER”

MICROCONTROLLER:
Definition:

A microcontroller is a small, low cost and self-contained on-chip computer that can be used as
an embedded system. Microcontroller is a heart of embedded system.

Features:

A few microcontrollers may utilize four-bit expressions and work at clock rate frequencies,
which usually include:

 An 8 or 16 bit microprocessor.
 A little measure of RAM.
 Programmable ROM and flash memory.
 Parallel and serial I/O.
 Timers and signal generators.
 Analog to Digital and Digital to Analog conversion
Microcontrollers usually must have low-power requirements since many devices they control
are battery-operated. Microcontrollers are used in many consumer electronics, car engines,
computer peripherals and test or measurement equipment. And these are well suited for long
lasting battery applications. The dominant part of microcontrollers being used now a days are
implanted in other apparatus.

Types of microcontroller:

The microcontrollers are characterized regarding bus-width, instruction set, and memory
structure. For the same family, there may be different forms with different sources. This article
is going to describe some of the basic types of the Microcontroller that newer users may not
know about.

The types of microcontroller is shown in figure, they are characterized by their bits, memory
architecture, memory/devices and instruction set. Let’s discuss briefly about memory
architecture.

TYPES OF MICRO-
CONTROLLER

8051 micro- Advance Virtual Peripheral interface


controller RISC (AVR) controller (PIC)
Atmega328

Classification According to Number of Bits

The bits in microcontroller are 8-bits, 16-bits and 32-bits microcontroller.

Classification According to Memory Devices


The memory devices are divided into two types, they are
 Embedded memory microcontroller
 External memory microcontroller
Embedded memory microcontroller: When an embedded system has a microcontroller unit
that has all the functional blocks available on a chip is called an embedded microcontroller. For
example, 8051 having program & data memory, I/O ports, serial communication, counters and
timers and interrupts on the chip is an embedded microcontroller.

External Memory Microcontroller: When an embedded system has a microcontroller unit that
has not all the functional blocks available on a chip is called an external memory
microcontroller. For example, 8031 has no program memory on the chip is an external memory
microcontroller.

Classification According to Instruction Set


CISC: CISC is a Complex Instruction Set Computer. It allows the programmer to use one
instruction in place of many simpler instructions.

RISC: The RISC is stands for Reduced Instruction set Computer, this type of instruction sets
reduces the design of microprocessor for industry standards. It allows each instruction to
operate on any register or use any addressing mode and simultaneous access of program and
data.

Lab Task:

1- APPLICATIONS OF MICROCONTROLLER:

2-DIFFERENCE BETWEEN MICROCONTROLLER AND MICROPROCESSOR:


CONCLUSION:

______________________________________________________________________________
______________________________________________________________________________
_____________________________________________________________________________

Experiment 14

OBJECTIVE:

“ TO UNDERSTAND HOW TO USE ARDUINO(BOTH


IMPLEMENTING AND PROGRAMMING”

WHAT IS ARDUINO?
The Arduino UNO is an open-source microcontroller board is bases on
the Microchip ATmega328P microcontroller and developed by Arduino.cc.The board is
equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to
various expansion boards (shields) and other circuits.

PINS CONFIGURATION:

The 14 digital input/output pins can be used as input or output pins by using pinMode(),
digitalRead() and digitalWrite() functions in arduino programming. Each pin operate at 5V and
can provide or receive a maximum of 40mA current, and has an internal pull-up resistor of 20-
50 KOhms which are disconnected by default.

FEATURES OF ARDUINO:
 Microcontroller: Microchip ATmega328P
 Operating Voltage: 5 Volts
 Input Voltage: 7 to 20 Volts
 Digital I/O Pins: 14 (of which 6 provide PWM output)
 Analog Input Pins: 6
 DC Current per I/O Pin: 40 mA
 DC Current for 3.3V Pin: 50 mA
 Bound rate: 9600 bps
 Flash Memory: 32 KB of which 0.5 KB used by bootloader
 SRAM: 2 KB
 EEPROM: 1 KB
 Clock Speed: 16 MHz
 Length: 68.6 mm
 Width: 53.4 mm
 Weight: 25 g

EXAMPLE PROGRAM ON ITS ENVIRONMRNT:

1- Blink Program (Turn on LED for One second and Then turn it of, do it repeatedly

Code:

CONCLUSION:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Experiment 15

OBJECTIVE:

“INTRODUCTION OF DIFFERENT PROGRAMMING


COMMANDS USED IN ARDUINO IDE.

1- Read an analouge input on pin 0, converts it to voltage and print the


result to the serial monitor

Code:
2- Fading of LED:

Code:
Conclusion:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Experiment 16

OBJECTIVE:
“TO READ AN ANALOG INPUT PIN, CONTROL LED BRIGHTNESS ON PWM PIN
AND PRINT THE VALUES ON THE SERIAL MONITOR OF THE ARDUINO
SOFTWARE (IDE).”

Hardware Required:
 Arduino or Genuino Board

 Potentiometer

 Red LED

 220 ohm resistor

Circuit:
Procedure:
I. Connect one pin from your potentiometer to 5V, the center pin to analog pin A0 and the
remaining pin to ground.
II. Connect a 220 ohm current limiting resistor to digital pin 9, with an LED in series.
III. The long, positive leg (the anode) of the LED should be connected to the output from the
resistor, with the shorter, negative leg (the cathode) connected to ground.

Code:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the pot


int outputValue = 0; // value output to the PWM (analog out)

void setup() {
// initialize serial communications at 9600 bps:

Serial.begin(9600);
}

void loop() {
// read the analog in value:

sensorValue = analogRead(analogInPin);

// map it to the range of the analog out:

outputValue = map(sensorValue, 0, 1023, 0, 255);

// change the analog out value:

analogWrite(analogOutPin, outputValue);

// print the results to the Serial Monitor:

Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);

// wait 2 milliseconds before the next loop for the analog-to-digital


// converter to settle after the last reading:

delay(2);
}
Output:
.

Conclusion:

You might also like