Skip to content
Related Articles

Related Articles

Improve Article

Assembly program to transfer the status of switches

  • Last Updated : 30 Sep, 2019
Geek Week

Problem – Write an assembly language program in 8085 of interfacing between 8085 and 8255. 8 switches are connected at port A. Transfer the status of these switches into port B where LEDs are connected.

Example –


Input port is A and output port is B.

Algorithm –

  1. Construct the control word register
  2. Input the data from port A
  3. Display the result in port B

Program –



MnemonicsComments
MVI A, 90A ← 92
OUT 83Control Register ← A
IN 80A → Port A;OUT 81Port C A ← A
RETReturn

Explanation –

  1. MVI A, 92 means that the value of control register is 92.
    D7=1 as it is in I/O mode
    D6=0 & D5=0 as Poet A is in m0 mode
    D4=1 as Port A is taking input
    D3=0 & D0=0 as Port C is not taking part
    D2=0 as mode of Port B is m0
    D1=0as Port B is displaying the result
  2. OUT 83 putting the value of A in 83H which is the port number of port control register.
  3. IN 80 taking input from 80H which is the port number of port A.
  4. OUT 81 displaying the result in 81H which is the port number of port B.
  5. RET return

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :