Question
Given below is a snippet of a program that will display number “3” on a 7-segment LED which is connected at output port 08h.
Program:
MOV AL , 30h
OUT 08h, AL
7-segment detail
7-segment LED (a-f) is connected to the port pins (1-7) respectively.
7-segment LED is lid at low state
Assume a second 7 segment LED are connected to outport port 05h. Modify the program to display number “80” (the second LED will display number “8”).
Then assume the output from the port 05h and 08h will be inserted into another microprocessor (also at port 05h and 08h respectively). Write the program needed at the second microprocessor to receive the data. The data should be saved into any other location after retrieval.
Answer
30h = 011 0000 <-- gfedcba
a = 0
b = 0
c = 0
d = 0
e = 1
f = 1
g = 0
First LED (number 8,port 08h)
to display number 8, all will be active (active at low)
a = 0
b = 0
c = 0
d = 0
e = 0
f = 0
g = 0
000 0000 = 00h
Second LED (number 0,port 05h)
to display number 0, all will be active except g (active at low)
a = 0
b = 0
c = 0
d = 0
e = 0
f = 0
g = 1
100 0000 = 60h
therefore the complete program would be
MOV AL , 00h
OUT 08h, AL //activate first LED to display 8
MOV AL , 60h
OUT 05h, AL ////activate first LED to display 0
-------------------------------------------------
the program at the second microprocessor to receive the input
IN AL,08h // retrieve the data
MOV DL,AL // store the data at another location
IN AL, 05h
MOV DH,AL