Running 2 Youtube Channel : The Masti Adda (Fun based ) : The Knowledge Adda (Knowledge based) : Subscribe for Knowledge with Fun....

Write a program to checks the hex number stored at a location for odd or even parity.

Written by @
Apparatus Used: Microprocessor, Keyboards
Assumption: In this program we have to write a program to check that a number is stored at location for odd or even parity. Let assume that number is stored at 2050 H and if the parity is odd then store 00 at 2051 H else store 00 at 2051 H.
 
Algorithm:
  • Load the number into accumulator
  • OR the contents of accumulator itself
  • Check the parity for even and odd and store 00 or EE at output location
  • End the program
Program:
Memory Add
Mnemonics
Op-code
Comments
2000
LXI
H,2050 H
Set the memory pointer
2003
MOV
A,M
Get the number in accumulator
2004
ORA
A
Set the flag
2005
JPO
200C
If parity is odd then jump to 200C
2008
INR
L
Point to memory location for result
2009
MVI
M,EE
Store the output at 2051 H
200B
RST
5
Set the break point
200C
INR
L
Point to memory location for result
200D
MVI
M,00
Store the result
200F
RST
5
Set the break point
2010
END
End the Program
Description of used instruction:
LXI: This instruction is used to store the 16-bit data in the register pair designated in the operand.
MOV: This instruction is used to copy the content from source register to destination register.
MVI: This instruction is used to store 8 bit data in specified register.
INR: This instruction is used to increment the content of register by one.
ORA: Logically OR the contents of register/memory with the accumulator.
JPO: Jump if parity is odd at given location.
RST 5: This instruction is used to set break-point for the execution.
END: This instruction is used to execute the program.
 
Result:
Input:
2050-05
Output:
2051-00
 
Procedure to look output
· After press ENTER, You will get first screen
· Press G and Provide Initial address (as 2000)
· Press SHIFT+4,You will get first screen again
· Press M and Provide Input location for Input (M2050)
· Press ENTER and Provide your Input at location (2050:05)
· Press SHIFT+4
· Press G and Provide Initial address (as 2000)
· Press SHIFT+4,You will get first screen again
· Press M and Provide address for output (M2051) and press ENTER
· You will get your desired output.

2 comments:

  1. how can we optimise this program?

    ReplyDelete
  2. Just follow above step using microprocessor kit...

    ReplyDelete