Ivan-Holm
Member level 5
Hi we have some problem that this code
the error is in both void ConfigInt0 sentence when we have out-comment one at a time. we dont know if it is the right to do?. when we out-comment bouth sentence It's compile fine. but not when we want to enable external Interrupt.
whot is the right way or place to this void ConfigInt0 line
Code:
[syntax=c]#include<p32xxxx.h>
#include<stdio.h>
#include <plib.h>
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_2
#define SYS_FREQ (80000000L)
#define CORE_TIMER_PERIOD SYS_FREQ
//void ConfigInt0(EXT_INT_ENABLE |FALLING_EDGE_INT |EXT_INT_PRI_5 );
int Toggle_count;
int main()
{
void ConfigInt0(EXT_INT_ENABLE |FALLING_EDGE_INT | EXT_INT_PRI_5 );
TRISD =0x00000000;
PORTDbits.RD0 = 1;
while(1)
{
};
};
void __ISR(3, IPL5) CoreTimerHandler(void) //INT_EXTERNAL_0_VECTOR
{
// .. things to do
if (Toggle_count == 1) mPORTDToggleBits(BIT_0);
if (Toggle_count == 2) mPORTDToggleBits(BIT_1);
if (Toggle_count == 3) mPORTDToggleBits(BIT_2);
Toggle_count ++;
if (Toggle_count == 4) Toggle_count = 1;
// .. Toggle the LED
mPORTDToggleBits(BIT_0);
// update the period
UpdateCoreTimer(CORE_TIMER_PERIOD);
// clear the interrupt flag
mINT0ClearIntFlag();
while(1);
}[/syntax]
whot is the right way or place to this void ConfigInt0 line