Ivan-Holm
Member level 5
![Member level 5](/styles/images/ranks/dlevel5.gif)
Code:
#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
int Toggle_count;
int main()
{
TRISD =0x00000000;
PORTDbits.RD0 = 1;
while(1)
{
};
};
void __ISR(INT_EXTERNAL_0_VECTOR, 3) CoreTimerHandler(void)
{
// .. 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_TICK_RATE);
// clear the interrupt flag
mCTClearIntFlag();
}
---------- Post added at 11:30 ---------- Previous post was at 11:27 ----------
I got this error:
maintimer.c:27: error: Vector number must be an integer between 0 and 63
maintimer.c:27: error: Interrupt priority must be specified as RIPL, SINGLE, IPLnAUTO, IPLnSOFT, or IPLnSRS, where n is in the range of 0..7, inclusive.
maintimer.c: In function `CoreTimerHandler':
maintimer.c:40: error: `CORE_TICK_RATE' undeclared (first use in this function)
maintimer.c:40: error: (Each undeclared identifier is reported only once
maintimer.c:40: error: for each function it appears in.)
maintimer.c:44:2: warning: no newline at end of file
I have try to write the config funktion they have in the Plib macro