Professional Documents
Culture Documents
Interrupcion para Pic 18F4550
Interrupcion para Pic 18F4550
; This file is a basic template for assembly code for a PIC18F4550. Copy *
; this file into your project directory and modify or add to it as needed. *
; *
; template code is written for priority interrupt levels and the IPEN bit *
; left in its default zero state, only the interrupt vector at 0x008 will *
; be used and the WREG_TEMP, BSR_TEMP and STATUS_TEMP variables will not *
; be needed. *
; *
; *
; *
;******************************************************************************
; *
; Filename: PlantillaASM *
; Date: 12/01/11 *
; *
; *
;******************************************************************************
; *
; *
;******************************************************************************
;******************************************************************************
;Configuration bits
CONFIG BOR = ON
CONFIG BORV =3
config MCLRE = ON
config CCP2MX = ON
config STVREN = ON
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
;******************************************************************************
;Reset vector
RESET_VECTOR ORG 0
;******************************************************************************
ORG 0X0008
GOTO INTERRUPCION
;******************************************************************************
ORG 0x1000
CALL CONFIGPTOS
; end of main
;******************************************************************************
; Start of subrutines
;******************************************************************************
MOVWF ADCON1
MOVLW 0X07
MOVWF CMCON
MOVLW 0X00
MOVWF TRISD
MOVLW 0X07
MOVWF T0CON
MOVLW 0XA4
MOVWF TMR0H
MOVLW 0X15
MOVWF TMR0L
BCF INTCON,TMR0IF
BSF T0CON,TMR0ON
BSF INTCON,TMR0IE
BSF INTCON,GIE
RETURN
INTERRUPCION
ORG 0X2000
MOVLW 0XA4
MOVWF TMR0H
MOVLW 0X15
MOVWF TMR0L
BTG PORTD,0
BCF INTCON,TMR0IF
RETFIE
;******************************************************************************
;End of program
END