PORTB interrupt on change

Discussion in 'Programmer's Corner' started by olvine, Apr 17, 2014.

Thread Status:
Not open for further replies.
  1. olvine

    Thread Starter Member

    Mar 10, 2014
    99
    0
    why it is not working ??

    Please Help!!

    //// PIC16F887
    //// MikroC



    void interrupt()
    {
    INTCON.PEIE=0;
    INTCON.GIE=0;

    if(INTCON.RBIF==1){
    PORTA.RA5=~PORTA.RA5;
    INTCON.RBIF=0;
    }

    INTCON.PEIE=1;
    }


    void main(){

    PORTB=0;
    TRISB.RB5=1;
    TRISA.RA5=0;
    PORTA.RA5=0;

    IOCB=1;
    WPUB=1;

    INTCON.RBIF=0;
    INTCON.PEIE=1;
    INTCON.GIE=1;
    INTCON.RBIE=1;



    while(1){
    }
    }
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    One thread is enough.
     
Loading...
Thread Status:
Not open for further replies.