chipKIT® Development Platform

Inspired by Arduino™

Timer Interups

Created Mon, 12 Mar 2012 23:24:12 +0000 by andreibadilacg


andreibadilacg

Mon, 12 Mar 2012 23:24:12 +0000

HY, I use timer interups, and i have error sintax. Please help. Thanks /* Cerebot Mx7ck: Header J8 / / / / / /***********************************************************************/ #include <WInterrupts.c> #include <RTCCI2C.h> #include <Wire.h>

RTCCI2C myRTCC; int year, mon, date, day, hour, minute, sec, ampm = 0;

int sant;

void setOutput() { uint8_t temp;

Wire.beginTransmission(0x6F); Wire.send(0x07);
Wire.endTransmission();

Wire.requestFrom(0x6F, 1);

while(Wire.available())

temp=(temp|0x41); temp=(temp&0xF9); Wire.beginTransmission(0x6F); Wire.send(0x07);
Wire.send(temp);
Wire.endTransmission();

} void __ISR(TIMER2_OVF_vectipl3)Timer1Handler(void) {

IFS0CLR = 0x00000100; // Be sure to clear the Timer 2 interrupt status PR2=0x0; digitalWrite(53,HIGH);

}; void setup() { Serial.begin(9600); myRTCC.begin();

//set the real time clock myRTCC.stopClock(); myRTCC.setSec(RTCC_RTCC, 0x25); myRTCC.setMin(RTCC_RTCC, 0x35); myRTCC.setHour(RTCC_RTCC, 0x12, RTCC_PM); myRTCC.setDay(RTCC_RTCC, 0x02); myRTCC.setDate(RTCC_RTCC, 0x15); myRTCC.setMonth(RTCC_RTCC, 0x11); myRTCC.setYear(0x11); setOutput(); myRTCC.startClock();
///timer T2CON = 0x0; // Opresc timer2 T3CON = 0x0; // Opresc Timer3 operation T2CONSET = 0x000A; // 32-bit mod, clock extern, 1:1 prescalarea TMR2 = 0xFFFF0001;// Resetez la 0 PR2 = 0xFFFFFFFF; // Setez sa numere pana la FFFFFFF IPC3SET = 0x00000004; // Set priority level = 1 IPC3SET = 0x00000001; // Set sub-priority level = 1

IFS0CLR = 0x00001000; 

IEC0SET = 0x00001000;

T2CONSET = 0x8000; // Pornesc timer pinMode(49,INPUT); pinMode(53,OUTPUT); digitalWrite(53,LOW); }

void loop() {

Serial.println(TMR2); if ((TMR2>0x0)&&(PR2!=0x0)&&(TMR2<0xFFFF0001)) { PR2=0x0; digitalWrite(53,HIGH);

}; if (digitalRead(49)==HIGH) { T2CON = 0x0; // Opresc timer2 T3CON = 0x0; // Opresc Timer3 operation T2CONSET = 0x000A; // 32-bit mod, clock extern, 1:1 prescalarea TMR2 = 0xFFFF0001;// Resetez la 0 PR2 = 0xFFFFFFFF; // Setez sa numere pana la FFFFFFF IPC3SET = 0x00000004; // Set priority level = 1 IPC3SET = 0x00000001; // Set sub-priority level = 1

  IFS0CLR = 0x00001000; 
IEC0SET = 0x00001000;

};

}

timer.cpp:52:50: error: Vector number must be an integer between 0 and 63

Some ideea?? Thanks


Ryan K

Tue, 20 Mar 2012 22:21:34 +0000

Hello,

You probably want:

void __ISR(TIMER_2_VECTOR, ipl7) Timer2Handler(void)
{
}

Best Regards, Ryan K