Remove Text Formatting
Loading...

Interrupt in pic16f886

  1. vatsal
    vatsal
    Hii.. I am newbie to pic16f886...I am trying to toggle leds through external interrupt.. I have enable the GIE, INTF and configured as a edge interrupt...still i am not able to call ISR.Here is my code...



    .void interrupt ISR1(void)
    {
    INTF = 0; // clear the interrupt
    //if(INTF == 1) //If External Edge INT Interrupt
    //{
    UART_Transmit_String("IT is interrupt");
    RC0 = ~RC0; // Toggle RD0 pin
    delay_ms ( 1000 );

    //}
    }


    void main()
    {
    //OSCCON=0x60;
    //TRISC=0XC0; // PORTC data direction register
    init_uart();
    //mem_wr_rd();
    TRISB=0x01;
    TRISC0 = 0; // Make output
    //RC0 = 0;
    //delay_ms ( 1000 );
    //INTF=0;
    InitExternal_INT();
    while(1)
    {
    }
    }
    void InitExternal_INT(void)
    {
    OPTION_REG |= 0x40;
    //TRISB0 = 1; // Make RB0 pin as input
    // IOCB0=1;

    INTCON |= 0x90;
    GIE =1;
    INTE=1;
    PEIE |= 0;// Enable Global + INT interrupt
    // Make INT as posedge triggered
    }
  2. vatsal
    vatsal
    hiii..all...how do i use comparator in pic16f886??
Results 1 to 2 of 2