New York, NY IMG HI 58° LO 56° Home About Contact
IMG-LOGO
Home Electrical and Electronics Microprocessor & Interfacing Write an assembly language program to find whether the number is even or odd.
Microprocessor & Interfacing Lab Experiments

Write an assembly language program to find whether the number is even or odd.



Aim

Write an assembly language program to find whether the number is even or odd.

Apparatus:8085 microprocessor kit.

Algorithm

  1. Load the content of memory location C0B0 in accumulator A.
  2. Perform AND operation with 01 in value of accumulator A by the help of ANI instruction.
  3. Check if zero flag is set, i.e. if ZF = 1 then store 0E in accumulator A otherwise store 0D in A.
  4. Store the value of A in memory location C0B1

Program:

Address Opcode Label Mnemonic Operand Comments
C000 LDA C0B0 Move the number from memory location C0B1 to accumulator
C003 ANI 01 Perform logical ANDING operation of number with 01
C004 88 ADD B Addition of Data1 (A) + Data2 (B). Result is saved in accumulator A.
C005 JN COOD Jump to location C00D if ZF = 1 i.e. number is Even
C008 MVI A,0D Move „0D‟ in A
C00A JNZ COOF Jump to location C00F if ZF = 1 i.e. number is ODD
C00D MVI A,0E Move „0E‟ in A
C00F STA COB1 Store the contents of A at location C0B1
C010 HLT RST1 Store the contents of A at location C0B1

    Result:Check the contents of accumulator, if A = 0D then the given number is odd and if A=0E it is even.

    Viva Questions:

    1. State the use of LDA instruction
    2. Which Stack is used in 8085?
    3. In 8085 name the 16 bit registers?
    4. What are the various flags used in 8085?
    5. What is Stack Pointer?

    I/O Interfacing with 8085 I/O Structure of a typical microcomputer:

    There are three major types of data transfer between the microcomputer and art I/O device. They are,

    1. Programmed I/O : In programmed I/O the data transfer is accomplished through an I/O port and controlled by software.
    2. Interrupt driven I/O : In interrupt driven I/O, the I/O device will interrupt the processor, and initiate data transfer.
    3. Direct memory access (DMA) : In DMA, the data transfer between memory and I/O can be performed by bypassing the microprocessor.
    4. block-diagram











      Subscribe

      Get all latest content delivered to your email a few times a month.