Microprocessor Manual Master Copy Final
Microprocessor Manual Master Copy Final
Experiments Name
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.
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:
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.
Digit Position
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1000101110000110 1
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 (octa8), its digits
are (07). 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: 09
Alphabetic : AF
Its base is 16. Any number in this Number system is represented as
24Fh or (24F)16.
Decimal 0,1,2,3,4,5,6,7,
NumberSystem 10
8,9
Number Systems
Formula:
i- Binary to Decimal:
To convert it into Decimal following the above steps:
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.
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:
For Example:
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:
2 3= 8
For Example:
24 = 16
For Example:
Convert 10010b into the Hexa Decimal Numb er System:
i- Decimal to Binary
For Example:
Convert 109 into the Binary Number System
For Example:
Convert 204o into the Binary Number system
Summary:
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.”
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:
Computer Architecture:
Instruction set
Architecture design
Microarchitecture design
Logic design
Implementation
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
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.
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
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
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.
2 4 F
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
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
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,
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.
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.
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
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.
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
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.
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:
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:
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.
The Micrprocessor
Program Currently
Program Resumed
Being Executed
Program currently
being Executed
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.
Maskable Interrupts
Non Maskable Interrupts
INTR
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
For Example:
Output:
Output:
LAB TASKS:
Experiment 4
OBJECTIVE:
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.
ASSEMBLY LANGUAGE
PROGRAM INSTRUCTION
whereas
For Example:
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.
Operand Operand
Operation
Direct [disp]
[BX]
Register
Indirect [SI]
[BP]
[BX+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:
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)
INSTRUCTION
DATA
For Example:
Program Code:
Output:
INSTRUCTION MEMORY
OP CodeE.A DATA
For Example:
ADD AL, [0301] (Adds the contents of offset address 0301 to AL)
Program Code:
Output:
INSTRUCTION MEMORY
OP Code Register DATA
For Example:
Program Code:
Output:
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.
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:
Program Code:
Output:
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
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:
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:
Program Code:
Output:
Lab Tasks:
Task No 01:
Conclusion:
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
Experiment 5
OBJECTIVE:
Program:
org 100h
MOV AX, 27
ADD AX, 15
MUL BX
MOV BX, 191
ADD AX, BX
RET
Code:
OUTPUT:
Program:
org 100h
ADD AX, BX
RET
Num 1 dw 5
Num 2 dw 10
Num 3 dw 15
Num 4 dw 0
Code:
OUTPUT:
Program:
Org 100h
ADD AX, 2
ADD AX, 2
ADD AX, 2
MOV [BX], AX
RET
Code:
OUTPUT:
Conclusion:___________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
_________
Experiment 6
OBJECTIVE:
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.
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.
Explanation:
Memory
D C B A
A
B B
C C C
D D D D
STACK
Explanation:
TOP
D now at C position
D
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)
Output:
2- POP: Delete an item from the top of the stack. (Empty stack condition must be checked).
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.
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
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
Experiment 7
OBJECTIVE:
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 .
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.
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.
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.
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.
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
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.
SUB AX, DI
SBB BX,SI
CF
SBB SU
BX AX
SI DI
SI AX
Program Code: Subtraction without Borrow (SUB):
Output:
Output:
Conclusion:
Experiment 8
OBJECTIVE:
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
Program # 03:
Org 100h
MOV AX, 02ECh
MOV BX, 4289h
MUL BX
RET
Program # 04:
Org 100h
MOV AL 04h
MOV BL, 0FEh
iMUL BL
RET
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
Conclusion:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Experiment 9
OBJECTIVE:
AND Command:
Program:
Org 100h
MOV AL, 01001010b
AND AL, 11110000b
RET
Program:
Org 100h
MOV AL, 81
OR AL, 22
RET
NOT Command:
Program:
Org 100h
MOV AL, 81
NOT AL
RET
Program:
Org 100h
MOV AL, 0EF
MOV BL, 22H
Test AL, BL
RET
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:
Types:
There are following two types of jump:
1. Unconditional Jump
2. Conditional Jump
Difference:
The difference between them is given bellow:
Program No 01:
Org 100h
MOV AX, 05
MOV BX, 07
JMP PEN
ADD AX, BX
PEN: MUL BX
RET
MOV AX, 05
MOV BX, 02
JMP XYZ
JMP BACK
STOP: RET
Program No 03:
Org 100h
MOV AX, 07
MOV BX, 06
COMP AX, BX
JC XYZ
ADD AX, BX
Program No 04:
org 100h
MOV AL, 07
MOV BL, 07
CMP AL, BL
JZ XYZ
ADD AL, BL
RET
Experiment 11
OBJECTIVE:
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
MOV CX,5
MOV AH, 2
Int 21h
LOOP PEN
RET
MOV CX, 10
MOV DX, 48
PEN:ADD DX, 2
MOV AH, 2
Int 21h
RET
MOV CX, 5
MOV AL, 5
PEN
ADD BL, 1
MUL BL
RET
Label 1
INC DX
LOOP Label 1
ADD CX, 4
Label 4:
INC DX
LOOPZ Label 4
Label 3:
SUB AX, BX
RET
Conclusion:
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
__________________________________________________________________
Experiment 12
OBJECTIVE:
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:
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
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.
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:
______________________________________________________________________________
______________________________________________________________________________
_____________________________________________________________________________
Experiment 14
OBJECTIVE:
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
1- Blink Program (Turn on LED for One second and Then turn it of, do it repeatedly
Code:
CONCLUSION:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Experiment 15
OBJECTIVE:
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
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
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
analogWrite(analogOutPin, outputValue);
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(2);
}
Output:
.
Conclusion: