Q. A seven segment display is connected to output port 30H for an Intel 8085 based system.
Write a program to convert the content of memory location C000H to seven segment
display. Assume that the memory location contains any number from 0 to 9. If the
number is greater than 9 all the LEDs of the display should be off. ( Hint: store the bit
pattern for numbers from 0 to 9 in memory locations D000H-D009H(say) and then the
program should find the pattern according to the number in C000H and display that to
output port 30H)
soln
The table below shows the seven segment display requirement for numbers 0 to 9
LXI H, D000H ; store the bit pattern of the numbers from 0 to 9
MVI M, 3FH
INX H
MVI M, 06H
INX H
MVI M, 5BH
INX H
MVI M, 4FH
INX H
MVI M, 66H
INX H
MVI M, 6DH
INX H
MVI M, 7DH
INX H
MVI M, 07H
INX H
MVI M, 7FH
INX H
MVI M, 6FH
MVI H, D0H
LDA C000H
CPI 0AH ; check for number > 9
JC LABEL1
MOV L, A
MOV A, M
JMP LABEL2
LABEL1: MVI A, 00H
LABEL2: OUT 30H
HLT
Write a program to convert the content of memory location C000H to seven segment
display. Assume that the memory location contains any number from 0 to 9. If the
number is greater than 9 all the LEDs of the display should be off. ( Hint: store the bit
pattern for numbers from 0 to 9 in memory locations D000H-D009H(say) and then the
program should find the pattern according to the number in C000H and display that to
output port 30H)
soln
The table below shows the seven segment display requirement for numbers 0 to 9
LXI H, D000H ; store the bit pattern of the numbers from 0 to 9
MVI M, 3FH
INX H
MVI M, 06H
INX H
MVI M, 5BH
INX H
MVI M, 4FH
INX H
MVI M, 66H
INX H
MVI M, 6DH
INX H
MVI M, 7DH
INX H
MVI M, 07H
INX H
MVI M, 7FH
INX H
MVI M, 6FH
MVI H, D0H
LDA C000H
CPI 0AH ; check for number > 9
JC LABEL1
MOV L, A
MOV A, M
JMP LABEL2
LABEL1: MVI A, 00H
LABEL2: OUT 30H
HLT
Comments
Post a Comment