MICROCHIP PIC MIDRANGE PIC18XX External Interrupt INT1

Configuring the external Interrupt INT1 in PIC18F25k80 is tricky way. The data sheet also may confuse you well.

Screenshot from 2015-06-24 22:53:21

From the pinout pin 22 or RB1 has multiple functions (RB1/AN8/C1INB/P1B/CTDIN/INT1)

These are the things to be noticed while configuring RB1 as external interrupt

Screenshot from 2015-06-24 23:42:47

The RB1 acts also as analog pin to be exact AN8.From the summary of registers associated with PortB we may misunderstand that ANSEL9 is the pin associated with RB1 but that’s wrong. If you look at ANCON1 resister

Screenshot from 2015-06-24 23:48:45

Screenshot from 2015-06-24 23:49:00

This is the most tricky part in configuring external interrupt.The other configurations are pretty straight forward in INTCONbits.

    TRISBbits.TRISB1 = 1;  
    ANCON1bits.ANSEL8 = 0;
    INTCONbits.GIE = 1;
    INTCONbits.PEIE = 1;
    INTCON3bits.INT1IE = 1;
    INTCON2bits.INTEDG1 = 1;
    INTCON3bits.INT1IP = 1;
    INTCON2bits.RBPU = 0;

The above snippet configures INT1 as external interrupt which responds to a rising edge.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s