login

Author Topic: correctly import arduino lib (using timer2)  (Read 1345 times)

0 Members and 1 Guest are viewing this topic.

Raffy87

correctly import arduino lib (using timer2)
« on: August 28, 2014, 02:03:43 PM »
I am trying to get de frequentie counter working in Wiring

http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/

But i get the error

core.a(WHardwareTimer.cpp.o): In function `__vector_9':
C:\Program Files (x86)\Wiring\cores\AVR8Bit/WHardwareTimer.cpp:103: multiple definition of `__vector_9'
FreqCounter\FreqCounter.cpp.o:C:\Program Files (x86)\Wiring\libraries\FreqCounter/FreqCounter.cpp:104: first defined here

when I compile the sketch.

Can someone help me to confert the libraries correctly. Or help me get a simalur lib that works directly with Wiring.

kind regards Raphael Baars

barragan

Re: correctly import arduino lib (using timer2)
« Reply #1 on: August 31, 2014, 10:27:32 PM »
hi, the problem is the library is re defining how to attend the `__vector_9' interruption, Which is already defined on lines 97/103 on https://github.com/WiringProject/Wiring/blob/master/framework/cores/AVR8Bit/WHardwareTimer.cpp

The right way should be Timer2.attachInterrupt() and rename the ISR(TIMER2_COMPA_vect)  on the FreqCounter.cpp:104 to a function you want to be called anytime TIMER2_COMPA_vect is generated.

See how the initialization of other timers on the Arduino definite are handled on init: https://github.com/WiringProject/Wiring/blob/master/framework/hardware/Arduino/DuemilanoveUno/BoardDefs.cpp

Let me know.