Skip to document
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

Micro 85 Solved Tutorial

Course

Microprocessors (MICCEI 405R02)

7 Documents
Students shared 7 documents in this course
Academic year: 2021/2022
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
Delhi Technological University

Comments

Please sign in or register to post comments.

Preview text

Tutorial – 1 (ALP 8085) Microprocessor (BCT II / II)

  1. Add two numbers located at 3030H and 4040H. Display sum on Port 1. If carry is generated, display it on Port 2. Store sum on 5050H.

LDA 3030H MOV B, A LDA 4040H ADD B STA 5050H OUT PORT 1 JNC L MVI A, 01H OUT PORT 2 L1: HLT

  1. Write an Assembly Language Program that retrieves a data located at 2050H and it displays, if it is even and stores FFH on that location if it is odd.

LDA 2050H ANI 01H JNZ L LDA 2050H OUT PORT 1 HLT L1: MVI A, FFH STA 2050H HLT

  1. Sixteen bytes of data are stored in memory location at 1050H to 105FH. Replace each data byte by FF.

LXI H, 1050H MVI C, 10H L1: MVI M, FFH INX H DCR C JNZ L HLT

  1. Sixteen data are stored in memory location at 1050H to 105FH. Transfer the entire block of data to new location starting at 1070H.

LXI H, 1050H MVI C, 10H LXI D, 1070H L1: MOV A, M STAX D INX H INX D DCR C JNZ L HLT

  1. Six bytes are stored in memory locations starting at 2050H. Add all the data bytes, save any carry generated while adding the data bytes. Display entire sum at two output ports and store total carry in 2070H and sum in 2071H.

LXI H, 2050H MVI C, 06H MVI B, 00H MVI D, 00H L2: MOV A, M ADD B MOV B, A JNC L INR D L1: INX H DCR C JNZ L HLT

  1. If the content of memory location 2050H is greater than or equal to 64H, display 0FH else display FFH.

LDA 2050H CPI 64H JC L MOV A, 0FH OUT PORT 1 HLT L1: MOV A, FFH OUT PORT 1 HLT

  1. For ten bytes data starting from 1120H, write a program to sort the reading in ascending and in descending order. (Note : For descending, do self)

START: LXI H, 1120H MVI D, 00H MVI C, 0AH L2: MOV A, M INX H CMP M JC L MOV B, M MOV M, A DCX H MOV M, B INX H MVI D, 01H L1: DCR C JNZ L MOV A, D RRC JC START HLT

  1. A set of ten readings is stored in memory location starting at 1160H. The readings are expected to be positive (<127). WAP to
    • Check each reading to determine whether it is positive or negative.
    • Reject all negative readings.
    • Add all positive readings & display sum in Port 1 and carry in Port 2.

MVI B, 00H MVI C, 00H MVI D, 0AH LXI H, 1160H L2: MOV A, M RAL JC NEGLECT RAR ADD B JC L MOV B, A L1: INR D NEGLECT: INX H DCR D JNZ L MOV A, B OUT PORT 1 MOV A, D OUT PORT 2 HLT

  1. A set of six data bytes is stored starting from memory location 2050H. The set includes some blank spaces (bytes with zero values). WAP to eliminate the blanks from the block.

MVI C, 06H LXI H, 2050H LXI B, 2050H L2: MOV A, M CPI 00H JZ L STAX B INX B L1: INX H DCR C JNZ L HLT

  1. A set of eight data bytes (4 Pairs) are stored in memory locations starting from 1040H. WAP to add two bytes at a time and store the sum in same memory location, sum replacing the first byte and the carry replacing the second byte. If any pair does not generate a carry, the memory location of the second byte should be cleared i. store 00H over there.

MVI C, 04H LXI H, 1040H L2: MOV A, M INX H ADD M DCX H MOV M, A INX H MVI M, 00H JNC L MVI M, 01H L1: INX H DCR C JNZ L HLT

  1. An 8 bit binary number is stored in memory location 1120H. WAP to store ASCII codes of these binary digits (0 to F) in location 1160H and 1161H.

LXI SP, 2000H CODE: CPI 0AH LXI H, 1120H JC L LXI D, 1160H ADD 07H MOV A, M L1: ADD 30H ANI F0H RET RRC RRC RRC RRC CALL CODE STAX D INX D MOV A, M ANI 0FH CALL CODE STAX D HLT

  1. WAP to convert ASCII at location 1040H to binary and store at location 1050H.

LXI SP, 2000H CODE: CPI 40H LXI H, 1040H JC L LXI D, 1050H SUB 07H MOV A, M L1: SUB 30H ANI F0H RET RRC RRC RRC RRC CALL CODE STAX D INX D MOV A, M ANI 0FH CALL CODE STAX D HLT

  1. A set of three packed BCD numbers are stored in memory locations starting at 1150H. The seven segment codes of digits 0 to 9 for a common cathode LED are stored in memory locations starting at 1170H and the output buffer memory is reserved at 1190H. WAP to unpack the BCD number and select an appropriate seven segment code for each digit. The codes should be stored in output buffer memory.

LXI SP, 2999H CODE: PUSH H LXI H, 1150H LXI H, 1170H MVI D, 03H ADD L LXI B, 1190H MOV L, A NEXT: MOV A, M MOV A, M ANI F0H STAX B RRC POP H RRC RET RRC RRC CALL CODE INX B MOV A, M ANI 0FH CALL CODE INX B INX H DCR D JNZ NEXT HLT

  1. A multiplicand is stored in memory location 1150H and a multiplier is stored in location 1151H. WAP to multiply these numbers and store result from 1160H.

MVI B, 08H MVI D, 00H LXI H, 1150H MOV A, M MOV E, A LXI H, 1151H MOV A, M L2: RAR JNC L LXI H, 0000H DAD D L1: XCHG DAD H XCHG DCR B LNZ L HLT

  1. Write a program for 8085 to convert and copy the ten lower case ASCII codes to upper case from memory location 9050H to 90A0H if any, otherwise copy as they are. Assume there are fifty codes in the source memory. [Note: ASCII code for A=65 ... Z=90, a=97 ... z=122]. [2063 Kartik]

LXI H, 9050H LXI D, 90A0H MVI C, 32H L2: MOV A, M CPI 60H JC L SUI 20H L1: STAX D DCR C JNZ L HLT

  1. Write a program for 8085 to add ten 16-bit BCD numbers from location 4050H and store 24- bit BCD result at the end of the ten given numbers. [2062 Chaitra]

LXI B, 4050H ; Starting location of the 16-bit BCD Numbers LXI D, 0000H LXI H, 0000H MVI A, 00H

L2: LDAX B ADD L INX B LDAX B ADC H JNC L INR E L1: INX B MOV A, C CPI 0AH JC L

MOV A, L STAX B INX B MOV A, H STAX B INX B MOV A, E STAX B HLT

  1. Write an 8085 program to display the BCD digits from 0 to 9 the seven segments as in the following diagram. Use the activating data bits same as the segment number as in figure below. [2059 Shrawan] 0 5 1 6 4 2

3 LXI SP, 2999H LXI H, 2050H MOV M, 3FH INX H MOV M, 06H INX H MOV M, 5BH INX H MOV M, 4FH INX H MOV M, 66H INX H MOV M, 6DH INX H MOV M, 7DH INX H MOV M, 07H INX H MOV M, 7FH INX H MOV M, 6FH LXI B, 2060H

LDAX B ; Where the BCD digit is located ANI F0H RRC RRC RRC RRC CALL CODE OUT PORT 1 LDAX B ANI 0FH CALL CODE OUT PORT 2 HLT CODE: LXI H, 2050H ADD L MOV L, A MOV A, M RET

  1. Someone has damaged a program written at 4050H for 8085 microprocessor. The damaging is done by changing the bit D 7 and bit D 5 of each byte. The size of the program is 100 bytes. Now write a program for 8085 to correct this damaged program. [2060 Chaitra]

LXI H, 4050H MVI C, 64H L1: MOV A, M ANI 80H ; 10000000 B RRC RRC MOV B, A MOV A, M ANI 20H ; 00100000 B RLC RLC MOV C, A MOV A, M ANI 5FH ; 01011111 B ORA B ORA C STAX H INX H DCR C JNZ L HLT

  1. The temperature of two furnaces being monitored by a microprocessor based system. A set of readings of the first furnace recorded by thermal sensor is stored at memory locations starting at 4050H. Corresponding readings from the second furnace is stored at the memory location starting at 4070H. Each reading from the first furnace is expected to be higher than the corresponding reading from the second furnace. Among the eight bit data bit D 7 is used to test the validity of the data. Write an 8085 program to compare valid data from the two tables, if data from first table is larger than the corresponding data from the second table store 01H in the corresponding memory of the third location starting at 4090H and display 01H to indicate the normal operation else store FFH in the corresponding memory location and display FFH in the port to indicate the emergency. When emergency condition is reached stop the operation. [2060 Jestha] LXI B, 4050H LXI H, 4070H LXI D, 4090H L2: LDAX B CMP M JC L JZ L MVI A, 01H STAX D OUT PORT INX B IND H INX D JMP L L1: MVI A, FFH STAX D OUT PORT HLT

  2. Write a program to transfer eight-bit numbers from 9080H to 9090H if bit D 5 is 1 and D 3 is 0. Otherwise transfer data by changing bit D 2 and D 6 from 1 to 0 or from 0 to 1. Assume there are ten numbers. [2064 Shrawan] LXI H, 9080H LXI D, 9090H MVI C, 0AH L2: MOV A, M ANI 28H CPI 20H JZ L MOV A, M XRI 44H MOV M, A L1: MOV A, M STAX D INX H INX D DCR C JNZ L HLT

  3. Write an assembly language program to count no. of –ve element in a data block containing 16 bytes of data; store the count at the end of the block if the count is greater than 8 otherwise stores 0. [2065 Chaitra]

Was this document helpful?
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

Micro 85 Solved Tutorial

Course: Microprocessors (MICCEI 405R02)

7 Documents
Students shared 7 documents in this course
Was this document helpful?

This is a preview

Do you want full access? Go Premium and unlock all 16 pages
  • Access to all documents

  • Get Unlimited Downloads

  • Improve your grades

Upload

Share your documents to unlock

Already Premium?
1
Tutorial 1 (ALP 8085)
Microprocessor (BCT II / II)
1. Add two numbers located at 3030H and 4040H. Display sum on Port 1. If carry is generated,
display it on Port 2. Store sum on 5050H.
LDA 3030H
MOV B, A
LDA 4040H
ADD B
STA 5050H
OUT PORT 1
JNC L1
MVI A, 01H
OUT PORT 2
L1: HLT
2. Write an Assembly Language Program that retrieves a data located at 2050H and it displays,
if it is even and stores FFH on that location if it is odd.
LDA 2050H
ANI 01H
JNZ L1
LDA 2050H
OUT PORT 1
HLT
L1: MVI A, FFH
STA 2050H
HLT
3. Sixteen bytes of data are stored in memory location at 1050H to 105FH. Replace each data
byte by FF.
LXI H, 1050H
MVI C, 10H
L1: MVI M, FFH
INX H
DCR C
JNZ L1
HLT

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.