Write a complet assembly program (assember directives, initialization, main rout
ID: 2083380 • Letter: W
Question
Write a complet assembly program (assember directives, initialization, main routine and subroutines) to implement the logic for a car interior lighting sysyem:
- If the sysytem is enabled (mode switch is in "Enable" position), and any of the four door switches are activated, then the light should turn on. The light should turn off if all doors are closed, or if the system is disabled( mode switch is in the OFF position).
- In addition, the light should turn off after 1 minute if somebody forgets to completely close the door. Assume a system clock of 128 kHZ. You may use any timer in any mode.
- You should also be able to manualy turn the light on (non-timed) by moving the mode switch to the ON position.
You may use any pin checking methoed (poling, scanning, interrupts, or a combination of the methods). Instead of re-writing,
Attiny24 VCC 1 14 GND (PCINT8/XTAL1/CLK) PB0 2 13 PAO (ADCOAREF/PCINTO) (PCINT9/XTAL2) PB1 C 3 12 J PA1 (ADc1/AINO/PCINT1) (PCINT11/RESET/dW) PB3 C 4 11 PA2 (ADC2/AIN1/PCINT2) 10 PA3 (ADC3/TO/PCINT3) (PCINT10flNTO/ocoAycKOUT) PB2 5 9 PA4 (ADCA/USCK/SCLUT1/PCINT4) (PCINT7/ICPIOCOB/ADCT) PATE6 8 A5 (ADC5/DOMISO/OC1By PCINT5) (PCINT6/oc1A/SDAMOSI/DVADC6) Door switches Interrior light Mode switch On Enable OFFExplanation / Answer
MODEL SMALL
.STACK 100
.DATA
CWR EQU 0FFC6 H
PORTA EQU 0FFC0 H
PORTB EQU 0FFC2 H
PORTC EQU 0FFC4 H
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV AL,80H
MOV DX,CWR
OUT DX,AL
MOV AL,F3H
MOV DX,PORTC
OUT DX,AL
MOV AL,FFH
MOV DX,PORTA
OUT DX,AL
MOV AL,FFH
MOV DX,PORTB
OUT DX,AL
MOV CL,03H
CALL DELAY
TOP:
MOV AL,EEH
MOV DX,PORTA
OUT DX,AL
MOV AL,EEH
MOV DX,PORTB
OUT DX,AL
MOV CL,02H
CALL DELAY
MOV AL,FCH
MOV DX,PORTC
OUT DX,AL
MOV AL,7DH
MOV DX,PORTA
OUT DX,AL
MOV AL,57H
MOV DX,PORTB
OUT DX,AL
MOV CL,15H
CALL DELAY
MOV AL,E7H
MOV DX,PORTB
OUT DX,AL
MOV AL,FDH
MOV DX,PORTA
OUT DX,AL
MOV AL,EDH
MOV DX,PORTA
OUT DX,AL
MOV CL,02H
CALL DELAY
MOV AL,F7H
MOV DX,PORTB
OUT DX,AL
MOV AL,F0H
MOV DX,PORTC
OUT DX,AL
MOV AL,F1H
MOV DX,PORTA
OUT DX,AL
MOV CL,15H
CALL DELAY
MOV AL,FBH
MOV DX,PORTA
OUT DX,AL
MOV AL,FBH
MOV DX,PORTB
OUT DX,AL
MOV AL,50H
MOV DX,PORTC
OUT DX,AL
MOV CL,15H
CALL DELAY
MOV AL,FEH
MOV DX,PORTA
OUT DX,AL
MOV AL,FEH
MOV DX,PORTB
OUT DX,AL
MOV CL,03H
CALL DELAY
MOV AL,FFH
MOV DX,PORTA
OUT DX,AL
MOV AL,AFH
MOV DX,PORTC
OUT DX,AL
MOV AL,EEH
MOV DX,PORTA
OUT DX,AL
MOV AL,EEH
MOV DX,PORTB
OUT DX,AL
MOV CL,02H
CALL DELAY
MOV AL,BFH
MOV DX,PORTA
OUT DX,AL
MOV AL,BFH
MOV DX,PORTB
OUT DX,AL
MOV CL,15H
CALL DELAY
JMP TOP
DELAY:
MOV BX,10H
D1:
MOV CX,0FFFFH
D2:
LOOP D2
DEC BX
JNZ D1
INT 03H
END START
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.