CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 –...

21
CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II - CSE III - SEMESTER ACADEMIC YEAR: 2012-2013 SCHOOL OF COMPUTER SCIENCE & ENGINEERING SRM UNIVERSITY, SRM NAGAR, KATTANKULATHUR-603203. KANCHEEPURAM DISTRICT.

Transcript of CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 –...

Page 1: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

CS0211 – MICROPROCESSOR LAB

LABORATORY MANUAL

II - CSE

III - SEMESTER

ACADEMIC YEAR: 2012-2013

SCHOOL OF COMPUTER SCIENCE & ENGINEERING

SRM UNIVERSITY,

SRM NAGAR, KATTANKULATHUR-603203.

KANCHEEPURAM DISTRICT.

Page 2: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

SCHOOL OF COMPUTER SCIENCE & ENGINEERING

SRM UNIVERSITY,

SRM NAGAR, KATTANKULATHUR-603203.

SUBJECT : MICROPROCESSOR LAB SUBJECT CODE : CS0211

SEMESTER : III CLASS : II CSE

HOURS / WEEK : 6 HOURS

EX. NO NAME OF THE EXPERIMENTS PAGE NO

INTEL 8085 PROGRAMS

1.a. 8 – BIT ADDITION 3

1.b. 8 – BIT SUBTRACTION 4

1.c. 8 – BIT MULTIPLICATION 5

1.d. 8 – BIT DIVISION 6

2.a. 16 – BIT ADDITION 7

2.b. 16 – BIT SUBTRACTION 8

2.c. 16 – BIT MULTIPLICATION 9

2.d. 16 – BIT DIVISION 10

3.a. BCD TO HEXADECIMAL CONVERSION 11

3.b. HEXADECIMAL TO BCD CONVERSION 12

4. STEPPER MOTOR INTERFACING 13

Page 3: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

EX. NO NAME OF THE EXPERIMENTS PAGE NO

8086 PROGRAMS USING MASM

5.a ADDITION USING 8086

14

5.b SUBTRACTION USING 8086 15

5.c MULTIPLICATION USING 8086 16

5.d DIVISION USING 8086 17

6 SEARCHING USING 8086 18

7 SORTING USING 8086 19

Page 4: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

1.a. 8 – BIT ADDITION

AIM-

To perform the 8 bit binary addition using 8085

ALGORITHM-

1. Start 2. Get the inputs through some memory locations 3. Perform the addition operation 4. If carry is present , increment another register (e.g. C Reg.) and move the value in

accumulator and C Reg to memory location to display 5. Stop

INPUT : 03H , 05H

OUTPUT : 08H

RESULT :

Thus the above program is executed properly.

Page 5: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

1.b 8 – BIT SUBTRACTION

AIM-

To perform 8 bit binary subtraction using 8085

ALGORITHM-

1. Start 2. Input the numbers in respective memory locations 3. Perform the subtraction operation 4. If carry is present , compliment accumulator content and 01 to it and store the result in a

memory location 5. Carry is stored in another memory location 6. Stop

INPUT : 08H , 06H

OUTPUT : 02H

RESULT :

Thus the above program is executed properly.

Page 6: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

1.c 8 – BIT MULTIPLICATION

AIM-

To perform 8 bit binary multiplication using 8085

ALGORITHM-

1. Start 2. Get the inputs through some memory locations 3. Store multiplicand and multiplier in two different registers (e.g. b and d). 4. Clear the accumulator and perform (a) repeated addition of B with A (b) decrement d reg

Content (c) increment a register for carry value 5. Repeat the step 4 till the d reg. Content becomes zero. 6. Display the accumulator content (LSB) and Carry register Content (MSB) 7. Stop

INPUT : 04H , 03H

OUTPUT : 0CH

RESULT :

Thus the above program is executed properly.

Page 7: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

1.d 8 – BIT DIVISION

AIM-

To perform 8 bit division using 8085

ALGORITHM-

1. Start 2. Get the inputs from the respective memory locations 3. Divide using repeated subtraction and set up a counter which stores the quotient. 4. Accumulator has the remainder 5. Display all the stored result in respective memory locations 6. Stop

RESULT :

Thus the above program is executed properly.

2.a 16 – BIT ADDITION

Page 8: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

AIM-

To perform 16 bit addition using 8085

ALGORITHM-

1. Start 2. Get the input numbers from the memory location , each 16 bit number will take two address

locations 3. Double add is performed and the result will be stored in HL register pair 4. The result is moved to other memory locations 5. If there is any carry it is incremented in C and stored in a memory location 6. Stop

INPUT : 5000H , 0050H

OUTPUT : 5050H, 0000H

RESULT :

Thus the above program is executed properly.

Page 9: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

2.b 16 – BIT SUBTRACTION

AIM-

To perform 16 bit subtraction using 8085

ALGORITHM-

1. Start 2. Get the input numbers from the memory location , each 16 bit number will take two address

locations 3. Perform the subtraction operation by two’s complement addition 4. Check for carry and store the result in a memory location 5. Stop PROGRAM:

INPUT : 1010H , 1000H

OUTPUT : 0010H

RESULT :

Thus the above program is executed properly.

Page 10: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

2.c 16 – BIT MULTIPLICATION

AIM-

To perform 16 bit multiplication using 8085

ALGORITHM-

1. Start 2. Get the input numbers from the memory location , each 16 bit number will take two address

locations 3. Perform multiplication by repeated addition between stack pointer and the HL register pair

using double add 4. Store the carry in BC register and display the result in a memory location and display the

carry in a different memory location 5. Stop

INPUT : 0000H , 0303H ,0202H ,0000H

OUTPUT : 06H , 0CH ,06H ,00H

RESULT :

Thus the above program is executed properly.

Page 11: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

2.d 16 – BIT DIVISION

AIM-

To perform 16 bit divison using 8085

ALGORITHM-

1. start 2. Get the input numbers from the memory location , each 16 bit number will take two address

locations 3. Perform division operation by repeated subtraction bytewise wise and store it in accumulator 4. Transfer bitwise to HL register when counter is zero, this will be taken as remainder. 5. Quotient is given by the counter register. 6. Stop PROGRAM:

INPUT : 0909H , 0202H

OUTPUT : 0101H ,0004H

RESULT :

Thus the above program is executed properly.

Page 12: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

3.a BCD TO HEXADECIMAL CONVERSION

AIM-

To convet a given number in BCD to a hexadecimal number

ALGORITHM-

1. Start 2. Load the BCD number into a memory location 3. Separate the digits according to place values using AND (MASK) operation 4. To convert into hexadecimal multiply by 0A and add it with unit digits place 5. Store the result in a memory location 6. Stop PROGRAM:

INPUT : 55H

OUTPUT : 37H

RESULT :

Thus the above program is executed properly.

Page 13: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

3.b HEXADECIMAL TO BCD CONVERSION

AIM-

To convert a given hexadecimal number to a BCD number

ALGORITHM-

1. Start 2. Load the hexadecimal number into a memory location 3. Divide the number separately by 64 (H) and 0A(H) and store the quotients separately in

memory location 4. The last unit digit remainder is stored separately in successive memory location 5. Stop

INPUT : FFH

OUTPUT : 05 , 05 , 02

RESULT :

Thus the above program is executed properly.

Page 14: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

4 STEPPER MOTOR

AIM-

To write a program operate a stepper motor interfaced to 8085 Microprocessor

ALGORITHM-

1. Start 2. Input the key control words 0A,06,05,09 in the memory locations 3. Move to accumulator and given through output port 4. Introduce time delay routine. 5. Using jump condition continue from the beginning to get continuous rotation 6. Stop

INPUT : 09H , 05H ,06H ,0AH

OUTPUT : stepper motor rotate clockwise direction.

RESULT :

Thus , we can rotate stepper motor in clock wise and anti clockwise direction.

Page 15: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

5.aADDITION USING 8086

AIM:

To obtain the sum of two numbers ( 8 or 16 bit) using 8086

ALGORITHM:-

Step 1. Allocate some space for the result in data segment

step 2. In code segment, store accumulator with some value

step 3. Store B register with some value

step 4. Add the register content with accumulator

step 5. Result is stored in accumulator

step 6. The result is stored in required memory location

INPUT : 0202H ,0303H

Output : 0505H

RESULT :

Thus the above program is executed properly.

Page 16: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

5.b SUBTRACTION USING 8086

AIM:-

To obtain the difference of two numbers using 8086 micro processor

ALGORITHM:-

1. Allocate some space for the result in data segment

2. In code segment, store accumulator with some value

3. Store B register with some value

4. Subtract the register content from the accumulator

5. Result is stored in accumulator

6. The result is stored in required memory location

INPUT : 0202H ,0303H

Output : 0505H

RESULT :

Thus the above program is executed properly

Page 17: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

5.cMULTIPLICATION USING 8086

AIM:-

To obtain the product of two numbers using 8086 micro processor.

ALGORITHM:-

1. Allocate some space for the result in data segment

2. In code segment,store accumulator with some value

3. Store B register with some value

4. Multiply the register content with accumulator

5. Result is stored in accumulator

6. The result is stored in required memory location

INPUT : 0006H ,0004H

Output : 0018H

Page 18: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

RESULT :

Thus the above program is executed properly

5.dDIVISION USING 8086

AIM :-

To perform division and to get remainder and quotient using 8086 micro processor.

ALGORITHM:-

1. Allocate some space for the result in data segment

2. Take 2 data as 2 inputs in 2 different registers

3. Perform the Division operation.

4. The quotient is stored in accumulator and the remainder is stored in D register

5. Store the remainder and quotient in required memory location.

6. Display the result.

INPUT : 0008H ,0002H

Output : 0004H

RESULT :

Page 19: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

Thus the above program is executed properly

6.SEARCHING USING 8086:-

AIM:-

To search the given element in the given unsorted array using 8086.

ALGORITHM:-

1. Allocate some spaces to enter the total elements, search element and the no of times it is present.

2. Input the values in the array.

3. End of data segment.

4. In first module get the size of array as input and set the counter register

5. In second module push CX in stack and get all the elements in the array and the number to be searched as input from the user and store them in array.

6. In top of the stack, compare the values and if present jump to count and display, Otherwise search in the next location.

7. Then display the result as true position of the number.

8. Terminate the program.

INPUT : 09H,02H ,08H,05H, 01H

Output : 09H

Page 20: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.

RESULT :

Thus the above program is executed properly

7.SORTING USING 8086

AIM:-

To sort the given array of elements using 8086.

ALGORITHM:-

1. In data segment allocate some space to enter the elements of the array and its sorted form

2. In code segment, in first module get all the values of the array and a register is initialized with

3. In task block add bx with 02 and have a loop mov BP to DX

4.In main block compare SI with DI and if less jump to J1 , exchange SI with DI, decrease temp and if no zero then jump to rept

5.In J1 block document DX and if its not zero jump to ZZ block

6.In rpt block decreases temp & if its not zero again go back to this block.

7.Code segment ends

8. store the result in the required memory location

9. terminate the program..

INPUT : 53,H 25H,19H,02H,08H

Output : 02H,08H,19H,25H,53H

RESULT :

Thus the above program is executed properly

Page 21: CS0211 – MICROPROCESSOR LAB LABORATORY MANUAL II · PDF filecs0211 – microprocessor lab . laboratory manual . ii ... intel 8085 programs . 1.a. 8 ... 8086 programs using masm.