Write an Assembly language code such that when user press 1 led should glow and when user press 2 A should be displayed on 7segment.
Write an Assembly language code such that when user press 1 led should glow and when user press 2 A should be displayed on 7segment. Processor: 8086
I have an example code which needs changes as per the above question. The below example code works if user press 1, then the leds from 11 to 14 glow sequentially similarly when user press 2 hex value of 0 to F is displayed on 7-segment display while for any keyboard hit microprocessor will remain in no operation mode.
Code:
CODE SEGMENT ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE CW EQU 1FH PORTC EQU 1DH PORTB EQU 1BH PORTA EQU 19H KEY EQU 01H ORG 1000H MOV AL,80H OUT CW,AL BACK: MOV AL,0FFH OUT PORTA,AL CALL SCAN CMP AL,01H JNE L1 JMP LED L1: CMP AL,02H JNE L2 JMP SEGG L2: JMP BACK LED: MOV AL,00000001B A1: OUT PORTB,AL CALL TIMER SHL AL,1 TEST AL,00010000B JZ A1 JMP LED SEGG: MOV BX,OFFSET [REG] S1: MOV AL,[BX] CMP AL,0FFH JE SEGG OUT PORTA,AL CALL TIMER INC BX JMP S1 REG: DB 11000000B;0 DB 11111001B;1 DB 10100100B;2 DB 10110000B;3 DB 10011001B;4 DB 10010010B;5 DB 10000010B;6 DB 11111000B;7 DB 10000000B;8 DB 10010000B;9 DB 10001000B;A DB 10000011B;b DB 11000110B;C DB 10100001B;d DB 10000110B;E DB 10001110B;F DB 11111111B;OFF TIMER: PUSH CX MOV CX,1 TIMER2: PUSH CX MOV CX,0 TIMER1: NOP NOP NOP LOOP TIMER1 POP CX LOOP TIMER2 POP CX RET SCAN: IN AL,KEY TEST AL,10000000B JNZ SCAN AND AL,00011111B OUT KEY,AL RET CODE ENDS END
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started