Está en la página 1de 39

U N ID A D 2

MIC ROCO NTRO LA D ORE S


PROGRAMACIÓN EN ENSAMBLADOR

•MICROCONTROLADOR PIC 16F887


•TARJETA DE EVALUACIÓN MIUVA 16
•INSTALAR EL SOFTWARE: MPLAB X, PICKIT-2
•GENERAR UN NUEVO PROYECTO EN MPLAB X
•ESCRIBIR EL PROGRAMA EN ENSAMBLADOR
; PIC16F887 Configuration Bit Settings

; Assembly source line config statements

#include "p16f887.inc"

; CONFIG1
; __config 0x33C2
__CONFIG _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_ON &
_MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_ON & _IESO_ON &
_FCMEN_ON & _LVP_ON
; CONFIG2
; __config 0x3FFF
__CONFIG _CONFIG2, _BOR4V_BOR40V & _WRT_OFF
#define _16f887
LIST P=16F887

ESTADO EQU 0x03


PORT_A EQU 0x05
PORT_B EQU 0x06
w EQU 0x00
REG_1 EQU 0x20
REG_2 EQU 0x21
REG_3 EQU 0x22
VALOR1 EQU 0x30
VALOR2 EQU 0x40
VALOR3 EQU 0x50
AUX EQU 0x23
ORG 0
goto inicio
ORG 7

inicio call conf


movlw 0x03
movwf AUX
bucle movf AUX,w
movwf PORT_B
call retardo
rlf AUX,1
goto bucle

conf bsf ESTADO,5


movlw b'11111111'
movwf PORT_A
movlw b'00000000'
movwf PORT_B
bcf ESTADO,5
return
retardo movlw VALOR1
movwf REG_1
tres movlw VALOR2
movwf REG_2
dos movlw VALOR3
movwf REG_3
uno decfsz REG_3
goto uno
decfsz REG_2
goto dos
decfsz REG_1
goto tres
return

end
•AÑADIR UN ARCHIVO ENSAMBLADOR AL
PROYECTO
•COMPILAR EL PROYECTO
•ABRIR PROGRAMA PICKIT-2 Y CONECTAR
TARJETA MIUVA 16
•CARGAR EL PROGRAMA .HEX
•VERIFICAR QUE EL ARCHIVO DE
CONFIGURACIÓN SEA IGUAL A 2FE2 0700
•GRABAR EL PROGRAMA EN EL PIC
FIN

También podría gustarte