Está en la página 1de 17

UNIVERSIDAD RICARDO PALMA

FACULTAD DE INGENIERA

ESCUELA PROFESIONAL DE INGENIERA


ELECTRNICA

CURSO : MICROPROCESADORES

DOCENTE : Meza Arrieta, Juan

ALUMNO : Huamani Huaman Roy Godofredo

CDIGO : 200522345
2008
PROBLEMA 1

.data 1000h

db 77h,44h,3eh,6eh,4dh,6bh,7bh,46h,7fh,6fh
db 10h,73h,42h,22h,98h,17h,18h,57h,81h,55h,42h,66h,00h,77h ,
24h,11h,18h,33h,81h,55h,42h,02h,42h,00h,00h,31h,18h,57h,
42h,66h,00h,77h,90h,17h
db 00h,33h,18h,57h,00h,31h,18h,33h,81h,55h,42h,02h,18h,57h,
81h,55h,42h,66h,00h,77h,
18h,63h,42h,00h,18h,63h,42h,02h,18h,33h,05h,55h,18h,57h

.org 0000h

lxi h,1002h
mov a,m
out 00h
lxi h,1007h
mov a,m
out 01h
call retardo
call retardo
call retardo
call retardo
tini: inx h
mov a,l
cpi 0ah
jz lazo2
mov a,m
out 01h
call retardo
jmp tini

lazo2:
lxi h,1000h
mov a,m
out 01h
lxi h,1003h
mov a,m
out 00h

call retardo
lxi h,1001h
lazo3: mov a,m
out 01h
inx h
mov a,l
cpi 03h
jnz lazo3
call retardo
call ventilador
lxi h,1003h
lazo4: dcr l
mov c,l
call ventilador
mov l,c
call retardo
mov a,m
out 01h

mov a,l
cpi 00h
jz lazo5
mov a,l
cpi 07h
jnz lazo4

lazo5: call retardo


lxi h,1002h
mov a,m
out 00h
lxi h,1009h
lazo6: mov a,m
out 01h
dcr l
mov a,l
cpi 06h
jz lazo7
mov c,l
call ventilador
call retardo
mov l,c
jmp lazo6

lazo7: call retardo


call retardo
call retardo
lazo8: mov a,m
out 01h
dcr l
mov a,l
cpi 02h
jz lazo9
jmp lazo8

lazo9:
inr l
mov a,l
cpi 08h
jz lazoa
mov d,l
mov a,m
out 01h
call retardo
call calefaccion
mov l,d
jmp lazo9
lazoa:
call retardo
call retardo
call retardo
hlt

ventilador:
lxi h,100ah
mov a,m
out 02h
inx h
mov a,m
out 03h
inx h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh
call limpiar
lxi h,1018h
mov a,m
out 02h
inx h
mov a,m
out 03h
inx h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh
call limpiar
lxi h,1026h
mov a,m
out 02h
inx h
mov a,m
out 03h
inx h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
call limpiar
ret

calefaccion:
lxi h,102ch
mov a,m
out 02h
inx h
mov a,m
out 03h
inx h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh
call limpiar
lxi h,103ah
mov a,m
out 02h
inx h
mov a,m
out 03h
inx h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
call limpiar

lxi h,1040h
mov a,m
out 02h
inx h
mov a,m
out 03h
inx h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh

call limpiar
ret
retardo:
mvi b,05h
lazo: dcr b
jnz lazo
ret

limpiar: lxi h,10ffh


mov a,m
out 02h
out 03h
out 04h
out 05h
out 06h
out 07h
out 08h
out 09h
out 0ah
out 0bh
out 0ch
out 0dh
out 0eh
out 0fh
ret

PROBLEMA 2

.data 0000h

db 10h,73h,42h,22h,98h,17h,18h,57h,94h,00h,18h,00h
db 10h,73h,42h,22h,98h,17h,18h,57h,18h,00h,29h,00h

db 18h,57h,18h,71h,90h,17h,18h,33h
db 00h,33h,42h,00h,18h,33h,90h,17h,90h,17h,18h,57h

db 18h,63h,00h,75h,18h,71h,42h,00h,90h,17h
db 18h,71h,18h,57h,00h,64h,18h,57h,90h,17h

db 77h,44h,3eh,6eh,4dh,6bh,7bh,46h,7fh,6fh

.org 004bh

mvi b,00h
mvi c,00h
mvi d,00h

inicio:
mvi a,01h
out 00h
call retardo
call abremano
mvi a,04h
out 00h
call retardo

call abremano
mvi a,02h
out 00h
call retardo
call abremano
mvi a,08h
out 00h
call retardo
call abremano

call retardo
mvi a,00h
out 00h
call retardo
mvi a,08h
out 00h
call retardo

call cierramano
mvi a,02h
out 00h
call retardo
call cierramano
mvi a,04h
out 00h
call retardo

call cierramano
mvi a,01h
out 00h
call retardo
call cierramano

call retardo
call retardo
call retardo

in 00h
cpi 01h
jz objetoa
call retardo
puerto1: in 01h
cpi 01h
jz objetob
call retardo
puerto2: in 02h
jz objetoc
jmp inicio

objetoa: call oba


jmp inicio
objetob: call obb
jmp inicio
objetoc: call obc
jmp inicio

oba:
inr b
mov a,b
cpi 63h
jz puerto1
call led1
call subir
call retardo
call abremano2
call retardo
call bajar
call retardo
jmp inicio

obb:
inr c
mov a,c
cpi 63h
jz puerto2
call led2
call aizquierda
call retardo
call abremano2
call aderecha
call retardo
jmp inicio

obc:
inr d
mov a,d
cpi 63h
jz inicio
call led3
call aderecha
call retardo
call abremano2
call retardo
call aizquierda
call retardo
jmp inicio

led1:
mov a,b
out 01h
call retardo
ret
led2:
mov a,c
out 02h
call retardo
ret

led3:
mov a,d
out 03
call retardo
ret

abremano2:

mvi a,01h
out 00h
call retardo
call abremano
mvi a,04h
out 00h
call retardo

call abremano
mvi a,02h
out 00h
call retardo
call abremano
mvi a,08h
out 00h
call retardo
call abremano

call retardo
mvi a,00h
out 00h
call retardo
mvi a,08h
out 00h
call retardo

call cierramano
mvi a,02h
out 00h
call retardo
call cierramano
mvi a,04h
out 00h
call retardo

call cierramano
mvi a,01h
out 00h
call retardo
call cierramano
call retardo
call retardo
call retardo
ret

aderecha:

mvi a,01h
out 00h
call retardo
call derecha
mvi a,04h
out 00h
call retardo
call derecha
mvi a,02h
out 00h
call retardo
call derecha
mvi a,08h
out 00h
call retardo
call derecha
ret

derecha:
lxi h,000ch
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh

call retardo
call retardo
call limpiar
ret

aizquierda:

mvi a,01h
out 00h
call retardo
call izquierda
mvi a,04h
out 00h
call retardo
call izquierda
mvi a,02h
out 00h
call retardo
call izquierda
mvi a,08h
out 00h
call retardo
call izquierda
ret

izquierda:
lxi h,0000h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh

call retardo
call retardo
call limpiar
ret

subir:
lxi h,002ch
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
call retardo
call retardo
call limpiar
ret
bajar:
lxi h,0036h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
call retardo
call retardo
call limpiar
ret

retardo:
mvi e,05h
lazo: dcr e
jnz lazo
ret
abremano:
lxi h,0018h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
call limpiar
ret
cierramano:
lxi h,0020h
mov a,m
out 04h
inx h
mov a,m
out 05h
inx h
mov a,m
out 06h
inx h
mov a,m
out 07h
inx h
mov a,m
out 08h
inx h
mov a,m
out 09h
inx h
mov a,m
out 0ah
inx h
mov a,m
out 0bh
inx h
mov a,m
out 0ch
inx h
mov a,m
out 0dh
inx h
mov a,m
out 0eh
inx h
mov a,m
out 0fh
call limpiar
ret

limpiar: lxi h,004ah


mov a,m
out 04h
out 05h
out 06h
out 07h
out 08h
out 09h
out 0ah
out 0bh
out 0ch
out 0dh
out 0eh
out 0fh
ret

También podría gustarte