Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
// interrupt macros for attaching user functions to timer interrupts// use these with timerAttach( intNum, function )#define TIMER0OVERFLOW_INT 0#define TIMER1OVERFLOW_INT 1#define TIMER1OUTCOMPAREA_INT 2#define TIMER1OUTCOMPAREB_INT 3#define TIMER1INPUTCAPTURE_INT 4#define TIMER2OVERFLOW_INT 5#define TIMER2OUTCOMPARE_INT 6#ifdef OCR0 // for processors that support output compare on Timer0#define TIMER0OUTCOMPARE_INT 7#define TIMER_NUM_INTERRUPTS 8#else#define TIMER_NUM_INTERRUPTS 7#endif//SoR Added#define TIMER3OVERFLOW_INT 9#define TIMER4OVERFLOW_INT 10#define TIMER5OVERFLOW_INT 11#define TIMER0OUTCOMPAREA_INT 12#define TIMER0OUTCOMPAREB_INT 13#define TIMER0INPUTCAPTURE_INT 14#define TIMER2OUTCOMPAREA_INT 15#define TIMER2OUTCOMPAREB_INT 16#define TIMER2INPUTCAPTURE_INT 17
#ifdef TCNT2 // support timer2 only if it exists//! Interrupt handler for tcnt2 overflow interruptTIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2){ Timer2Reg0++; // increment low-order counter // if a user function is defined, execute it if(TimerIntFunc[TIMER2OVERFLOW_INT]) TimerIntFunc[TIMER2OVERFLOW_INT]();}#endif#ifdef TCNT3 // support timer3 only if it exists//! Interrupt handler for tcnt3 overflow interruptTIMER_INTERRUPT_HANDLER(SIG_OVERFLOW3){ Timer3Reg0++; // increment low-order counter // if a user function is defined, execute it if(TimerIntFunc[TIMER3OVERFLOW_INT]) TimerIntFunc[TIMER3OVERFLOW_INT]();}#endif#ifdef TCNT4 // support timer4 only if it exists//! Interrupt handler for tcnt4 overflow interruptTIMER_INTERRUPT_HANDLER(SIG_OVERFLOW4){ Timer4Reg0++; // increment low-order counter // if a user function is defined, execute it if(TimerIntFunc[TIMER4OVERFLOW_INT]) TimerIntFunc[TIMER4OVERFLOW_INT]();}#endif
Axon Source Code v1.04 (February 23rd, 2009 - timer3,4 broken)
I didn't realize the timezone in Thailand was 1 month ahead of the US. QuoteAxon Source Code v1.04 (February 23rd, 2009 - timer3,4 broken)
If an unexpected interrupt occurs (interrupt is enabled and no handler is installed, which usually indicates a bug), then the default action is to reset the device by jumping to the reset vector. You can override this by supplying a function named BADISR_vect which should be defined with ISR() as such.
Admin: Do you know what PD0 pin on the Axon is being used for?
BTW, timer640 is really out of date and does not use all the power of the ATmega640 timers. I'm planning on rewriting all of the AVRlib code to be up-to-date with the latest gcc. AVRlib uses a lot of deprecated methods.
I uploaded it all as v1.05, and removed the other broken versions. Hopefully no other problems pop up!
(and a huge thanks to you, I was losing hair over this!)
Let me know what changes you make! AVRfreaks.net people complain about how outdated AVRlib is, but no one has rewritten anything . . . I had to rewrite a decent amount just to get it to work with the 640.
My major focus for Axon code development is to make it compatible with external hardware (ie souce code), and making complicated AVR features easy to use (ie PWM, interrupts, UART, etc). I'm not a professional programmer so my code will hardly be clean or efficient.