Hi,
I'm new to MCU programmation and especially to Arduino. I have a Teensy 3.0 board and i would like to use a timer in order to read a sensor every t ms. I already searched thread about my problem over this forum but i didn't find the solution. I past you the code :
When i compile, I got this error :
IntervalTimer.cpp.o: In function `IntervalTimer::disable_PIT()':
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/IntervalTimer.cpp:40: multiple definition of `pit1_isr'
sketch_dec10b.cpp.o:C:\Program Files (x86)\Arduino/sketch_dec10b.ino:5: first defined here
collect2.exe: error: ld returned 1 exit status
If someone could help me, I would be grateful.
Thank you,
Infras
I'm new to MCU programmation and especially to Arduino. I have a Teensy 3.0 board and i would like to use a timer in order to read a sensor every t ms. I already searched thread about my problem over this forum but i didn't find the solution. I past you the code :
Code:
#include <avr/io.h>
#include <avr/interrupt.h>
void pit1_isr(void)
{
Serial.println("Interrupt");
PIT_TFLG1 = 1;
}
void setup()
{
}
void pit_init()
{
SIM_SCGC6 |= SIM_SCGC6_PIT; // Activates the clock for PIT
PIT_MCR = 0x00; // Permet l'enable du PIT (Periodic Interrupt Timer)
NVIC_ENABLE_IRQ(IRQ_PIT_CH1); // Another step to enable PIT channel 1 interrupts (sur l'ARM)
PIT_LDVAL1 = 0x2fa080; // Choisi la durée du timer 0 (voir p823 et 825 (36.4.1.1) de la datasheet pour changer la valeur)
// ici on a 1s
PIT_TFLG1 |= 0x01; // On clean le flag du timer 0
PIT_TCTRL1 |= 0x02; // Autorisation des interrupts sur le timer 0
}
void loop()
{
}
When i compile, I got this error :
IntervalTimer.cpp.o: In function `IntervalTimer::disable_PIT()':
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/IntervalTimer.cpp:40: multiple definition of `pit1_isr'
sketch_dec10b.cpp.o:C:\Program Files (x86)\Arduino/sketch_dec10b.ino:5: first defined here
collect2.exe: error: ld returned 1 exit status
If someone could help me, I would be grateful.
Thank you,
Infras