abdulanr1
Newbie level 3
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 #define USE_OR_MASKS #include <p18f45k20.h> #pragma config FOSC = INTIO7, FCMEN = OFF, IESO = OFF // CONFIG1H #pragma config PWRT = OFF, BOREN = SBORDIS, BORV = 30 // CONFIG2L #pragma config WDTEN = OFF, WDTPS = 32768 // CONFIG2H #pragma config LPT1OSC = ON, PBADEN = OFF, CCP2MX = PORTC // CONFIG3H #pragma config STVREN = ON, LVP = OFF, XINST = OFF // CONFIG4L #pragma config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF // CONFIG5L #pragma config CPB = OFF, CPD = OFF // CONFIG5H #pragma config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF // CONFIG6L #pragma config WRTB = OFF, WRTC = OFF, WRTD = OFF // CONFIG6H #pragma config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF // CONFIG7L #pragma config EBTRB = OFF #pragma code InterruptVectorHigh = 0x08 unsigned int data; void main(void) { ANSEL = 0x00; ANSELH = 0x00; TRISD = 0b00000000; PORTD=0x00; OSCCONbits.IRCF0 = 0; OSCCONbits.IRCF1 = 1; OSCCONbits.IRCF2 = 1; INTCONbits.INT0IF = 0; INTCONbits.INT0IE = 1; // Enable External interrupt //INTCONbits.RBIE = 1; RCONbits.IPEN=1; INTCON2=0b10000000; INTCON2bits.RBPU = 0; INTCON2bits.INTEDG0 = 0; //falling edge INTCONbits.GIE=1; // Enable The Global Interrupt INTCONbits.PEIE = 1; TRISB = 0b00000001; PORTB=0x00; } void InterruptVectorHigh(){ PORTD=0xFF; INTCONbits.INT0IF = 0; }
external interrupt not working with above code can any one solve
Last edited by a moderator: