Vous êtes sur la page 1sur 2

;====================================================================

; Main.asm file generated by New Project wizard


;NOMBRE_
; Created: mar abr 16 2019
; Processor: AT89C52
; Compiler: ASEM-51 (Proteus)
;====================================================================

$NOMOD51
$INCLUDE (80C52.MCU)

;====================================================================
; DEFINITIONS
;====================================================================

;====================================================================
; VARIABLES
;====================================================================

;====================================================================
; RESET and INTERRUPT VECTORS
;====================================================================

; Reset Vector

;====================================================================
; CODE SEGMENT
;====================================================================

org 0000h ; direccion del reseteo


inicio:
mov a,#00000001b ; cargando con 1 bit
mostrar:
mov p0,a
acall retardo
jb p1.0,izquierda
derecha:
rr a
ajmp mostrar
izquierda:
rl a
ajmp mostrar

; * * * * * * * * * * * * * * * * * * * * * * * *
; retardo de 500 micro segundos (500us)
; * * * * * * * * * * * * * * * * * * * * * * * *
; tiempo = sec * 12 periodos
; 12MHz 1 ciclo de maquina
; * * * * * * * * * * * * * * * * * * * * * * * *
; tiempo = 0.5 s = 500000us
; ciclos de maquina
; * * * * * * * * * * * * * * * * * * * * * * * *
retardo: ;(2) = 2
mov r6,#0fah ;(1) = 1
xx: mov R7,#0f9h ;(1)*r6[250] = 250
nop ;(1)*r6(250) = 250
nop ;(1)*r6(250) = 250
nop ;(1)*r6(250) = 250
nop ;(1)*r6(250) = 250
nop ;(1)*r6(250) = 250
xxx: nop ;(1)*r6[250]*r7[249] = 62250
nop ;(1)*r6[250]*r7[249] = 62250
nop ;(1)*r6[250]*r7[249] = 62250
nop ;(1)*r6[250]*r7[249] = 62250
nop ;(1)*r6[250]*r7[249] = 62250
nop ;(1)*r6[250]*r7[249] = 62250
djnz R7,xxx ;(2)*r6[250]*r7[249] = 124500
djnz r6,xx ;(2)*r6[250] = 500
ret ;(2) = 2
; ----------------------------------
end

Vous aimerez peut-être aussi