You are on page 1of 2

#include "p16f877a.

inc"
ORG 0x00
GOTO principal
;********************************************************************
;rutina del programa principal
;********************************************************************
principal call config_
;LLAMA LA RUTINA DE CONFIG_
CALL INICIO
;LLAMA LA RUTINA DE INICIO
MOVLW 0X10
CALL TABLA
;LLAMA LA RUTINA DE LA TABLA
MOVWF PORTD
AQUI
goto AQUI
;CICLA EL PROGRAMA
;****************************************************
;
RUTINA DE CONFIGURACION TMR1
;****************************************************
config_ bcf
BCF
MOVLW
MOVWF
BCF
BSF
CLRF
BCF
BCF
BSF
BSF
BSF
BSF
Return

STATUS,RP1
STATUS,RP0
;SELECCIONA EL BANCO 0
0x04
;CON ESTE VALOR SE CONFIGURAR EL TMR1
T1CON
;HABILITAMOS EL TMR1
STATUS,RP1
STATUS,RP0
TRISD
PIR1,TMR1IF
STATUS,RP1
STATUS,RP0
PIE1,TMR1IE
INTCON,PEIE
INTCON,GIE

;*****************************************************
;
RUTINA PARA INICIALIZAR EL TMR1 EN 0
;*****************************************************
INICIO

BCF
BCF
CLRF
CLRF
RETURN

STATUS,RP1
STATUS,RP0
TMR1L
TMR1H

;*****************************************************
;
RUTINA PARA TABLA
;*****************************************************
TABLA ADDWF
PCL,F
RETLW
0X02;0
RETLW
0X04;1
RETLW
0X06;2
RETLW
0X08;3
RETLW
0X0A;4
RETLW
0X0C;5
RETLW
0X0E;6
RETLW
0X10;7
RETLW
0X12;8
RETLW
0X14;9

RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW

END

0X16;10
0X18;11
0X1A;12
0X1C;13
0X1E;14
0X20;15
0X22;16
0X24;17
0X26;18
0X28;19
0X2A;20
0X2C;21
0X2E;22
0X30;23
0X32;24
0X34;25
0X36;26
0X38;27
0X3A;28
0X3C;29