garg29
Advanced Member level 1
Hi friends,
In the following code I have not Enabled the external Interrupt still the processor is accepting it I cant understand why, please have a look:-
Actually I want to initailly make
then when the "CountPulse" becomes greater than 1000 I want the processor to stop accepting the External INT0 Interrupt by making
, but cant do it can anyone please help me out, I'm using PIC18F4550 & C18 compiler
Please help me out....
In the following code I have not Enabled the external Interrupt still the processor is accepting it I cant understand why, please have a look:-
Code:
/** I N C L U D E S **********************************************************/
#include <p18cxxx.h>
#include<stdlib.h>
#include "delay.h"
.
.
.
.
.
.
.
.
.
.
.
extern void _startup (void); // See c018i.c in your C18 compiler dir
//----------------------------------------------------------------------------
// High priority interrupt vector
#pragma code InterruptVectorHigh = 0x0800
void
InterruptVectorHigh (void)
{
_asm
goto InterruptHandlerHigh //jump to interrupt routine
_endasm
}
//----------------------------------------------------------------------------
// High priority interrupt routine
//----------------------------------------------------------------------------
// High priority interrupt routine
#pragma code
#pragma interrupt InterruptHandlerHigh
void
InterruptHandlerHigh ()
{
if (INTCONbits.INT0IF)
{
CountPulse++;
//INTCONbits.PEIE=1;
//INTCONbits.INT0IE=1;
INTCONbits.INT0IF = 0; //clear interrupt flag
}
if (INTCONbits.TMR0IF) //check for TMR0 overflow
{
//INTCONbits.PEIE=0;
TMR0H=0xD6;
TMR0L=0x0C;
Display7Segment();
INTCONbits.TMR0IF=0;
//INTCONbits.PEIE=1;
}
}
///////////////////////////////////////////////////////////////
.
.
.
.
.
.
.
.
.
.
/** D E C L A R A T I O N S **************************************************/
#pragma code
void main(void)
{
unsigned int i;
RCONbits.IPEN=1;
CMCON |= 0x07;
ADCON1 |= 0x0F;
CVRCON = 0;
INTCON2=0x04;
OSCCONbits.IOFS = 1;
INTCONbits.INT0IE=0;
INTCONbits.RBIE =0;
INTCONbits.RBIF =0;
T0CON=0x08;
TMR0H=0x3C;
TMR0L=0xB0;
INTCONbits.TMR0IF=0;
INTCONbits.TMR0IE=1;
T0CONbits.TMR0ON=1;
INTCONbits.PEIE=0;
INTCONbits.GIE=1;
TRISA=0x00;
PORTA=0x00;
LATA=0x00;
TRISB=0x01;
PORTB=0x01;
LATB=0x01;
TRISC=0x00;
PORTC=0x00;
LATC=0x00;
TRISD=0x00;
PORTD=0x00;
LATD = 0x00;
TRISE=0x00;
PORTE=0x00;
LATE = 0x00;
CountPulse=0;
while(1)
{
DataForDisplay(CountPulse);
DelayMs(100);
}//end while
}//end main
Actually I want to initailly make
Code:
INTCONbits.INT0IE=1;
then when the "CountPulse" becomes greater than 1000 I want the processor to stop accepting the External INT0 Interrupt by making
Code:
if(CountPulse>1000)
INTCONbits.INT0IE=0;//stop the External INT0 Interrupt
Please help me out....