Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how disable a Interrup
31-01-2013, 12:12 AM,
#1
how disable a Interrup
i have this code:

Code:
boolean state = TRUE;
int i;
void blinkRun(){
    toggle(0);
}

void setup(){
    pinMode(0,OUTPUT);
    OnTimer0(blinkRun, INT_MILLISEC, 500);
}

void loop(){
    for (i = 1 ;i< 10;i++){
        delay(1000);
    }
    //In this line i need detach the Interrupt... pls how i coud do this..
    while(1){

    }
}

Pls some could help me to detach the Interrupt
Reply
31-01-2013, 08:05 AM,
#2
RE: how disable a Interrup
Hi

If you want disable all the interrupt source you can try this code

Code:
INTCONbits.GIE = 0; // disable interrupts

YOUR CODE

INTCONbits.GIE = 1; // enable interrupts back

You found this in \p8\include\pinguino\core\system.c
Attention, this code is very dangerous


Bye Bye, Moreno
Reply
31-01-2013, 09:41 PM,
#3
RE: how disable a Interrup
Thanks moreno por this help, but with your help i change you suggestion for this..

INTCONbits.TMR0IE = 0;

Whit this only disable timer0 interrupt
Reply
01-02-2013, 09:41 PM,
#4
RE: how disable a Interrup
*** P8 Only ****


Int.detach(INT_TMR0); so you don't have to learn all SFR's
It does just what you did : INTCONbits.TMR0IE = 0;
In the next update on svn you will be able able to use also :
Int.enable((INT_TMR0) and Int.disable(INT_TMR0) just to be compatible with P32's syntax.

I know this is not yet documented so here are all the interrupt codes you can use (a few of them only in the next update) :

INT_TMR0
INT_TMR1
INT_TMR2
INT_TMR3
INT_TMR4

INT_INTEDG0
INT_INTEDG1
INT_INTEDG2
INT_INTEDG3

INT_INT0
INT_INT1
INT_INT2
INT_INT3

INT_RB

INT_CCP1
INT_CCP2

INT_CM
INT_CM1
INT_CM2

INT_RC
INT_TX
INT_RC1
INT_TX1
INT_RC2
INT_TX2

INT_AD
INT_OSCF
INT_EE
INT_HLVD

INT_BCL
INT_BCL1
INT_BCL2

INT_USB

INT_SSP
INT_SSP1
INT_SSP2

INT_CTMU
INT_RTCC
INT_NUM
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)