Sei sulla pagina 1di 3

;**********************************************************************

; Ejercicio 2.- Almacenar los nmeros pares en 15 posiciones contiguas


; de la memoria de datos, empezando desde la posicion 20, luego mostrar
; cada dato almacenado en el puerto B
;**********************************************************************
LIST P=16F877A
INCLUDE "P16F877A.INC"
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
CBLOCK 0X40 ;definimos las variables que usaremos
CONTA_1
CONTA_2
CONTA_3
ENDC
ORG 0x20
Count RES 15
ORG 0X00
BSF STATUS,RP0
BCF STATUS,RP1
movlw 0x00
movwf TRISB
BCF STATUS,RP0
INICIO
movlw 0x02
movwf Count ; Valor asignado a Direccion 20H = 0X02
movwf PORTB
call Retardo_1s ; Tiempo en que permanecera prendido el led
movlw
0x00
movwf PORTB
call Retardo_1s ; Tiempo en que permanecera apagado el led
movlw 0x04
movwf Count +1
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x06
movwf Count +2
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x08
movwf Count +3
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB

call Retardo_1s
movlw 0x0A
movwf Count +4
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x0C
movwf Count +5
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x0E
movwf Count +6
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x10
movwf Count +7
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x12
movwf Count +8
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x14
movwf Count +9
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x016
movwf Count +10
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x18
movwf Count +11
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x1A
movwf Count +12
movwf PORTB

call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x1C
movwf Count +13
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
call Retardo_1s
movlw 0x1E
movwf Count +14
movwf PORTB
call Retardo_1s
movlw 0x00
movwf PORTB
goto INICIO
Retardo_1s
movlw .1
goto bucle_1s
bucle_1s
movlw d'10' ; W

Potrebbero piacerti anche