Mpi Lab Manual Cse
Mpi Lab Manual Cse
Experiment No.1
ARITHMETIC OPERATIONS
AIM : Write and execute an assembly language program to 8086 processor to add,
subtract and multiply two 16 bit unsigned numbers.
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the values in data segment
2. Initialize the data segment register with data segment address
3. Load the words into registers and perform addition/ subtraction/
multiplication/ division and store the sum/difference/product/quotient-
remainder to the result address
4. Terminate the program
PROGRAM:
A. 16 BIT ADDITION
1 assume cs:code,ds:data
2
3 0000 data segment
4 0000 1243 n1 dw 1243h
5 0002 4567 n2 dw 4567h
6 0004 ???? n3 dw ?
7 0006 data ends
8
9 0000 code segment
10
11 0000 start:
12 0000 B8 0000s mov ax,data
13 0003 8E D8 mov ds,ax
14
15 0005 A1 0000r mov ax,n1
16 0008 8B 1E 0002r mov bx,n2
17 000C 03 C3 add ax,bx
18 000E A3 0004r mov n3,ax
19 0011 BE 0004r lea si,n3
20 0014 CC int 3
21
22 0015 code ends
23 end start
1
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
B. 16 BIT SUBTRACTION
1 assume cs:code,ds:data
2
3 0000 data segment
4 0000 FFFF n1 dw 0ffffh
5 0002 4567 n2 dw 4567h
6 0004 ???? n3 dw ?
7 0006 data ends
8
9 0000 code segment
10
11 0000 start:
12 0000 B8 0000s mov ax,data
13 0003 8E D8 mov ds,ax
14
15 0005 A1 0000r mov ax,n1
16 0008 8B 1E 0002r mov bx,n2
17 000C 2B C3 sub ax,bx
18 000E A3 0004r mov n3,ax
19 0011 BE 0004r lea si,n3
20 0014 CC int 3
21
22 0015 code ends
23 end start
C. 16 BIT MULTIPLICATION
1 assume cs:code,ds:data
2
3 0000 data segment
4 0000 4444 n1 dw 4444h
5 0002 4567 n2 dw 4567h
6 0004 ???????? n3 dd ?
7 0008 data ends
8
9 0000 code segment
10
11 0000 start:
12 0000 B8 0000s mov ax,data
13 0003 8E D8 mov ds,ax
14
15 0005 A1 0000r mov ax,n1
16 0008 8B 1E 0002r mov bx,n2
17 000C F7 E3 mul bx
18 000E BE 0004r lea si,n3
19 0011 89 04 mov [si],ax
2
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
A. 16 BIT ADDITION
AX= 57AA & SI=0004 ; D 0004 0005 AA 57
B. 16 BIT SUBTRACTION
AX= BA98 & SI=0004 ; D 0004 0005 98 BA
C. 16 BIT MULTIPLICATION
AX= CB5C & SI=0004 ; D 0000 0005 44 44 67 45 5C CB
VIVA QUESTIONS:
3
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.2
AIM: Write and execute an assembly language program to 8086 processor to divide
word by byte and double word by word unsigned numbers.
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the values in data segment
2. Initialize the data segment register with data segment address
3. Load the word of divided into word register and divide with byte
4. Load the byte of divided into byte register and clear the higher order byte
of that register and then divide with byte.
5. Load the double word of divided into registers and divide with word
6. Load the word of dividend into lower order register and clear the higher
order register and then divide with word
7. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4
5 0000 0100 word1 dw 0100h
6 0002 20 byte1 db 20h
7
8
9 0003 0000 dwordh dw 0000h
10 0005 1000 dwordl dw 1000h
11
12 0007 02*(0024) quotr dw 2 dup('$')
13 000B 02*(0024) dquot dw 2 dup('$')
14 000F 02*(0024) drem dw 2 dup('$')
15
16 0013 data ends
17
18 0000 code segment
19
20 0000 start:
21 0000 B8 0000s mov ax,data
22 0003 8E D8 mov ds,ax
23
4
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT: drem=0000
Quotr=0008
Dquot=0010
VIVA QUESTIONS:
1. What is the syntax of unsigned division instruction?
2. What is the logic for division without using div instruction?
3. What is the implicit register for dividend when the divisor is of type byte and
how the result is stored ?
4. What is the implicit register for dividend when the divisor is of word and how
the result is stored ?
5. What are maskable interrupts?
5
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.3
A. ASCENDING ORDER
AIM : Write and execute an assembly language program to 8086 processor to sort the
given array of 16 bit numbers in ascending order.
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the values in data segment
2. Initialize the data segment register with data segment address
3. Clear the various registers
4. Initialize outer counter for arranging the given numbers
5. Initialize inner counter for performing comparisons
6. Compare the first two values, if carry is generated then continue for next values
7. Otherwise, exchange both values and continue for next values
8. Continue from step 5 till the count is zero.
9. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2 0000 data segment
3
4 0000 0198 0135 0234 0098 n1 dw 198h,135h,234h,098h
5 0008 0A*(0000) res dw 10 dup(0)
6 =0003 count equ 3
7
8 001C data ends
9 0000 code segment
10 0000 start:
11 0000 B8 0000s mov ax,data
12 0003 8E D8 mov ds,ax
13
14 0005 33 C0 xor ax,ax
15 0007 33 D2 xor dx,dx
16 0009 33 C9 xor cx,cx
17
18 000B BA 0003 mov dx,count
19 000E B9 0003 x1:mov cx,count
20 0011 BE 0000r lea si,n1
21 0014 8B 04 mov ax,[si]
6
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
AX=0234 , SI=0000
D 0000 0007 98 00 35 01 98 01 34 02
7
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
B. DESCENDING ORDER
AIM : Write and execute an assembly language program to 8086 processor to sort the
given array of 16 bit numbers in descending order
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the values in data segment
2. Initialize the data segment register with data segment address
3. Clear the various registers
4. Initialize outer counter for arranging the given numbers
5. Initialize inner counter for performing comparisons
6. Compare the first two values, if no carry is generated then continue for next
values
7. Otherwise, exchange both values and continue for next values
8. Continue from step 5 till the count is zero.
9. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2 0000 data segment
3
4 0000 0198 0135 0234 0098 n1 dw 198h,135h,234h,098h
5 0008 0A*(0000) res dw 10 dup(0)
6 =0003 count equ 3
7
8 001C data ends
9 0000 code segment
10 0000 start:
11 0000 B8 0000s mov ax,data
12 0003 8E D8 mov ds,ax
13
14 0005 33 C0 xor ax,ax
15 0007 33 D2 xor dx,dx
16 0009 33 C9 xor cx,cx
17
18 000B BA 0003 mov dx,count
8
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
AX=0098 , SI=0000
D 0000 0007 34 02 98 01 35 01 98 00
VIVA QUESTIONS:
1. Give the concept of Jump with return and jump with non return.
2. What are the flags that are effected by compare statement?
3. What is the Significance of inserting label in programming.
4. What is the Significance of int 3h.
5. What is the purpose of offset?
9
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.4
AIM: Program Write and execute an assembly language program to 8086 processor to
pick the median from the given array of numbers
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the values in data segment
2. Initialize the data segment register with data segment address
3. Load the word of divided into word register and divide with byte
4. Load the byte of divided into byte register and clear the higher order byte
of that register and then divide with byte.
5. Load the double word of divided into registers and divide with word
6. Load the word of dividend into lower order register and clear the higher
order register and then divide with word
7. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2 0000 data segment
3
4 0000 0198 0135 0234 0098 n1 dw 198h,135h,234h,098h
5 0008 0A*(0000) res dw 10 dup(0)
6 =0003 count equ 3
7
8 001C data ends
9 0000 code segment
10 0000 start:
11 0000 B8 0000s mov ax,data
12 0003 8E D8 mov ds,ax
13
14 0005 33 C0 xor ax,ax
15 0007 33 D2 xor dx,dx
16 0009 33 C9 xor cx,cx
17
18 000B BA 0003 mov dx,count
19 000E B9 0003 x1:mov cx,count
20 0011 BE 0000r lea si,n1
21 0014 8B 04 mov ax,[si]
10
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
AX=0198 , SI=0002 ; D 0002 0003 98 01
VIVA QUESTIONS:
11
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.5
AIM : Write and execute an assembly language program to 8086 processor to find the
length of a given string which terminates with a special character.
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the string of which the length to be calculated in data segment
2. Initialize the data segment register with data segment address
3. Clear registers required
4. Compare the first byte of the string with $ , if not equal, increment the register for
count and register for accessing the next value.
5. If equal, exit the loop and check the count register.
6. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4 0000 61 75 72 6F 72 61 24 n1 db "aurora","$"
5 0007 data ends
6
7 0000 code segment
8 0000 start:
9 0000 B8 0000s mov ax,data
10 0003 8E D8 mov ds,ax
11 0005 33 C0 xor ax,ax
12 0007 33 D2 xor dx,dx
13 0009 BE 0000r lea si,n1
14 000C 8A 04 l1:mov al,[si]
15 000E 3C 24 cmp al,"$"
16 0010 74 05 jz l2
17 0012 FE C3 inc bl
18 0014 46 inc si
19 0015 EB F5 jmp l1
20 0017 B4 09 l2:mov ah,09h
12
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
BL = 06
VIVA QUESTIONS:
13
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.6
AIM : Write and execute an assembly language program to 8086 processor to reverse
the given string read from the keyboard and display
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the prompt messages to be displayed in data segment
2. Initialize the data segment register with data segment address
3. Use 0ah function to read the string from the keyboard
4. Initialize the source pointer to the end of the read string
5. Initialize the destination pointer to the location where the reversed string is to be
stored
6. Initialize the counter to the actual length of the entered string
7. Copy the contents from the source to the destination till the counter is zero
8. Display the reversed string
9. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4
5 0000 20 65 6E 74 65 72 20+ msg db " enter the string : ","$"
6 74 68 65 20 73 74 72+
7 69 6E 67 20 3A 20 24
8
9 0015 str1 label byte
10 0015 14 strmax db 20
11 0016 ?? stract db ?
12 0017 0A*(24) strfld db 10 dup('$')
13
14 0021 0A 0D 24 nline db 10,13,'$'
15
14
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
15
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
62
63
64 0031 B4 09 mov ah,09h
65 0033 BA 0021r lea dx,nline
66 0036 CD 21 int 21h
67
68 0038 B4 09 mov ah,09h
69 003A BA 002Er lea dx,msg1
70 003D CD 21 int 21h
71
72
73 003F B4 09 mov ah,09h
74 0041 BA 0024r lea dx,rev
75 0044 CD 21 int 21h
76
77 0046 B4 4C exit: mov ah,4ch
78 0048 CD 21 int 21h
79
80 004A code ends
81
82 end start
VIVA QUESTIONS:
16
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
AIM : Write and execute an assembly language program to 8086 processor to verify
whether the given string is palindrome or not
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the prompt messages to be displayed in data segment
2. Initialize the data segment register with data segment address
3. Use 0ah function to read the string from the keyboard
4. Initialize the source pointer to the end of the read string
5. Initialize the destination pointer to the location where the reversed string is to be
stored
6. Initialize the counter to the actual length of the entered string
7. Copy the contents from the source to the destination till the counter is zero
8. Display the reversed string
9. Initialize the counter to the actual length of the entered string again
10. Initialize the source pointer to the starting address of the read string
11. Initialize the destination pointer to the starting address of the reversed string
12. Compare the contents character- wise if found equal display the string is
palindrome, else if any character is not equal then display string is not palindrome
13. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4
5 0000 65 6E 74 65 72 20 74+ msg db "enter the string","$"
6 68 65 20 73 74 72 69+
7 6E 67 24
8
9 0011 str1 label byte
10 0011 14 strmax db 20
11 0012 ?? stract db ?
12 0013 0A*(24) strfld db 10 dup('$')
17
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
13
14 001D 0A 0D 24 nline db 10,13,'$'
15
16 0020 0A*(24) rev db 10 dup('$')
17
18 002A 74 68 65 20 65 6E 74+ msg1 db "the entered string
is palindrome","$"
19 65 72 65 64 20 73 74+
20 72 69 6E 67 20 69 73+
21 20 70 61 6C 69 6E 64+
22 72 6F 6D 65 24
23 004B 74 68 65 20 65 6E 74+ msg2 db "the entered string
is not palindrome","$"
24 65 72 65 64 20 73 74+
25 72 69 6E 67 20 69 73+
26 20 6E 6F 74 20 70 61+
27 6C 69 6E 64 72 6F 6D+
28 65 24
29
30
31 0070 data ends
32
33
34
35 0000 code segment
36
37 0000 B8 0000s start: mov ax,data
38 0003 8E D8 mov ds,ax
39
40 0005 B4 09 mov ah,09h
41 0007 BA 0000r lea dx,msg
42 000A CD 21 int 21h
43
44 000C B4 09 mov ah,09h
45 000E BA 001Dr lea dx,nline
46 0011 CD 21 int 21h
47
48 0013 B4 0A mov ah,0ah
49 0015 BA 0011r lea dx,str1
50 0018 CD 21 int 21h
51
52 001A B4 09 mov ah,09h
53 001C BA 001Dr lea dx,nline
54 001F CD 21 int 21h
55
56 0021 B4 09 mov ah,09h
18
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
19
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
VIVA QUESTIONS:
1. What is a palindrome?
2. Specify string instructions.
3. What is the syntax of compare string instruction?
4. What is the use of data segment in 8086 processor?
5. What is use of index registers?
20
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.7
VERIFY THE PASSWORD
AIM: Write and execute an assembly language program to 8086 processor to verify the
password.
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the values in data segment
2. Initialize the data segment register with data segment address
3. Clear all the various registers
4. Initialize the counter for number of comparisons
5. Compare the input with the numbers in an array one at a time
6. If zero flag is set, display the message ‘number found’
7. If zero flag is not set even after all the comparisons i.e., till the count is zero then
display the message ‘number not found’
8. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4 0000 12CD 3BCD 34CD n1 dw 12cdh,3bcdh,34cdh
5 0006 04CD n2 dw 04cdh
6 0008 70 61 73 73 77 6F 72+ msg1 db "number found
$"
7 64 20 66 6F 75 6E 64+
8 20 24
9 0018 70 61 73 73 77 6F 72+ msg2 db "number not
found $"
10 64 20 6E 6F 74 20 66+
11 6F 75 6E 64 20 24
12 =0003 count equ 3
13 002C data ends
14
15 0000 code segment
16 0000 start:
17 0000 B8 0000s mov ax,data
18 0003 8E D8 mov ds,ax
19 0005 33 C0 xor ax,ax
21
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
Input of 04cdh, the message password found is displayed.
Input of 2340h, the message password not found is displayed.
22
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No.8
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the strings in data segment
2. Initialize the data segment register with data segment address
3. Initialize the source pointer to the first string
4. Initialize the destination pointer to the location where the total string is to be
stored
5. Increment the source pointer and compare the source contents with ‘ ‘ (blank
space)
6. If not equal, continue the comparison and move the contents from source to the
destination
7. If equal, then initialize the another source pointer to the address of the string to be
inserted
8. Increment the destination pointer and move the string till the termination
character is found
9. Increment the first source pointer as well as destination pointer and move the
contents till the termination character is found
10. Display the total string
11. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4
5 0000 67 6F 6F 64 20 69 6E+ msg db "good india","$"
6 64 69 61 24
7
8 000B 0A 0D 24 nline db 10,13,'$'
9
10
11 000E 20 6D 6F 72 6E 69 6E+ msg2 db " morning","$"
12 67 24
23
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
13
14 0017 28*(24) msg1 db 40 dup('$')
15
16 003F data ends
17
18
19
20 0000 code segment
21
22 0000 B8 0000s start:mov ax,data
23 0003 8E D8 mov ds,ax
24
25 0005 B4 09 mov ah,09h
26 0007 BA 0000r lea dx,msg
27 000A CD 21 int 21h
28
29 000C BE 0000r lea si,msg
30 000F BF 0017r lea di,msg1
31
32 0012 8A 04 l1: mov al,[si]
33 0014 3C 20 cmp al,' '
34 0016 74 06 je l2
35
36 0018 88 05 mov [di],al
37 001A 46 inc si
38 001B 47 inc di
39 001C EB F4 jmp l1
40
41 001E BB 000Er l2: lea bx,msg2
42
43 0021 8A 07 l3: mov al,[bx]
44 0023 3C 24 cmp al,'$'
45 0025 74 06 je l4
46 0027 88 05 mov [di],al
47 0029 43 inc bx
48 002A 47 inc di
49 002B EB F4 jmp l3
50
51 002D l4:
52 002D 8A 04 mov al,[si]
53 002F 3C 24 cmp al,'$'
54 0031 74 06 je l5
55 0033 88 05 mov [di],al
56 0035 46 inc si
57 0036 47 inc di
58 0037 EB F4 jmp l4
59
60 0039 B4 09 l5:mov ah,09h
61 003B BA 000Br lea dx,nline
62 003E CD 21 int 21h
24
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
63
64 0040 B4 09 mov ah,09h
65 0042 BA 0017r lea dx,msg1
66 0045 CD 21 int 21h
67
68 0047 B4 4C mov ah,4ch
69 0049 CD 21 int 21h
70 004B code ends
71 end start
VIVA QUESTIONS:
1. What are the instructions used to set and reset the direction flag is a palindrome?
2. What is the use of index registers?
3. What is the base register?
4. What are unconditional branch instructions, specify some of them?
5. What are ptr and label directives?
25
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
EQUIPMENT REQUIRED:
1. TASM Software
2. PC with DOS and Debug program
ALGORITHM:
1. Define the string in data segment
2. Initialize the data segment register with data segment address
3. Initialize the source pointer to the first string and initialize the destination
pointer to new address
4. Increment the source pointer and compare the source contents with blank
space
5. If not equal, continue the comparison and move the contents from source
to destination
6. If equal, increment the source pointer
7. Now again compare the source contents with blank space
8. If not equal, continue the comparison and do not move the string.
9. If equal, then increment the source pointer and destination pointer and
move the string from source to destination till termination character is
found
10. Terminate the program
PROGRAM:
1 assume cs:code,ds:data
2
3 0000 data segment
4
5 0000 67 6F 6F 64 20 6D 6F+ msg db "good morning india","$"
6 72 6E 69 6E 67 20 69+
7 6E 64 69 61 24
8
9 0013 0A 0D 24 nline db 10,13,'$'
10
11 0016 28*(24) msg1 db 40 dup('$')
12
13 003E data ends
14
15
16
17 0000 code segment
18
26
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
27
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
VIVA QUESTIONS:
1. Mention the different index registers that are used as offset for all 4
segment registers.
2. What is the use of segmentation?
3. What are the memory banks of 8086?
4. What are the lines used for selecting those banks?
5. What are interrupts?
28
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No. 10
LED INTERFACE
AIM: Write and execute an assembly language program to 8086 processor to call a
delay subroutine and display the character on the LED display;
EQUIPMENT REQUIRED:
1. 8086 microprocessor trainer kit
2. 8255 interfacing card with LEDs and switches
3. Flat ribbon cable bus
4. Keyboard
5. Power chord
PROCEDURE:
PROGRAM:
MOV AL,80
MOV DX,3006 ;Initialize 8255
OUT DX,AL
MOV AL,55
MOV DX,3002 ; Send the data to glow LEDs
OUT DX,AL
INT 3 ; Terminate
29
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
RESULT:
The LEDs are glowing according to the status of switches
VIVA QUESTIONS:
30
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No. 10
STEPPER MOTOR
AIM: Program to interface the stepper motor to 8086 microprocessor and operate it in
clockwise and anti-clockwise by choosing variable step-size
EQUIPMENT REQUIRED:
1. 8086 microprocessor trainer kit
2. Stepper motor interfacing module
3. Flat ribbon cable bus
4. Keyboard
5. Power chord
INTERFACING CIRCUIT:
31
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Stepper motors are very useful electro –mechanical transducers for position control. They
are used in a number of industrial control applications.
The dual stepper motor interface designed to be used with ALS-SDA-86 can
simultaneously control two stepper motors. It can be used to control single phase, two
phase , three phase and four phase indigenous and imported stepper motors.
The interface is designed with high speed switching Darlington transistors with MAX
1A, 80V rating with appropriate heat sinks. These switches are driven through open
collector TTL buffers which interface the lines to the motor circuits. The logic power
and motor power are supplied directly to the interface .This allows the use of motors with
different input voltage ratings with same drive circuit .The interface is also provided with
current limiting circuits which protects the power devices against overload or accidental
voltages. The LEDs on the interface indicate the phases which are energized for easy
demonstration. There are suppression circuits which clamp the transient voltages to safe
limits during switching of phases. By suitable switch sequences the motor can be used in
three modes of operation:
a. One phase ON (medium torque)
b. Two phase ON (high torque )
c. Half stepping ( low torque )
The interface can be connected to the 8255 ports in 8086 trainer kit using 26 core flat
cable. In order to generate logic sequences conveniently using the Bit-Set/Reset facility
of port C in 8255, the interface uses port C signals to drive the switches.
Switching logic:
The stepping action is caused by sequential switching of supply to the two phases of the
motor.
Four step input sequence gives 1.8 degree (full) step function.
32
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
0 1 0 0=4
0 1 1 0=6
0 0 1 0=2
Eight step input sequence gives 0.9 degree (half) step function.
To change the directions follow the sequence from bottom to top. The step rate ( speed of
rotation ) is governed by the frequency of switching.
PROGRAM:
33
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
OUT DX,AL
NOP
NOP
DEC CX
JNZ L1
RET
RESULTS:
VIVA QUESTIONS:
34
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No. 11
A TO D CONVERTER
AIM: Interface an 8 bit ADC to 8086 and generate digital output and store it in
memory for the given waveform input.
EQUIPMENT REQUIRED:
1. 8086 kit
2. A to D converter interfacing card
3. Flat ribbon cable bus
4. Power supply to 8086 kit
5. Jumper.
b) This port B is read port of ADC while Pc1 (lower port C) is input while Pc4,5,6
(upper port C) is output commands.
INTERFACING CIRCUIT:
35
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
ADC 0808:
* The ADC chips 0808 are 8 bit CMOS, successive approximation converters.
Block diagram of ADC
36
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
These converters do not need any external zero (or) full scale adjustments as they
are already taken care of by internal circuits. These converters internally have a
3:8 analog multiplexer so that at a time 8 different analog inputs can be connected
to chips.
37
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
PROGRAM:
MOV AL, 81
MOV DX, 8807 ; Configuring ports as output ports except port C
OUT DX, AL
MOV AL, 00
MOV DX, 8803 ; Sending channel addr on port B
OUT DX, AL
MOV AL, 08
MOV DX, 8807 ; Generate ALE signal on PC3
OUT DX, AL
MOV AL, 09
MOV DX, 8803
OUT DX, AL ; Configure port B as input port
MOV AL, 0B
MOV DX, 8807; Set O/P enable signal high
OUT DX, AL
INT 3 ; TERMINATE
RESULT: When potentiometer was in minimum position the digital output is 00 and
when maximum output at AL is FF.
38
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
VIVA QUESTIONS:
39
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
Experiment No. 12
D TO A CONVERTER
AIM: Interface an DAC to 8086 and generate a Triangular waveform and Square
waveform with different periods.
EQUIPMENT REQUIRED:
1. 8086 kit
2. D to A converter interfacing card
3. Flat ribbon cable-buses
4. Power supply to 8086 kit
5. CRO.
INTERFACING CIRCUIT:
40
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
DAC 0800:
FIGURE:
41
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
1. Initialization of 8255 by writing the control word into the control register
2. Load the accumulator with required data
3. Send the data out in the required way to generate the waveform through port A of
8255
4. Observe the desired output waveform in the CRO.
MOV AL, 80
MOV DX, 8807 ; Initialize the 8255 with control word
OUT DX, AL
EXPECTED GRAPH
FF--
00 t
42
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
MOV AL,80
MOV DX,8807 ; Initialize the 8255 with control word
OUT DX,AL
EXPECTED GRAPH
FF
00
t
RESULT:
Observed the generated triangular waveform & square waveform in CRO.
43
3/2 ECE- Microprocessors Lab Manual Aurora’s Engineering College
VIVA QUESTIONS:
1. Explain the difference between the near call and the far call
2. Explain the generation technique to convert Digital signal into Analog form.
3. Compare R-2R ladder method to Weighted resister method
1. Explain about the specifications of DAC
2. How the DAC are interfaced with processor
3. What is meant by resolution of DAC
4. What is meant by settling time
5. Define linearity, accuracy for DAC
6. Give some applications of DAC
7. What is the importance of Op-amp in DAC
44