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

Sandeep.K.

H µP-µC - Lab Page 1


MICROPROCESSOR AND MICROCONTROLLER LABORATORY-15CSL48
IA Marks 20 Exam Marks 80

SOFTWARE PROGRAMS: PART A


1. Design and develop an assembly language program to search a key element “X” in a list of „n‟16-bit
numbers. Adopt Binary search algorithm in your program for searching.
2. Design and develop an assembly program to sort a given set of „n‟ 16-bit numbers inascending order. Adopt
Bubble Sort algorithm to sort given elements.
3. Develop an assembly language program to reverse a given string and verify whether it is apalindrome or not.
Display the appropriate message.
4. Develop an assembly language program to compute nCr using recursive procedure. Assumethat „n‟ and „r‟
are non-negative integers.
5. Design and develop an assembly language program to read the current time and Date from thesystem and
display it in the standard format on the screen.
6. To write and simulate ARM assembly language programs for data transfer, arithmetic andlogical operations
(Demonstrate with the help of a suitable program).
7. To write and simulate C Programs for ARM microprocessor using KEIL (Demonstrate withthe help of a
suitable program)

HARDWARE PROGRAMS: PART B


8. a. Design and develop an assembly program to demonstrate BCD Up-Down Counter (00-99)on the Logic
Controller Interface.
b. Design and develop an assembly program to read the status of two 8-bit inputs (X & Y)from the Logic
Controller Interface and display X*Y.
9. Design and develop an assembly program to display messages “FIRE” and “HELP”alternately with flickering
effects on a 7-segment display interface for a suitable period oftime. Ensure a flashing rate that makes it easy to
read both the messages (Examiner does notspecify these delay values nor is it necessary for the student to
compute these values).
10. Design and develop an assembly program to drive a Stepper Motor interface and rotate themotor in
specified direction (clockwise or counter-clockwise) by N steps (Direction and Nare specified by the examiner).
Introduce suitable delay between successive steps. (Anyarbitrary value for the delay may be assumed by the
student).
11. Design and develop an assembly language program to
a. Generate the Sine Wave using DAC interface (The output of the DAC is to bedisplayed on the CRO).
b. Generate a Half Rectified Sine waveform using the DAC interface. (The output of
the DAC is to be displayed on the CRO).
12. To interface LCD with ARM processor-- ARM7TDMI/LPC2148. Write and executeprograms in C language
for displaying text messages and numbers on LCD
13. To interface Stepper motor with ARM processor-- ARM7TDMI/LPC2148. Write a programto rotate stepper
motor

Conduction of Practical Examination:


· All laboratory experiments (all 7 + 6 nos) are to be included for practical examination.
· Students are allowed to pick one experiment from each of the lot.
· Strictly follow the instructions as printed on the cover page of answer script for breakup ofmarks
· PART –A: Procedure + Conduction + Viva: 10 + 25 +05 (40)
· PART –B: Procedure + Conduction + Viva: 10 + 25 +05 (40)
· Change of experiment is allowed only once and marks allotted to the procedure part to bemade zero.

Sandeep.K.H µP-µC - Lab Page 2


INTRODUCTION:
An assembly language is a low-level programming language for a computer. Assembly language is converted
into executable machine code by a utility program referred to as an assembler like NASM, MASM, TASM etc.
Assembler: which translates an assembly language program into a machine language program
Compiler: It is a program which translates a high level language program into a machine language program.
Compiler goes through the entire program and then translates the entire program into machine codes.
Interpreter: An interpreter is a program which translates statements of a program into machine code. It reads
only one statement of program, translates it and executes it.
Linker: Usually a longer program is divided into smaller subprograms called modules. And these modules
must be combined to execute the program. The process of combining the modules is done by the linker.
INTRODUCTION TO MASM
Writing an ALP
An editor is a program which allows you to create a file. This file is called a source file. Command to create a
source file
D:\MASM> Edit filename.asm
Assembling an ALP
D:\MASM>Masm filename.asm;
If the program is free from all syntactical errors, this command will give the OBJECT file. In case of errors it
list out the number of errors, warnings and kind of error. Note: No object file is created until all errors are
rectified.
Linking
After successful assembling of the program we have to link it to get Executable file.
The command is D:\MASM>Link filename.obj;
A Linker is a program used to join several object files into one larger object file. The linker produces a link file
with the .EXE extension (an execution file).
Executing the Program
To execute the program file use this command
D:\MASM\>filename; (OR)D:\Masm\>filename.EXE;
USING DEBUG TO EXECUTE 80X86 PROGRAMS:
DEBUG is a utility program that allows a user to load an 80x 86 programs in to memory and execute it step by
step. DEBUG displays the contents of all processor registers after each instruction executes, allowing user to
determine if the code is performing the desired task. To get a list of some commands available with DEBUG is:
Ttrace (step by step execution)
Uun assemble
D Dump
Ggo (complete execution)
QTo quit the execution
Structure of Program:
.model tiny/small//huge
.data ; Initialize datawhich is used in program.

.code ; Program logic goes here.

End

Sandeep.K.H µP-µC - Lab Page 3


DOS INTERRUPTS
INT 21H, Function 01H: Read character from standard input device.
INT 21H, Function 02H: Write character to standard output device.
INT 21H, Function 09H: Display the string
INT 21H, Function 2AH: Set system date
INT 21H, Function 2CH: Get system time
INT 21H, Function 3CH: Create File
INT 21H, Function 41H: To delete a file
INT 21H, Function 2AH: Get system date
INT 21H, Function 0AH: Read the entire string
INT 21H, Function 4CH: Terminate with Ret or Exit

BIOS INTERRUPTS
INT 10H, Function 00H: Set video mode
INT 10H, Function 03H: Set desired resolution
INT 10H, Function 02H: Set cursor position
INT 10H, Function 06H: Scroll rectangle window up
INT 10H, Function 07H: Scroll rectangle window down

Assembler directives:
.MODEL:Selects the programming model followed by size of the memory system (tiny, small or huge)
DUP:This directive is used to initialize several locations and to assign values to these locations.
EQU:This is used to assign names to the constant used in the program.

MACRO and ENDM: The MACRO directive informs the assembler the beginning of the macro. ENDM
indicates the end of the macro
DB: Defines byte (8 bits). DB directive is used to declare a byte type variable or to store a byte in memory
location.
.CODE: Indicates the start of the code segment
.DATA: Indicates the start of the data segment
.STACK: Selects the start of the stack segment
END: Ends a program file

13: represents carriage return i.e. takes the cursor to the left corner of same line and 10: represents
newline like \n in C

Jump allows the programmer to skip section of a program and branch to any part of the memory
for the next instruction. Near and Far jump
JA = jump if above JNC = jump if no carry
JAE = jump if above or equal JNE or JNZ = jump if not equal or not zero
JB = jump if below JNP or JPO = jump if no parity or parity odd
JBE = jump if below or equal JP or JPE = jump if parity or parity even
JC = jump if carry JG = jump if greater than
JE or JZ = jump if equal or zero JGE = jump if greater than or equal

Sandeep.K.H µP-µC - Lab Page 4


SOFTWARE PROGRAMS: PART A

1. a) Search a key element in a list of ‘n’ 16-bit numbers using the Binary search
algorithm.

.MODEL SMALL
.DATA
ARR DW 1234H,1235H,1236H,1237H,1238H
LEN DW ($-ARR)/2
SERKEY EQU 1237H
MSG1 DB "KEY IS FOUND AT"
RES DB" POSITION",13,10,"$"
MSG2 DB"KEY IS NOT FOUND$"
.CODE
MOV AX,@DATA ; INITIALIZE DATA SEGMENT REGISTER
MOV DS, AX
MOV BX, 00
MOV DX, LEN ; LOAD DX WITH LENGTH OF ARRAY
MOV CX, SERKEY ; LOAD CX WITH SEARCH KEY
AGAIN: CMP BX, DX
JA FAILURE
MOV AX, BX
ADD AX, DX
SHR AX, 01 ; DIVIDE ARRAY BY 2
MOV SI, AX
ADD SI, SI
CMP CX, ARR [SI]
JAE BIGGER;SEARCH KEY EQUAL OR BIGGER MOVE DOWNWARDS IN ARRAY
DEC AX
MOV DX,AX
JMP AGAIN

BIGGER: JE SUCCESS ;IF EQUAL SEARCH IS SUCCESSFUL


Sandeep.K.H µP-µC - Lab Page 5
INC AX
MOV BX,AX
JMP AGAIN
SUCCESS: ADD AL, 01 ; ADD 1 TO POSITION SINCE ARRAY STARTS FROM ZERO
ADD AL,'0' ;CONVERT POSITION TO ASCII
MOV RES,AL
LEA DX,MSG1 ;DISPLAY SUCCESS MESSAGE & TERMINATE
JMP FINISH
FAILURE: LEA DX,MSG2 ;DISPLAY FAIL MESSAGE
FINISH: MOV AH,09H
INT 21H
MOV AH,4CH ;TERMINATE PROGRAM NORMALLY
INT 21H
END

RESULT:
 [SEARCHKEY =1237H]
KEY IS FOUND AT 4 POSITION
 [Change SEARCHKEY =1239H, Run the program again ]
KEY IS NOT FOUND

A key algorithm for searching an array for a target value when the array is already sortedin ascending order is
called Binary Search. We start byexamining the middle element of the array. If it smaller than x than x mustbe
in the upper half of the array; if is greater than x thenit must be in the lower half.

To search an element 13 from the sorted array or list.


2 4 7 9 13 15

 As we can see the above array is sorted in ascending order, binary search is applied on sorted lists only,
so that we can make the search fast.
 Start with middle element
 If it is equal to the number we are searching then search is completed
 If it is less than it then move to the right
 If it is more than it then move to the left
 And then repeat till you find the number

Sandeep.K.H µP-µC - Lab Page 6


2) Sort a given set of ‘n’ numbers in ascending order using the Bubble Sort algorithm.
.MODEL SMALL
.DATA
A DB 1580H,1545H,1565H,1512H,1535H
LEN DW ($-A)/2
.CODE
MOV AX,@DATA ;INITIALIZE DATA SEGMENT REGISTER
MOV DS, AX
MOV BX, LEN ;LOAD BX WITH LENGTH OF ARRAY
DEC BX ;DECREMENT LENGTH BY 1,SINCE ARRAY STARTS FROM ZERO

OUTLOOP: MOV CX, BX


MOV SI,0 ;INITIALIZE ARRAY INDEX TO ZERO

INLOOP: MOV AX,A[SI]


ADD SI,2
CMP AX, A [SI] ; COMPARE TWO CONSECUTIVE NUMBERS
JB CONTINUE ; JA SHOULD BE USED FOR DESCENDING ORDER
XCHG AX, A[SI]
MOV A[SI-2],AX ;SWAP TWO ELEMENTS

CONTINUE: LOOP INLOOP ;GOTO COMPARE NEXT TWO ELEMENTS


DEC BX
JNZ OUTLOOP ;GOTO THE NEXT PASS
MOV AH,4CH ;TERMINATE PROGRAM NORMALLY
INT 21H
END

Result:
After running the program, debug; command is Debug filename.exe
-t (keep on pressing t until you get NOP)
Then give the command dump 0000 (You can see the sorted list )
12 22 34 56 62 78

 The simplest sorting algorithm is bubble sort.


 The bubble sort works by iterating down an array to be sorted from the first element to the last,
comparing each pair of elements and switching their positions if necessary.
 This process is repeated as many times as necessary, until the array is sorted.
 This algorithm is not suitable for large data sets.

Sandeep.K.H µP-µC - Lab Page 7


3) Reverse a given string and check whether it is a palindrome or not.

.MODEL SMALL
.DATA
STR1 DB 257 DUP (?)
REVERSE DB 257 DUP (?)
MSG1 DB 13,10 ,"ENTER A STRING: $"
MSG2 DB 13, 10,"STRING IS PALINDROME$"
MSG3 DB 13, 10,"STRING IS NOT PALINDROME$"

.CODE
MOV AX,@DATA ; INITIALIZE DATA & EXTRA SEGMENT REGISTER
MOV DS, AX
MOV ES, AX
LEA DX, MSG1 ; DISPLAY ENTER THE STRING MESSAGE
MOV AH, 09H
INT 21H
MOV SI, 0

L1: MOV AH, 01H ; READ THE STRING


INT 21H
CMP AL, 0DH
JZ L2
MOV STR1 [SI], AL
INC SI
JMP L1

L2: MOV CX, SI ; REVERSE THE STRING


MOV SI, 0
MOV DI, CX
DEC DI
MOV DX, CX

L3:MOV AL, STR1 [SI]


MOV REVERSE [DI], AL
INC SI

Sandeep.K.H µP-µC - Lab Page 8


DEC DI
LOOP L3
MOV CX, DX ; COMPARE THE STRING & DISPLAY APPROPRIATE MESSAGE
LEA SI, STR1
LEA DI, REVERSE
CLD
REPE CMPSB
CMP CX, 00H
JNZ NOTEQUAL
LEA DX, MSG2 ; DISPLAY PALINDROME MESSAGE
MOV AH, 09H
INT 21H
JMP FINISH

NOTEQUAL: LEA DX, MSG3 ; DISPLAY NOT PALINDROME MESSAGE


MOV AH, 09H
INT 21H
FINISH: MOV AH, 4CH ; TERMINATE PROGRAM NORMALLY
INT 21H
END

Result:
ENTER A STRING: MADAM
STRING IS PALINDROME
ENTER A STRING: BRINDAVAN
STRING IS NOT PALINDROME
A palindrome is a word or a number or a sequence of words that can be read the same way from either
direction, forwards or backwards. Punctuation and spaces between the words or lettering is allowed.
Ex:level, noon, madam, radar, refer, repaper, rotator, wow, mygym, topspot, nolemon nomelon

Sandeep.K.H µP-µC - Lab Page 9


n
4) Compute Cr using recursive procedure. Assume that ‘n’ and ‘r’ are non-negative integers.
.MODEL SMALL
.DATA
N DW 5
R DW 2
NCR DW 0
.CODE
MOV AX,@DATA; INITIALIZE DATA SEGMENT REGISTER
MOV DS,AX
MOV AX,N
MOV BX,R
CALL NCRPRO
MOV AH,4CH
INT 21H
NCRPRO PROC NEAR
CMP BX,0
JE RES1
CMP AX,BX
JE RES1
CMP BX,1
JE RESN
DEC AX
CMP BX,AX
JE L1
PUSH AX
PUSH BX
CALL NCRPRO ; THE COMBINATIONS FORMULA IS = N! / (N - R)! . R!
POP BX
POP AX
DEC BX
PUSH AX
PUSH BX
CALL NCRPRO
POP BX
POP AX
RET
RES1:INC NCR
RET
L1:INC NCR
RESN:ADD NCR,AX
RET
NCRPRO ENDP
END RESULT: 5C2=A

A combination is a way of selecting items from a collection, such that (unlike permutations) the order
of selection does not matter.

Sandeep.K.H µP-µC - Lab Page 10


5) Read the current time from the system and display it in the standard format on the screen.

.MODEL SMALL
.DATA
MSG1 DB 13, 10,"CURRENT TIME IS: $"
MSG2 DB 13, 10,"CURRENT DATE IS: $"

.CODE
MOV AX,@DATA ; INITIALIZE DATA SEGMENT REGISTER
MOVDS, AX
LEA DX, MSG1
MOV AH, 09H
INT 21H
MOV AH, 2CH ; DOS INTERRUPT TO GET THE SYSTEM TIME. WHEN THIS IS EXECUTED, AUTOMATICALLY
INT 21H CH CONTAINS HOUR, CL CONTAINS MINUTE, DH SECONDS AND DL MILISECONDS

MOV AL, CH
CALL DISP ; DISPLAY HOUR
MOV DL,':'
MOV AH, 02H
INT 21H

MOV AL,CL ; DISPLAY MINUTE


CALL DISP
MOV DL,':'
MOV AH, 02H
INT 21H

MOV AL, DH ; DISPLAY SECONDS


CALL DISP

LEA DX,MSG2
MOV AH,09H
INT 21H

MOV AH, 2AH ; DOS INTERRUPT TO GET THE SYSTEM DATE.


INT 21H

MOV AL, DL
CALL DISP ; DISPLAY DAY

MOV DL,'/'
MOV AH,02H
INT 21H

MOV AL, DH
CALL DISP ; DISPLAY MONTH

Sandeep.K.H µP-µC - Lab Page 11


MOV DL,'/'
MOV AH,02H
INT 21H

ADD CX,0F830H ; DISPLAY YEAR


MOV AL,CL
CALL DISP

MOV AH, 4CH


INT 21H

DISP PROC
AAM
ADD AX,3030H
MOV BX,AX
MOV DL,BH
MOV AH,02H
INT 21H
MOV DL,BL
MOV AH,02H
INT 21H
RET
DISP ENDP
END

Result:
Current Time is: 10:45:20
Current Date is: 10/4/17

Sandeep.K.H µP-µC - Lab Page 12


6. To write and simulate ARM assembly language programs for data transfer, arithmetic and
logical operations (Demonstrate with the help of a suitable program).

AREA ADDITION , CODE , READONLY


LDR R0,=0X1234
LDR R1,=0X4321
ADD R2,R0,R1
NOP
END

O/P = 0x00005555

AREA LOGICAL , CODE , READONLY


LDR R0,= 0X55AAAA55
LDR R1,=0X5555AA55
AND R2,R0,R1
NOP
END

O/P = 0x5500AA55

AREA TRANSFER , CODE, READONLY


LDR R1,=VALUE1 ; LOADS THE ADDRESS OF FIRST VALUE
LDR R2,[R1]
LDR R4,=RESULT ; LOADS THE ADDRESS OF RESULT
STR R2,[R4] ; STORES THE RESULT IN R2
VALUE1 DCD 0X4535
AREA DATA2, DATA, READWRITE ; TO STORE RESULT IN GIVEN ADDRESS
RESULT DCD 0X1
END ; Mark end of file

O/P = 0x40000000 35 45

Sandeep.K.H µP-µC - Lab Page 13


7. To write and simulate C Programs for ARM microprocessor using KEIL (Demonstrate with
the help of a suitable program)

#include<lpc214x.h>
#include<stdio.h>
main()
{
int a=6,b=2,sum,mul,sub,div;
sum=a+b;
mul=a*b;
sub=a-b;
div=a/b;
}

O/P
r5 =0x00000006
r6 =0x00000002
r7 =0x00000008
r8 =0x0000000C
r9 =0x00000004
r10 =0x00000003

Sandeep.K.H µP-µC - Lab Page 14


HARDWARE PROGRAMS: PART B

 The strengthof8086processorliesinitsabilitytocommunicate withthe real-worldentities.Soit


findsvariousapplicationsinthe real-worldlike controloflogic controller,openandclosingofthe
door,elevatorcontroletc.
 Thisisdone by interfacing8086processorwiththe real-worldentitiesthroughsomeinterfacingdevices.
 The mostcommonlyusedinterfaceis8255programmableperipheralinterface.
 82C55 can be programmed such that it can acts as i/p port or it can be acts as o/p port
 Modes of operation of 82C55:
i) I/O mode
ii) Bit Set Reset (BSR) mode
8255 operational modes
Mode-0:- simple I/O
Mode –1:- handshake I/O
Mode 2:- Bidirectional bus

CONTORL WORD FORMAT 0F 82C55

In logic controller state of each input/output is indicated by a corresponding LED (ON/OFF)

Sandeep.K.H µP-µC - Lab Page 15


8A) Implement a BCD up-down counter on the logic controller interface.
.MODEL SMALL
.DATA
PA EQU 0E880H ; initialization of port-A address
PB EQU 0E881H ; initialization of port-B address
PC EQU 0E882H ; initialization of port-C address
CREQU0E883H ; initialization of control word register address
CW EQU82H ; initialization of control word to make PA and PC -O/P and PB – I/P
.CODE
MOV AX,@DATA
MOV DS, AX
MOV DX, CR
MOV AL,CW
OUT DX,AL

MOV AL,00H ; count starts at „0‟


MOV DX,PA
L1: OUT DX,AL
CALL DELAY ; delays to slow down the BCD count
INC AL ; increment from 0
CMP AL, 99 ; if it is 99 go to L2, else loop back to L1
JNE L1 ;or JNE or JB L1
L2: OUT DX,AL ;if it is 9, the control jumps to L2, hence it is "printed"
CALL DELAY
DEC AL ; decrement from 9 to 0
CMP AL,00H
JGE L2
MOV AH,4CH
INT 21H
DELAY PROC NEAR ;delay procedure needed in between count
PUSH AX
PUSH CX
MOV CX,5FFFH
L3: MOV AX,0FFFFH
L4: DEC AX
JNZ L4
LOOP L3
POP CX
POP AX
RET
DELAY ENDP
END
OUTPUT:
0000 ………. 1001 to 1001 ……………. 0000
Sandeep.K.H µP-µC - Lab Page 16
8 B) Read the status of two 8-bit inputs (X & Y) from the logic controller interface
.MODEL SMALL
.STACK
.DATA
PA EQU 0E880H
PB EQU 0E881H
PC EQU 0E882H
CR EQU 0E883H
CW EQU 82H

MSG DB "ENTER X AND Y FROM THE INTERFACE KIT : $"

.CODE
MOV AX,@DATA
MOV DS,AX
MOV DX,CR
MOV AL,CW
OUT DX,AL

LEA DX, MSG


MOV AH,09H
INT 21H

MOV AH,01H
INT 21H
MOV DX,PB
IN AL,DX
CALL DELAY

MOV BL,AL

MOV AH,01H
INT 21H
MOV DX,PB
IN AL,DX
CALL DELAY

MUL BL

MOV DX,PA
OUT DX,AL

MOV AH,4CH
INT 21H

Sandeep.K.H µP-µC - Lab Page 17


DELAY PROC NEAR ;DELAY PROCEDURE NEEDED IN BETWEEN COUNT
PUSH AX
PUSH CX
MOV CX,5FFFH
L2: MOV AX,0FFFFH
L3: DEC AX
JNZ L3
LOOP L2
POP CX
POP AX
RET
DELAY ENDP
END

OUTPUT:

ENTER X AND Y FROM THE INTERFACE:

0011 from switch (check at Port-B)


0010

0110 At Port-A( check at Red LED )

The program performs the multiplication between two bytes and gives the result.Result will be
displayed on the port A of the logic controller.

Sandeep.K.H µP-µC - Lab Page 18


9) Display messages FIRE and HELP alternately with flickering effects on a 7-segment display interface
for a suitable period of time. Ensure a flashing rate that makes it easy to read both the messages.
.MODEL SMALL
.STACK
.DATA
FIRE DB 71H,30H,31H,79H,0,0,0
HELP DB 76H,79H,38H,73H,0,0,0
PAEQU 0E880H
PBEQU 0E881H
PCEQU 0E882H
CREQU 0E883H
CWEQU 80H
.CODE
MOV AX,@DATA
MOVDS,AX
MOVAL,CW
MOVDX,CR
OUTDX,AL
CALL DELAY
MOVDX,PC
MOV AL,07H ; initialization of seven segment display
OUTDX,AL
MOV CX, 05H ; number of times to be display the message
IT: CALL FIRE1
CALL DELAY
CALL HELP1
LOOP IT
MOV AH,4CH
INT 21H
FIRE1: PUSH CX
MOV CX, 0FFH ; flashing rate in between fire and help
XX: MOV BL, 05H ; 5 segment are needed to display FIRE$
MOVSI, OFFSET FIRE
LOOP1: MOVAL, BL
MOVDX, PC ; initialize the 5 blocks
OUTDX, AL
MOVDX, PA
LODSB
OUTDX, AL
CALL DELAY
DEC BL
JNZ LOOP1
LOOP XX
POP CX
RET
HELP1:PUSH CX
Sandeep.K.H µP-µC - Lab Page 19
MOV CX,0FFH ; flashing rate in between fire and help
XX1:MOV BL,05H ; 5 segment are needed to display HELP$
MOVSI,OFFSET HELP
LOOP2:MOVAL,BL
MOVDX,PC ; initialize the 5 blocks
OUTDX,AL
MOVDX,PA
LODSB
OUTDX,AL
CALL DELAY
DECBL
JNZ LOOP2
LOOP XX1
POP CX
RET

DELAY PROC NEAR


PUSH AX
PUSH CX
MOV CX,0FFH
L2: MOV AX,0FFFFH
L3: DEC AX
JNZ L3
LOOP L2
POP CX
POP AX
RET
DELAY ENDP
END

Output:
This program displays “FIRE” and “HELP” on seven segment display interface

Sandeep.K.H µP-µC - Lab Page 20


10) Drive a stepper motor interface to rotate the motor in specified direction (clockwise or
counter-clockwise) by n steps. Introduce suitable delay between successive steps.
.MODEL SMALL
.DATA
PA EQU 0E880H
PB EQU 0E881H
PC EQU 0E882H
CR EQU 0E883H
CW EQU 82H
.CODE
MOVAX,@DATA
MOVDS,AX
MOVDX,CR
MOVAL,CW
OUTDX,AL
MOV AL,88H
MOV CX,100
L1: MOVDX,PC
OUTDX,AL
CALL DELAY
ROL AL,01 ; (note: for clockwise direction ROR should be used instead of ROL)
LOOP L1
MOV AH,4CH
INT 21H

DELAY PROC NEAR


PUSH AX
PUSH CX
MOV CX,5FFFH
L2: MOV AX,0FFFFH
L3: DEC AX
JNZ L3
LOOP L2
POP CX
POP AX
RET
DELAY ENDP
END
Output:
 A stepper motor is a digital motor because it is moved in discrete stepsas it traverses through
360°.
 The step position codes are 11H, 22H, 44H, and 88H.

Sandeep.K.H µP-µC - Lab Page 21


 82C55A is used to provide the drive signals that are used to rotate the armature of the motor in
either the right-hand or left-hand direction.

The reason for using a stepper motor is to achieve precise control: you can make it move through a
defined angle. But there are drawbacks too. Stepper motors can sometimes be quite jerky, because they
start and stop each step with a sudden impulse, which isn't always what you want if you're trying to
build a precision machine.

Sandeep.K.H µP-µC - Lab Page 22


11 A) Generate the sine wave using DAC interface (the output of the DAC is to be displayed on the
CRO).

.MODEL SMALL
.STACK
.DATA
PA EQU 0E880H
PB EQU 0E881H
PC EQU 0E882H
CR EQU 0E883H
CW EQU 80H

X DB 80H,90H,0A1H,0B1H,0C0H,0CDH
DB 0DAH,0E5H,0EEH,0F6H,0FBH,0FEH,0FFH
DB 0FEH,0FBH,0F6H,0EEH,0E5H,0DAH
DB 0CDH,0C0H,0B1H,90H,80H ; values of „ Ɵ „
DB 70H,5FH,4FH,40H,33H,26H
DB 1BH,12H,0AH,05H,02H,00H
DB 02H,05H,0AH,02H,12H,1BH,26H
DB 33H,40H,4FH,5FH,70H

LENDW $-X

.CODE
MOVAX,@DATA
MOVDS,AX
MOV AL, CW
MOVDX,CR
OUTDX,AL

MOV BP,07H
AGAIN:MOV BX,0FFFFH
L2:MOVCX,LEN ; CX = 48
LEASI,X
MOVDX,PA
L1:MOV AL,[SI]
OUTDX,AL
INC SI
LOOP L1
DECBX
JNZ L2
DECBP
JNZ AGAIN
MOV AH,4CH
INT 21H
END

Sandeep.K.H µP-µC - Lab Page 23


DAC: Digital to analog converter:
 DAC transforms a binary number into an analog voltage.
 Dual DAC interface can be used to generate different interesting waveforms using µP

Formulae for calculate Ɵ is:


Ɵ = 128 + 128 x Sine Ɵ

Put Ɵ values as 0, 7.5, 15, 22.5, 30 …………….. 353

Observe the waveform in CRO and Draw it neatly

Sandeep.K.H µP-µC - Lab Page 24


11 B) Generate a half rectified sine wave form using the DAC interface. (The output of the DAC is to be
displayed on the CRO).
.MODEL SMALL
.STACK
.DATA
PA EQU 0E880H
PB EQU 0E881H
PC EQU 0E882H
CR EQU 0E883H
CW EQU 80H
X DB 80H, 90H, 0A1H, 0B1H, 0C0H, 0CDH
DB 0DAH, 0E5H, 0EEH, 0F6H, 0FBH, 0FEH, 0FFH
DB 0FEH, 0FBH, 0F6H, 0EEH, 0E5H, 0DAH
DB 0CDH, 0C0H, 0B1H, 90H, 80H
DB 80H, 80H, 80H, 80H, 80H, 80H
DB 80H, 80H, 80H, 80H, 80H, 80H, 80H
DB 80H, 80H, 80H, 80H, 80H, 80H
DB 80H, 80H, 80H, 80H, 80H
LENDW $-X
.CODE
MOV AX,@DATA
MOV DS, AX
MOV AL, CW
MOV DX, CR
OUT DX, AL
MOV BP, 07H
AGAIN: MOV BX, 0FFFFH
L2: MOV CX, LEN
LEA SI, X
MOV DX, PA
L1: MOV AL, [SI]
OUT DX, AL
INC SI
LOOP L1
DEC BX
JNZ L2
DEC BP
JNZ AGAIN
MOV AH, 4CH
INT 21H
END
Output:

Sandeep.K.H µP-µC - Lab Page 25


12. To interface LCD with ARM processor-- ARM7TDMI/LPC2148. Write and execute programs in C
language for displaying text messages and numbers on LCD

#include<LPC214X.H>
// #include<stdlib.h>
// #include<string.h>
#define EN (1 << 10) //enable set to pin 10
#define RW (1 << 12) //RW set to pin 11
#define RS (1 << 13) //RS set to pin 13
// #define BUZZ (1 << 25)
#define DATA (0Xff << 15) // Data pin selection from P0.15 to P0.22
#define port EN | RW | RS | DATA // define all to port

void delay(int count);


void cmd(int c);
void data(char d);
void cmd(int c) // Command mode RS=0, RW=0, En=1 then EN=0
{
IOPIN0 = c << 15; // Sending data(cmd) to data pins
IOCLR0 = RW;
IOCLR0 = RS;
IOSET0 = EN;
delay(25);
IOCLR0 = EN;

}
void data(char d) // DATA mode RS=1, RW=0, En=1 then EN=0
{
IOPIN0 = d << 15; // Sending data to data pins
IOCLR0 = RW;
IOSET0 = RS;
IOSET0 = EN;
delay(25);
IOCLR0 = EN;
}
void delay(int count)
{
int i,j;
for(i = 0;i < count;i++)
for(j = 0;j < 5000;j++);
}

int main()
{

char *string_1 = " WELCOME TO ";


char *string_2 = " VTU ";

IODIR0 |= port; // set all port once


// IODIR0 |= ((1 << 5) | (1 << 6));

Sandeep.K.H µP-µC - Lab Page 26


cmd(0x38); /* //Function Set Command : 8 Bit Mode , 2 Rows , 5x10 Font Style. */
cmd(0x0E); //Display Switch Command : Display on , Cursor on , Blink on
cmd(0x01); /* LCD clear */
cmd(0x80); // Select 1st Row & 1st col
while(*string_1)
{
data(*string_1);
string_1++;
}
cmd(0xc0);// bring the cursor down

while(*string_2)
{
data(*string_2);
string_2++;
}

Output:
WELCOME TO VTU

Sandeep.K.H µP-µC - Lab Page 27


13. To interface Stepper motor with ARM processor-- ARM7TDMI/LPC2148. Write a program to rotate
stepper motor

Main.C
#include "lpc21xx.h"
#include "motor.h"
int main(void)
{
init_motor();
while(1)
{
// rotate_motor_clock_wise();
rotate_motor_anticlock_wise();
}

Motor.C
#include "LPC214x.H"
#include "motor.h"
#definePIN1 (1<<27)
#definePIN2 (1<<28)
#definePIN3 (1<<29)
#definePIN4 (1<<30)

void init_motor()
{
IODIR1 = (PIN1|PIN2|PIN3|PIN4);
}
void rotate_motor_anticlock_wise()
{
unsigned char i;
// for(i=0;i<25;i++)
{
IOCLR1 = (PIN1|PIN2|PIN4);
IOSET1 = PIN3;
delay();

IOCLR1 = (PIN3|PIN2|PIN4);
IOSET1 = PIN1;
delay();

IOCLR1 = (PIN1|PIN3|PIN2);
IOSET1 = PIN4;
delay();

IOCLR1 = (PIN1|PIN3|PIN4);
IOSET1 = PIN2;
delay();
}

Sandeep.K.H µP-µC - Lab Page 28


}

void rotate_motor_clock_wise()
{
unsigned char i;

// for(i=0;i<25;i++)
{
IOCLR1 = (PIN2|PIN3|PIN4);
IOSET1 = PIN1;
delay();

IOCLR1 = (PIN1|PIN2|PIN4);
IOSET1 = PIN3;
delay();

IOCLR1 = (PIN1|PIN3|PIN4);
IOSET1 = PIN2;
delay();

IOCLR1 = (PIN1|PIN2|PIN3);
IOSET1 = PIN4;
delay();
}
}

void delay()
{
int i,j;
for(i=0;i<10000;i++)
{
for(j=0;j<50;j++)
{
continue;
}
}
}

Motor.h
extern void init_motor(void);

extern void rotate_motor_clock_wise(void);

extern void rotate_motor_anticlock_wise(void);

extern void delay(void);

Sandeep.K.H µP-µC - Lab Page 29


Viva Questions and Answers
What is a Microprocessor?
Microprocessor is a programmable electronic device that controls the interpretation and execution of the
instructions. Micro refers to small size and the processor refers to the device that performs computational and
control operation.
What is Bandwidth?
The number of bits processed by the processor in a single instruction.
What is Clock Speed?
Clock speed is measured in the MHz and it determines that how many instructions a processor can processed.
The speed of the microprocessor is measured in the MHz or GHz.
What are the features of Intel 8086?
Features:
 Released by Intel in 1978
 A 16-bit microprocessor chip.
 Max. CPU clock rate: 5 MHz to 10 MHz
 Instruction set: -16
 Package: 40 pin DIP
 16-bit Arithmetic Logic Unit
 16-bit data bus (8088 has 8-bit data bus)
 20-bit address bus
What is Logical Address:?
A memory address on the 8086 consists of two numbers, usually written in hexadecimal and separated by a
colon, representing the segment and the offset. This combination of segment and offset is referred to as a logical
address
Logical address=segment: offset
What is The Effective Address?
In general, memory accesses take the form of the following example:
Mov ax, [baseReg + indexReg + constant]
This example copies a word sized value into the register AX.
Combined, the three parameters in brackets determine what is called the effective address, which is simply the
offset referenced by the instruction
What is Physical Address?
Physical memory address pointed by SEGMENT:OFFSET pair is calculated as:
Physical address = (<Segment Addr> * 10) + <Offset Addr>
What are the flags in 8086?
In 8086 Carry flag, Parity flag, Auxiliary carry flag, Zero flag, Overflow flag, Trace flag, Interrupt flag,
Direction flag, and Sign flag.
Why crystal is a preferred clock source?
Because of high stability, large Q (Quality Factor) & the frequency that doesn‟t drift with aging. Crystal is used
as a clock source most of the times.
What is Tri-state logic?
Three Logic Levels are used and they are High, Low, High impedance state. The high and low are normal logic
levels & high impedance state is electrical open circuit conditions. Tri-state logic has a third line called enable
line.
What happens when HLT instruction is executed in processor?
The Micro Processor enters into Halt-State and the buses are tri-state.

Sandeep.K.H µP-µC - Lab Page 30


What is Program counter?
Program counter holds the address of either the first byte of the next instruction to be fetched for execution or
the address of the next byte of a multi byte instruction, which has not been completely fetched. In both the cases
it gets incremented automatically one by one as the instruction bytes get fetched. Also Program register keeps
the address of the next instruction.
What is 1st / 2nd / 3rd / 4th generation processor?
The processor made of PMOS / NMOS / HMOS / HCMOS technology is called 1st / 2nd / 3rd / 4th generation
processor, and it is made up of 4 / 8 / 16 / 32 bits.
Name the processor lines of two major manufacturers?
High-end: Intel - Pentium (II, III, 4), AMD - Athlon. Low-end: Intel - Celeron, AMD - Duron. 64-bit: Intel -
Itanium 2, AMD - Opteron.
Have you studied buses? What types?
There are three types of buses.
Address bus: This is used to carry the Address to the memory to fetch either Instruction or Data.
Data bus : This is used to carry the Data from the memory.
Control bus : This is used to carry the Control signals like RD/WR, Select etc.
What is the Maximum clock frequency in 8086?
5 Mhz is the Maximum clock frequency in 8086.
What is meant by Maskable interrupts?
An interrupt that can be turned off by the programmer is known as Maskable interrupt.
What is Non-Maskable interrupts?
An interrupt which can be never be turned off (ie. disabled) is known as Non-Maskable interrupt
What are the different functional units in 8086?
Bus Interface Unit and Execution unit, are the two different functional units in 8086.
What are the various segment registers in 8086?
Code, Data, Stack, Extra Segment registers in 8086.
What does EU do?
Execution Unit receives program instruction codes and data from BIU, executes these instructions and store the
result in general registers.
Which Stack is used in 8086?
FIFO (First In First Out) stack is used in 8086.In this type of Stack the first stored information is retrieved first.
What is SIM and RIM instructions?
SIM is Set Interrupt Mask. Used to mask the hardware interrupts.
RIM is Read Interrupt Mask. Used to check whether the interrupt is Masked or not.
What are the different types of Addressing Modes?
Refer class notes
What are Data Copy/Transfer Instructions?
A:- MOV, Push, Pop, Xchg, In, Out, Xlat, Lea, Lds/Les, Lahf, Sahf, Pushf, Popf
What are Machine Control Instructions?
A:-Nop, Hlt, Wait,Lock
What are Flag Manipulation Instructions?
A:-Cld, Std, Cli, Sti
What are String Instructions?
A:- Rep, MovSB/MovSW,Cmps, Scas, Lods, Stos

Sandeep.K.H µP-µC - Lab Page 31


What are different parts for 8086 architecture?
A:- The complete architecture of 8086 can be divided into 2types :-Bus Interface Unit(BIU) & Execution Unit.
The BIU contains the circuit for physical address calculations and a pre-coding instruction byte queue & it
makes the bus signals available for external interfacing of the devices.
The EU contains the register set of 8086 except segment registers and IP.It has a 16-bit ALU,able to perform
arithmetic and Logic operations.
What is an Interrupts
Def:- An interrupt operation suspends execution of a program so that the system can take special action.The
interrupt routine executes and normally returns control to the interrupted procedure, which then resumes
execution.BIOS handlesINT 00H-1FH, whereas DOS handles INT 20H-3FH.
What is an Opcode?
A:-The part of the instruction that specifies the operation to be performed is called the Operation code or Op
code.
What is an Operand?
A:-The data on which the operation is to be performed is called as an Operand.
Explain the difference between a JMP and CALL instruction?
A:-A JMP instruction permanently changes the program counter.
A CALL instruction leaves information on the stack so that the original program execution sequence can be
resumed.
What is meant by Polling?
A:- Polling or device Polling is a process which identifies the device that has interrupted the microprocessor.
In microprocessor it will be scanning 8*3 keypad each and every second until the input is given is called polling
effect.
Write syntax for MUL
MUL SOURCE
What is DAC module?
This device is a bit converter that transforms 8bit binary number into analog voltage
What is the sequence we use in half step mode ?
11,22,44,88
What is the sequence we use in full step mode ?
33,66,99
What is stepper motor and its function?
Is rotating device,it rotates isin both clock and anti-clockwise direction
What is meant by Interrupt?
A:-Interrupt is an external signal that causes a microprocessor to jump to a specific subroutine.
What is an Instruction?
A:-An instruction is a binary pattern entered through an input device to command the microprocessor to
perform that specific function.
What is the difference between a microprocessor and a microcontroller?
Microprocessor contains more op-codes, and few bit handling instructions. Where as a microcontroller contains
few op-codes and more bit handling instructions. It can be called as a computer on a chip. In addition to all
arithmetic and logic elements of a general purpose microprocessor, the microcontroller usually also integrates
additional elements such as read-only and read-write memory, and input/output interfaces.

Sandeep.K.H µP-µC - Lab Page 32


What is Assembler?A:-The assembler translates the assembly language program text which is given as input to
the assembler to their binary equivalents known as object code.The time required to translate the assembly code
to object code is called access time.The assembler checks for syntax errors&displays them before giving the
object code.
Explain Dup?
A:-The DUP directive can be used to initialize several location& to assign values to these locations.
Define Pipelining?
A:-In 8086 to speedup the execution program,the instructions fetching and execution of instructions are
overlapped each other.this is known as Pipelining.
What is the use of HLDA?
A:-HLDA is the acknowledgment signal for HOLD. It indicates whether the HOLD signal is received or not.
HOLD and HLDA are used as the control signals for DMA operations.
Explain about "LEA"?
A:-LEA(Load Effective Address) is used for initializing a register with an offset address.A common use for
LEA is to initialize an offset in BX, DI or SI for indexing an address in memory.An equivalent operation to
LEA is MOV with the OFFSET operator, which generates slightly shorter machine code.
Difference between "Shift" and "Rotate".
A:-Shift and Rotate commands are used to convert a number to another form where some bits are shifted or
rotated.
A rotate instruction is a closed loop instruction.Thatis,the data moved out at one end is put back in at the other
end.
The shift instruction loses the data that is moved out of the last bit locations.
Basic difference between shift and rotate is shift command makes "fall of " bits at the end of the register.
Where rotate command makes "wrap around" at the end of the register.
Difference between JMP and JNC?
A:-JMP is Unconditional Branch.
JNC is Conditional Branch.
List the String Manipulation Commands?
A:-REP=Repeat.
MOVS=Move Byte/Word
CMPS=Compare Byte/Word
SCAS=Scan Byte/Word
LODS=Load byte/Word to AL/AX
STOS=Store Byte/Word from AL/AX
What is the main use of ready pin?
A:-READY is used by the microprocessor to check whether a peripheral is ready to accept or transfer data.
A peripheral may be a LCD display or analog to digital converter or any other.These peripherals are connected
to microprocessor using the READY pin.If READY is high then the periphery is ready for data transfer. If not
the microprocessor waits until READY goes high.
Explain about Direction Flag?
A:-This is used by string manipulation instructions.
If this flag bit is 0, the string is processed beginning from the lowest to the highest
address,i.e.,.Autoincrementmode.Otherwise,the string is processed from the highest towards the lowest address,
i.e. Autodecrementing mode.
What are the basic units of a microprocessor ?
The basic units or blocks of a microprocessor are ALU, an array of registers and control unit.

Sandeep.K.H µP-µC - Lab Page 33


Why data bus is bi-directional?
The microprocessor has to fetch (read) the data from memory or inputdevice for processing and after
processing, it has to store (write) the data to memory or output device. Hence the data bus is bi-directional.

Why address bus is unidirectional?


The address is an identification number used by the microprocessor toidentify or access a memory location or I /
O device. It is an output signal from the processor. Hence the address bus is unidirectional.
What are the modes in which 8086 can operate?
The 8086 can operate in two modes and they are minimum (or uniprocessor) mode and maximum ( or
multiprocessor) mode.
Explain the function of M/IO in 8086.
The signal M/IO is used to differentiate memory address and I/0address When the processor is accessing
memory locations MI 10 is asserted high and when it is accessing I/0 mapped devices it is asserted low.
What are the interrupts of 8086?
The interrupts of 8085 are INTR and NMI. The INTR is general maskable interrupt and NMI is non-maskable
interrupt.
How clock signal is generated in 8086? What is the maximum internalclock frequency of 8086?
The 8086 does not have on-chip clock generation circuit. Hence theclock generator chip, 8284 is connected to
the CLK pin of8086. The clock signal supplied by 8284 is divided by three for internal use. The maximum
internal clock frequency of8086 is 5MHz.
Why interfacing is needed for 1/0 devices?
Generally I/O devices are slow devices. Therefore the speed of I/Odevices does not match with the speed of
microprocessor. And so an interface is provided between system bus and I/O devices.
What does memory-mapping mean?
The memory mapping is the process of interfacing memories tomicroprocessor and allocating addresses to each
memory locations.
What is DMA?
The direct data transfer between I/O device and memory is calledDMA.
What is the need for Port?
The I/O devices are generally slow devices and their timingcharacteristics do not match with processor timings.
Hence the I/O devices are connected to system bus through the ports.
What is a port?
The port is a buffered I/O, which is used to hold the data transmittedfrom the microprocessor to I/O device or
vice-versa.
Give some examples of port devices used in 8085 microprocessor basedsystem?
The various INTEL I/O port devices used in 8085 microprocessorbased system are 8212, 8155, 8156, 8255,
8355 and 8755.
Write a short note on INTEL 8255?
The INTEL 8255 is a I/O port device consisting of 3 numbers of 8 –bitparallel I/O ports. The ports can be
programmed to function either as a input port or as a output port in different operating modes. It requires 4
internal addresses and has one logic LOW chip select pin.
What is the need for timing diagram?
The timing diagram provides information regarding the status ofvarious signals, when a machine cycle is
executed. The knowledge of timing diagram is essential for system designer to select matched peripheral
devices like memories, latches, ports, etc., to form a microprocessor system.

Sandeep.K.H µP-µC - Lab Page 34


How many machine cycles constitute one instruction cycle in 8085?
Each instruction of the 8085 processor consists of one to five machinecycles.
What are the internal devices of 8255 ?
The internal devices of 8255 are port-A, port-B and port-C. The portscan be programmed for either input or
output function in different operating modes.

Give some examples of input devices to microprocessor-based system.


The input devices used in the microprocessor-based system areKeyboards, DIP switches, ADC, Floppy disc,
etc.
What are the tasks involved in keyboard interface?
The task involved in keyboard interfacing are sensing a key actuation,Debouncing the key and Generating key
codes (Decoding the key). These task are performed software if the keyboard is interfaced through ports and
they are performed by hardware if the keyboard is interfaced through 8255.
What is scanning in keyboard and what is scan time?
The process of sending a zero to each row of a keyboard matrix andreading the columns for key actuation is
called scanning. The scan timeis the time taken by the processor to scan all the rows one by onestarting from
first row and coming back to the first row again.
What is scanning in display and what is the scan time?
In display devices, the process of sending display codes to 7 –segment LEDs to display the LEDs one by one is
called scanning ( or multiplexed display). The scan time is the time taken to display all the 7-segment LEDs one
by one, starting from first LED and coming back to the first LED again.
What are the internal devices of a typical DAC?
The internal devices of a DAC are R/2R resistive network, an internallatch and current to voltage converting
amplifier.
What is settling or conversion time in DAC?
The time taken by the DAC to convert a given digital data tocorresponding analog signal is called conversion
time.
What are the different types of ADC?
The different types of ADC are successive approximation ADC,counter type ADC flash type ADC, integrator
converters and voltage- to-frequency converters.
Define stack
Stack is a sequence of RAM memory locations defined by theprogrammer.
What is program counter? How is it useful in program execution?
The program counter keeps track of program execution. To execute aprogram the starting address of the
program is loaded in program counter. The PC sends out an address to fetch a byte of instruction from memory
and increments its content automatically.
What is the difference between ISR and a function call?
ISR has no return value, where as a function call has the return value.
Define PSW.
The Program Status Word (PSW) is a register which contains information about the current program status used
by the operating system and the underlying hardware. The PSW includes the instruction address, condition
code, and other fields. In general, the PSW is used to control instruction sequencing and to hold and indicate the
status of the system in relation to the program currently being executed. The active or controlling PSW is called
the current PSW. By storing the current PSW during an interruption, the status of the CPU can be preserved for
subsequent inspection. By loading a new PSW or part of a PSW, the state of the CPU can be initialized or
changed.

Sandeep.K.H µP-µC - Lab Page 35


Why are program counter and stack pointer 16-bit registers?
Program Counter (PC) and Stack Pointer (SP) are basically used to hold 16-bit memory addresses.PC stores the
16-bit memory address of the next instruction to be fetched. SP stores address of stack's starting block.
How is Stack Pointer affected when a PUSH and POP operations are performed?
When PUSH operation is performed the SP value is decreased by 2. When POP operation is performed the SP
value is increased by 2.
How are 32-bit addresses stored in 8086?
32-bit addresses are stored in "SEGMENT:OFFSET" format. SEGMENT and OFFSET are 16-bit values.
ADDRESS = (SEGMENT* 16) + OFFSET

What is tri-state logic?


Three Logic Levels are used and they are high, low, and high impedance state. The high and low are logic one
and zero levels. The high impedance state is electrical open circuit condition. Tri-state logic has a third line
called enable line.
Do 8085(8-bit processor) have any 16 bit registers?
Yes, Stack pointer and Program counter are 16 bit registers.
Difference between Macro and Procedure
MACRO PROCEDURE
Don‟t uses stack mechanism uses stack mechanism
Takes less time to execute Takes time to execute
Parameters are passed as a part of statements Parameters can be passed using registers
which calls macro memory location or stack.
Machine code is generate for instructions each Machine code for instruction is put only once
time when macro is called in the memory
With macro more memory is required With procedure less memory is required
Difference between 8086 and 8088
8088 8086
1 It has eight data lines, therefore it has AD0 – AD7 and It has sixteen data lines, therefore it has AD0 – AD15
A8 – A15 signals signals
3 It has 4 byte instruction queue, due to this instruction It has 6 byte instruction queue
fetching is slow
4 In minimum mode its pin 28 is assigned to signal In minimum mode its pin 28 is assigned to signal
IO/M M/IO
5 Its pin number 34 is SS0 Its pin number 34 is BHE/S7

Difference betweenMemory Mapped I/O and Isolated I/O or IO mapped IO


S.N Memory Mapped I/O Isolated I/O or IO mapped IO
1 Memory mapped IO is one where the processor While IO mapped IO is one where the processor and
and the IO device share the samememory the IOdevice have different memory located to each
location(memory) other.
2 In case of Memory mapped I/O the same address For I/O MappedI/O, separate address BUS is used.
BUS is used foraccessing both Memory (RAM)
and the Registers of I/O devices.
3 Any instruction which references to memory can Limited instructions can be used. Those are IN, OUT,
be used. INS, OUTS.
4 Memory mapped I/O devices are treated as The addresses for Isolated I/O devices are called
memory locations on the memory map. ports.
5 IORC & IOWC signals has no functions in this IORC & IOWC signals expands the circuitry.
case which reduces the circuitry.
Sandeep.K.H µP-µC - Lab Page 36
What is keypad interface?
The interface which has 8 rows and 3 columns.Rows are connected to 26 pin connector through a register to
ground. Columns are connected to the using data cable at the intersection of rows and columns of keyboard are
provided.

What are the function of clock generator


The 8284A provides the following basic functions or signals:
 Clock generation
 RESET synchronization
 READY synchronization
 TTL-level peripheral clock signal.

BUS BUFFERING AND LATCHING

Address and data bus are multiplexed in 8086 (AD0-AD15) and 8088(AD0-AD7) to reduce the number
of pinsrequired for 8086/88 µp integrated circuit.Address and Data need to be de-multiplexed from thebus.
(Q: Why not leave it multiplexed? Ans:Memory and I/O require that the address remainsvalid and stable
throughout a read or write cycle. If the buses are multiplexed, the addresschanges at the memory and I/O, which
causes them to read or write data in the wrong locations.)

If more than 10 unit loads are attached to any bus pin, the entire 8086 or 8088 system must be buffered orIn
order to drive the system buses, which typically have manydevices attached and with large capacitance, the
addressand data output pins must be buffered.

INTERFACE:
Interface refers to the connection of peripheral device to CPU.
Connection of memory device to CPU is called as memory interface
Connection of I/O device to CPU is called as I/O interface

PCI: peripheral component interconnect


Provides the interface between every combination of I/O device and computer

Sandeep.K.H µP-µC - Lab Page 37

You might also like