Tengo este codigo que lo hice en Mplab Vr 6 hace años y ahora lo necesito lo compile nuevamente en el Mplab Vr 8 y no funciona no me entra el programa a las INTs, solo tengo activa la INT de cambio de estado en RB4-RB7, pensando que fuera el MPLAB, instale nuevamente la vieja version y tampoco funciona, la verdad ya no se que mas buscarle, me ayudan? uso solo las entradas RB4 y RB5 y tengo varias salidas, la idea es una secuencia especial dependiendo de los 4 posibles estados de RB4-RB5, y un led monitor de estado, gracias
Código:
;**********************************************************************
list p=16F628A ; list directive to define processor
#include <p16F628A.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_ON & _DATA_CP_ON & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _XT_OSC & _MCLRE_ON & _LVP_OFF
;********REG USO GENERAL********************************************
ON EQU 0
STAR EQU 1
GUN EQU 3
OK EQU 4
CHANGE EQU 20
PDel0 EQU 21
PDel1 EQU 22
w_temp EQU 23
status_temp EQU 24
TEMPO EQU 25
TEMPO_INTEN EQU 26
;**********************************************************************
RESET ORG 0x00 ; processor reset vector
goto MAIN ; go to beginning of program
;********************ATENCION A LAS INTERRUPCIONES*****************************
ORG 0x04 ; interrupt vector location
GOTO INT
INT movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
BTFSC INTCON,0 ; SE ACTIVO POR CAMBIO EN ENTRADAS?
GOTO CAMBIO
GOTO SAL_INT ;NINGUNO DE LOS DOS
CAMBIO BSF CHANGE,0
GOTO SAL_INT
SAL_INT movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
BCF INTCON,0 ;BORRO LA BANDERA
RETFIE ; return from interrupt
;*********************************************************************************
MAIN CLRF INTCON ;DESHABILITO TODAS LAS INTs
BSF STATUS,5
BCF STATUS,6 ;BANCO 1
MOVLW 0XFF
MOVWF TRISB ;PORTB RB4-RB7 =ENTRADAS
CLRF TRISA ;PORTA SALIDAS
CLRF PIE1
BSF OPTION_REG,7 ;DESHAB PULLUP
BCF STATUS,5 ;BANCO 0
CLRF PIR1
MOVLW 0X07
MOVWF CMCON ;DESCONECTO LOS COMPARADORES DE TENSION DEL PORTA
CLRF PORTA ;BORRO TODAS LAS SALIDAS
CLRF CHANGE
CALL DEMORA
CALL DEMORA
CALL DEMORA
CALL DEMORA
CALL DEMORA ;ESPERO 1 SEGUNDO A NORMALIZAR TODO
CALL ACCIONAR
MOVLW 0X88
MOVWF INTCON ;ACTIVO LAS INTs RB4-RB7
LOOP BCF PORTA,OK
CALL DEMORA ;LED ESTADO OK PARAPADEANDO
CALL DEMORA
CALL DEMORA
CALL DEMORA
BSF PORTA,OK
BTFSC CHANGE,0
GOTO ACCIONAR
CALL DEMORA
CALL DEMORA
CALL DEMORA
CALL DEMORA
CALL DEMORA
CALL DEMORA
BTFSC CHANGE,0
GOTO ACCIONAR
GOTO LOOP
;*************************************************************************************************
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%SUBRUTINA ACCIONAR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ACCIONAR BCF CHANGE,0
SWAPF PORTB,0 ;CARGO ENTRADAS Y COLOCO EN BITS DE MENOR PESO
ANDLW 0X03 ;BORRO LOS 6 BITS DE MAYOR PESO
ADDWF PCL,1
GOTO OFF_TOTAL
GOTO ARRANCAR
GOTO LOOP
GOTO ON_REPOSO
;*****************************************
OFF_TOTAL CLRF PORTA ;APAGO TODO FIN DE TODO
GOTO LOOP
;*****************************************
ARRANCAR MOVLW .5
MOVWF TEMPO_INTEN
LOOP_INI BSF PORTA,ON ;ON PLANTA
BSF PORTA,STAR ;INICIO ARRANQUE 2.5 SEGUNDOS
BSF PORTA,GUN
MOVLW .15
MOVWF TEMPO
LOOP_ST1 CALL DEMORA
DECFSZ TEMPO,1
GOTO LOOP_ST1
BCF PORTA,STAR ;APAGO ARRANQUE Y ESPERO 1SEG
BCF PORTA,GUN
MOVLW .15
MOVWF TEMPO
LOOP_ST2 CALL DEMORA
DECFSZ TEMPO,1
GOTO LOOP_ST2
DECFSZ TEMPO_INTEN,1
GOTO LOOP_INI
BCF PORTA,ON ;TERMINARON LOS 5 INTENTOS, EXISTE FALLO DE ARRANQUE APAGO TODO Y DOY ALARMA
GOTO FALL_STAR
FALL_STAR BCF INTCON,7 ;DESHABILITO TODAS LAS INTS
BCF PORTA,OK
CALL DEMORA ;LED INDICANDO FALLO DE ARRANQUE
BSF PORTA,OK
CALL DEMORA
GOTO FALL_STAR
;***************************************************************************************************************************
ON_REPOSO BSF PORTA,ON
BCF PORTA,STAR
BCF PORTA,GUN
GOTO LOOP
;***************************************************************************************************************************
;***************************************************************************************************************************
;******************************RUTINA DE DEMORA DE 200mSEG************************************
DEMORA movlw .156 ; 1 set numero de repeticion (B)
movwf PDel0 ; 1 |
PLoop1 movlw .213 ; 1 set numero de repeticion (A)
movwf PDel1 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
PDelL1 goto PDelL2 ; 2 ciclos delay
PDelL2
decfsz PDel1, 1 ; 1 + (1) es el tiempo 0 ? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) es el tiempo 0 ? (B)
goto PLoop1 ; 2 no, loop
PDelL3 goto PDelL4 ; 2 ciclos delay
PDelL4 clrwdt ; 1 ciclo delay
return ; 2+2 Fin.
;***********************************************************************************************
END ; directive 'end of program'