Escolar Documentos
Profissional Documentos
Cultura Documentos
Modoextendido Asm
Modoextendido Asm
asm
.include "m164pdef.inc"
.def tempo=r16
.def modos=r17
.def dato=r18
.def aux=r19
.dseg
dig0: .Byte 1
dig1: .Byte 1
dig2: .Byte 1
num0: .Byte 1
num1: .Byte 1
num2: .Byte 1
.cseg
.org 0x0
rjmp inicio
.org 0x02
jmp modo
.org 0x1A
jmp segundo
inicio:
clr modos
ldi tempo,0b00001111
out ddrb,tempo
ldi tempo,high(ramend)
out sph,tempo
ldi tempo,low(ramend)
out spl,tempo
call configurar_pull_up
call configurar_int0
call configurar_timmer1
lazo:
rjmp lazo
segundo:push tempo
in tempo,sreg
push tempo
call configura_entrada
call leer_puerto
call analizar
pop tempo
out sreg,tempo
pop tempo
reti
ret
Page: 1
C:\Users\Jonathan\Documents\septimo semestre\Laboratorio de Contro...\modoextendido.asm
brne leds
call displays
retorno: ret
ser tempo
out portc,tempo
ldi tempo,2
out portb,tempo
ldi tempo,3
out portb,tempo
ldi tempo,4
out portb,tempo
ldi tempo,1
out portb,tempo
call retardo
mov tempo,dato
out portc,tempo
call retardo
rjmp retorno
bin_bcd:
clr tempo
Page: 2
C:\Users\Jonathan\Documents\septimo semestre\Laboratorio de Contro...\modoextendido.asm
call inicializo_puntero
lds tempo,dig2
call buscar_numero
sts num2,tempo
ret
ldi tempo,2
out portb,tempo
call retardo
lds tempo,num2
out portc,tempo
call retardo
ldi tempo,3
out portb,tempo
call retardo
lds tempo,num1
out portc,tempo
call retardo
ldi tempo,4
out portb,tempo
call retardo
lds tempo,num0
out portc,tempo
call retardo
ret
inicializo_puntero:
ldi zh,high(tabla<<1)
ldi zl,low(tabla<<1)
ret
buscar_numero: add zl,tempo
clr tempo
adc zh,tempo
lpm tempo,z
ret
configurar_pull_up: in tempo,mcucr
andi tempo,0b11101111
out mcucr,tempo
ret
ret
Page: 3
C:\Users\Jonathan\Documents\septimo semestre\Laboratorio de Contro...\modoextendido.asm
sts eicra,tempo
ldi tempo,0b00000001
out eimsk,tempo
clr tempo
out ddrd,tempo
ldi tempo,0b00000100
out portd,tempo
sei
ret
com modos
pop tempo
out sreg,tempo
pop tempo
reti
Page: 4