Hola!
Estoy tratando de hacer un taximetro, utilizando el TMR0 para controlar la velocidad del motor y la interrupcion externa 0 (INT0) para que cuente las vueltas del motor.
Cada de que entra a la interrupción pido que se me incremente mi registro Tar_U y lo mande al puerto D.
El problema es que no entra en la interrupción.
Según yo ya lo configuré bien
Me pueden Ayudar porfa?
LIST P=18F4550, F=INHX32 ;directive to define processor
#include <P18F4550.INC> ;processor specific variable definitions
;******************************************************************************
;Configuration bits
CONFIG PLLDIV = 5 ;(20 MHz crystal on PICDEM FS USB board)
CONFIG CPUDIV = OSC1_PLL2
CONFIG USBDIV = 2 ;Clock source from 96MHz PLL/2
CONFIG FOSC = HSPLL_HS
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRT = OFF
CONFIG BOR = ON
CONFIG BORV = 3
CONFIG VREGEN = ON ;USB Voltage Regulator
config WDT = OFF
config WDTPS = 32768
config MCLRE = ON
config LPT1OSC = OFF
config PBADEN = OFF ;NOTE: modifying this value here won't have an effect
;on the application. See the top of the main() function.
;By default the RB4 I/O pin is used to detect if the
;firmware should enter the bootloader or the main application
;firmware after a reset. In order to do this, it needs to
;configure RB4 as a digital input, thereby changing it from
;the reset value according to this configuration bit.
config CCP2MX = ON
config STVREN = ON
config LVP = OFF
config ICPRT = OFF ; Dedicated In-Circuit Debug/Programming
config XINST = OFF ; Extended Instruction Set
config CP0 = OFF
config CP1 = OFF
config CP2 = OFF
config CP3 = OFF
config CPB = OFF
config CPD = OFF
config WRT0 = OFF
config WRT1 = OFF
config WRT2 = OFF
config WRT3 = OFF
config WRTB = OFF ; Boot Block Write Protection
config WRTC = OFF
config WRTD = OFF
config EBTR0 = OFF
config EBTR1 = OFF
config EBTR2 = OFF
config EBTR3 = OFF
config EBTRB = OFF
;******************************************************************************
;Variable definitions
CONTADOR_H equ 0x30
CONTADOR_L equ 0x34
Tar_U equ 0x31
Tar_D equ 0x32
Tar_C equ 0x33
;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.
ORG 0x0000
goto Main ;go to start of main code
;****************************************************************
ORG 0x0008
goto HighPr_ISR ;go to start of ISR
;****************************************************************
ORG 0x0018
goto LowPr_ISR ;go to start of ISR
;****************************************************************
; Start of High Priority ISR
; rutina de servicio de interrupcion prioridad alta ****************************************************************
HighPr_ISR
bsf PORTA,4
incf Tar_U
movff Tar_U,PORTD
bcf INTCON,INT0IF
retfie
;****************************************************************
; Start of Low Priority ISR
; Rutina de servicio de interrupcion prioridad baja ****************************************************************
; ORG 0x1018
LowPr_ISR
bsf PORTA,4
retfie
;****************************************************************
;******************************************************************************
;Start of main program
; The main program code is placed here.
ORG 0x1000
Main ; *** main code goes here **
INICIO
call C_PUERTOS
call C_VUELTAS
TEST1 btfss PORTC,2
goto TEST2
goto DIA
TEST2 btfss PORTC,4
goto TEST1
goto NOCHE
goto INICIO
C_VUELTAS
bcf RCON,7
movlw 0xD0
movwf INTCON
bcf INTCON2,6
return
C_PUERTOS
movlw 0x0F
movwf ADCON1
clrf TRISA
setf TRISB
clrf TRISD
setf TRISC
clrf PORTA
clrf PORTD
return
DIA
movlw 0x07
movwf Tar_U
movff Tar_U,PORTD
D1 btfss PORTC,5
goto D1
D4 movlw d'12'
movwf CONTADOR_H
movlw d'4'
movwf CONTADOR_L
bsf PORTA,5
D2 call TIMER
decfsz CONTADOR_H
goto D2
bcf PORTA,5
D3 call TIMER
decfsz CONTADOR_L
goto D3
goto D4
NOCHE
movlw 0x15
movwf Tar_U
movff Tar_U,PORTD
N1 btfss PORTC,5
goto D1
N4 movlw d'12'
movwf CONTADOR_H
movlw d'4'
movwf CONTADOR_L
bsf PORTA,5
N2 call TIMER
decfsz CONTADOR_H
goto N2
bcf PORTA,5
N3 call TIMER
decfsz CONTADOR_L
goto N3
goto N4
TIMER
movlw 0x08
movwf T0CON
movlw 0xD1
movwf TMR0H
movlw 0x20
movwf TMR0L
bcf INTCON,2
bsf T0CON,7
T1 btfss INTCON,2
goto T1
return
; end of main
;******************************************************************************
; Start of
;******************************************************************************
;******************************************************************************
;******************************************************************************
;End of program
END