Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

timer128.c

Go to the documentation of this file.
00001 /*! \file timer128.c \brief System Timer function library for Mega128. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'timer128.c'
00005 // Title        : System Timer function library for Mega128
00006 // Author       : Pascal Stang - Copyright (C) 2000-2003
00007 // Created      : 11/22/2000
00008 // Revised      : 02/24/2003
00009 // Version      : 1.2
00010 // Target MCU   : Atmel AVR Series
00011 // Editor Tabs  : 4
00012 //
00013 // This code is distributed under the GNU Public License
00014 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00015 //
00016 //*****************************************************************************
00017 
00018 #ifndef WIN32
00019     #include <avr/io.h>
00020     #include <avr/signal.h>
00021     #include <avr/interrupt.h>
00022     #include <avr/pgmspace.h>
00023     #include <avr/sleep.h>
00024 #endif
00025 
00026 #include "global.h"
00027 #include "timer128.h"
00028 
00029 // Program ROM constants
00030 // the prescale division values stored in order of timer control register index
00031 // STOP, CLK, CLK/8, CLK/64, CLK/256, CLK/1024
00032 unsigned short __attribute__ ((progmem)) TimerPrescaleFactor[] = {0,1,8,64,256,1024};
00033 // the prescale division values stored in order of timer control register index
00034 // STOP, CLK, CLK/8, CLK/32, CLK/64, CLK/128, CLK/256, CLK/1024
00035 unsigned short __attribute__ ((progmem)) TimerRTCPrescaleFactor[] = {0,1,8,32,64,128,256,1024};
00036 
00037 // Global variables
00038 // time registers
00039 volatile unsigned long TimerPauseReg;
00040 volatile unsigned long Timer0Reg0;
00041 volatile unsigned long Timer0Reg1;
00042 volatile unsigned long Timer2Reg0;
00043 volatile unsigned long Timer2Reg1;
00044 
00045 typedef void (*voidFuncPtr)(void);
00046 volatile static voidFuncPtr TimerIntFunc[TIMER_NUM_INTERRUPTS];
00047 
00048 // delay for a minimum of <us> microseconds 
00049 // the time resolution is dependent on the time the loop takes 
00050 // e.g. with 4Mhz and 5 cycles per loop, the resolution is 1.25 us 
00051 void delay_us(unsigned short time_us) 
00052 {
00053     unsigned short delay_loops;
00054     register unsigned short i;
00055 
00056     delay_loops = (time_us+3)/5*CYCLES_PER_US; // +3 for rounding up (dirty) 
00057 
00058     // one loop takes 5 cpu cycles 
00059     for (i=0; i < delay_loops; i++) {};
00060 }
00061 /*
00062 void delay_ms(unsigned char time_ms)
00063 {
00064     unsigned short delay_count = F_CPU / 4000;
00065 
00066     unsigned short cnt;
00067     asm volatile ("\n"
00068                   "L_dl1%=:\n\t"
00069                   "mov %A0, %A2\n\t"
00070                   "mov %B0, %B2\n"
00071                   "L_dl2%=:\n\t"
00072                   "sbiw %A0, 1\n\t"
00073                   "brne L_dl2%=\n\t"
00074                   "dec %1\n\t" "brne L_dl1%=\n\t":"=&w" (cnt)
00075                   :"r"(time_ms), "r"((unsigned short) (delay_count))
00076     );
00077 }
00078 */
00079 void timerInit(void)
00080 {
00081     u08 intNum;
00082     // detach all user functions from interrupts
00083     for(intNum=0; intNum<TIMER_NUM_INTERRUPTS; intNum++)
00084         timerDetach(intNum);
00085 
00086     // initialize all timers
00087     timer0Init();
00088     timer1Init();
00089     timer2Init();
00090     timer3Init();
00091     // enable interrupts
00092     sei();
00093 }
00094 
00095 void timer0Init()
00096 {
00097     // initialize timer 0
00098     timer0SetPrescaler( TIMER0PRESCALE );   // set prescaler
00099     outb(TCNT0, 0);                         // reset TCNT0
00100     sbi(TIMSK, TOIE0);                      // enable TCNT0 overflow interrupt
00101 
00102     timer0ClearOverflowCount();             // initialize time registers
00103 }
00104 
00105 void timer1Init(void)
00106 {
00107     // initialize timer 1
00108     timer1SetPrescaler( TIMER1PRESCALE );   // set prescaler
00109     outb(TCNT1H, 0);                        // reset TCNT1
00110     outb(TCNT1L, 0);
00111     sbi(TIMSK, TOIE1);                      // enable TCNT1 overflow
00112 }
00113 
00114 void timer2Init(void)
00115 {
00116     // initialize timer 2
00117     timer2SetPrescaler( TIMER2PRESCALE );   // set prescaler
00118     outb(TCNT2, 0);                         // reset TCNT2
00119     sbi(TIMSK, TOIE2);                      // enable TCNT2 overflow
00120 
00121     timer2ClearOverflowCount();             // initialize time registers
00122 }
00123 
00124 void timer3Init(void)
00125 {
00126     // initialize timer 3
00127     timer3SetPrescaler( TIMER3PRESCALE );   // set prescaler
00128     outb(TCNT3H, 0);                        // reset TCNT3
00129     outb(TCNT3L, 0);
00130     sbi(ETIMSK, TOIE3);                     // enable TCNT3 overflow
00131 }
00132 
00133 void timer0SetPrescaler(u08 prescale)
00134 {
00135     // set prescaler on timer 0
00136     outb(TCCR0, (inb(TCCR0) & ~TIMER_PRESCALE_MASK) | prescale);
00137 }
00138 
00139 void timer1SetPrescaler(u08 prescale)
00140 {
00141     // set prescaler on timer 1
00142     outb(TCCR1B, (inb(TCCR1B) & ~TIMER_PRESCALE_MASK) | prescale);
00143 }
00144 
00145 void timer2SetPrescaler(u08 prescale)
00146 {
00147     // set prescaler on timer 2
00148     outb(TCCR2, (inb(TCCR2) & ~TIMER_PRESCALE_MASK) | prescale);
00149 }
00150 
00151 void timer3SetPrescaler(u08 prescale)
00152 {
00153     // set prescaler on timer 2
00154     outb(TCCR3B, (inb(TCCR3B) & ~TIMER_PRESCALE_MASK) | prescale);
00155 }
00156 
00157 u16 timer0GetPrescaler(void)
00158 {
00159     // get the current prescaler setting
00160     return (pgm_read_word(TimerPrescaleFactor+(inb(TCCR0) & TIMER_PRESCALE_MASK)));
00161 }
00162 
00163 u16 timer1GetPrescaler(void)
00164 {
00165     // get the current prescaler setting
00166     return (pgm_read_word(TimerPrescaleFactor+(inb(TCCR1B) & TIMER_PRESCALE_MASK)));
00167 }
00168 
00169 u16 timer2GetPrescaler(void)
00170 {
00171     // get the current prescaler setting
00172     return (pgm_read_word(TimerPrescaleFactor+(inb(TCCR2) & TIMER_PRESCALE_MASK)));
00173 }
00174 
00175 u16 timer3GetPrescaler(void)
00176 {
00177     // get the current prescaler setting
00178     return (pgm_read_word(TimerPrescaleFactor+(inb(TCCR3B) & TIMER_PRESCALE_MASK)));
00179 }
00180 
00181 void timerAttach(u08 interruptNum, void (*userFunc)(void) )
00182 {
00183     // make sure the interrupt number is within bounds
00184     if(interruptNum < TIMER_NUM_INTERRUPTS)
00185     {
00186         // set the interrupt function to run
00187         // the supplied user's function
00188         TimerIntFunc[interruptNum] = userFunc;
00189     }
00190 }
00191 
00192 void timerDetach(u08 interruptNum)
00193 {
00194     // make sure the interrupt number is within bounds
00195     if(interruptNum < TIMER_NUM_INTERRUPTS)
00196     {
00197         // set the interrupt function to run nothing
00198         TimerIntFunc[interruptNum] = 0;
00199     }
00200 }
00201 
00202 void timerPause(unsigned short pause_ms)
00203 {
00204     // pauses for exactly <pause_ms> number of milliseconds
00205     u08 timerThres;
00206     u32 ticRateHz;
00207     u32 pause;
00208 
00209     // capture current pause timer value
00210     timerThres = inb(TCNT2);
00211     // reset pause timer overflow count
00212     TimerPauseReg = 0;
00213     // calculate delay for [pause_ms] milliseconds
00214     // prescaler division = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR2)))
00215     ticRateHz = F_CPU/timer2GetPrescaler();
00216     // precision management
00217     // prevent overflow and precision underflow
00218     //  -could add more conditions to improve accuracy
00219     if( ((ticRateHz < 429497) && (pause_ms <= 10000)) )
00220         pause = (pause_ms*ticRateHz)/1000;
00221     else
00222         pause = pause_ms*(ticRateHz/1000);
00223     
00224     // loop until time expires
00225     while( ((TimerPauseReg<<8) | inb(TCNT2)) < (pause+timerThres) )
00226     {
00227         if( TimerPauseReg < (pause>>8));
00228         {
00229             // save power by idling the processor
00230             set_sleep_mode(SLEEP_MODE_IDLE);
00231             sleep_mode();
00232         }
00233     }
00234 }
00235 
00236 void timer0ClearOverflowCount(void)
00237 {
00238     // clear the timer overflow counter registers
00239     Timer0Reg0 = 0; // initialize time registers
00240     Timer0Reg1 = 0; // initialize time registers
00241 }
00242 
00243 long timer0GetOverflowCount(void)
00244 {
00245     // return the current timer overflow count
00246     // (this is since the last timer0ClearOverflowCount() command was called)
00247     return Timer0Reg0;
00248 }
00249 
00250 void timer2ClearOverflowCount(void)
00251 {
00252     // clear the timer overflow counter registers
00253     Timer2Reg0 = 0; // initialize time registers
00254     Timer2Reg1 = 0; // initialize time registers
00255 }
00256 
00257 long timer2GetOverflowCount(void)
00258 {
00259     // return the current timer overflow count
00260     // (this is since the last timer2ClearOverflowCount() command was called)
00261     return Timer2Reg0;
00262 }
00263 
00264 
00265 void timer1PWMInit(u08 bitRes)
00266 {
00267     // configures timer1 for use with PWM output
00268     // on pins OC1A, OC1B, and OC1C
00269 
00270     // enable Timer1 as 8,9,10bit PWM
00271     if(bitRes == 9)
00272     {   // 9bit mode
00273         sbi(TCCR1A,WGMA1);
00274         cbi(TCCR1A,WGMA0);
00275     }
00276     else if( bitRes == 10 )
00277     {   // 10bit mode
00278         sbi(TCCR1A,WGMA1);
00279         sbi(TCCR1A,WGMA0);
00280     }
00281     else
00282     {   // default 8bit mode
00283         cbi(TCCR1A,WGMA1);
00284         sbi(TCCR1A,WGMA0);
00285     }
00286 
00287     // set clear-timer-on-compare-match
00288     //cbi(TCCR1B,CTC1);
00289     // clear output compare value A
00290     outb(OCR1AH, 0);
00291     outb(OCR1AL, 0);
00292     // clear output compare value B
00293     outb(OCR1BH, 0);
00294     outb(OCR1BL, 0);
00295     // clear output compare value C
00296     outb(OCR1CH, 0);
00297     outb(OCR1CL, 0);
00298 }
00299 
00300 void timer1PWMInitICR(u16 topcount)
00301 {
00302     // set PWM mode with ICR top-count
00303     cbi(TCCR1A,WGM10);
00304     sbi(TCCR1A,WGM11);
00305     sbi(TCCR1B,WGM12);
00306     sbi(TCCR1B,WGM13);
00307     
00308     // set top count value
00309     ICR1H = (u08)(topcount>>8);
00310     ICR1L = (u08)topcount;
00311     
00312     // clear output compare value A
00313     outb(OCR1AH, 0);
00314     outb(OCR1AL, 0);
00315     // clear output compare value B
00316     outb(OCR1BH, 0);
00317     outb(OCR1BL, 0);
00318     // clear output compare value C
00319     outb(OCR1CH, 0);
00320     outb(OCR1CL, 0);
00321 }
00322 
00323 void timer1PWMOff(void)
00324 {
00325     // turn off PWM on Timer1
00326     cbi(TCCR1A,WGMA1);
00327     cbi(TCCR1A,WGMA0);
00328     // clear (disable) clear-timer-on-compare-match
00329     //cbi(TCCR1B,CTC1);
00330     // set PWM1A/B/C (OutputCompare action) to none
00331     timer1PWMAOff();
00332     timer1PWMBOff();
00333     timer1PWMCOff();
00334 }
00335 
00336 void timer1PWMAOn(void)
00337 {
00338     // turn on channel A (OC1A) PWM output
00339     // set OC1A as non-inverted PWM
00340     sbi(TCCR1A,COMA1);
00341     cbi(TCCR1A,COMA0);
00342 }
00343 
00344 void timer1PWMBOn(void)
00345 {
00346     // turn on channel B (OC1B) PWM output
00347     // set OC1B as non-inverted PWM
00348     sbi(TCCR1A,COMB1);
00349     cbi(TCCR1A,COMB0);
00350 }
00351 
00352 void timer1PWMCOn(void)
00353 {
00354     // turn on channel C (OC1C) PWM output
00355     // set OC1C as non-inverted PWM
00356     sbi(TCCR1A,COMC1);
00357     cbi(TCCR1A,COMC0);
00358 }
00359 
00360 void timer1PWMAOff(void)
00361 {
00362     // turn off channel A (OC1A) PWM output
00363     // set OC1A (OutputCompare action) to none
00364     cbi(TCCR1A,COMA1);
00365     cbi(TCCR1A,COMA0);
00366 }
00367 
00368 void timer1PWMBOff(void)
00369 {
00370     // turn off channel B (OC1B) PWM output
00371     // set OC1B (OutputCompare action) to none
00372     cbi(TCCR1A,COMB1);
00373     cbi(TCCR1A,COMB0);
00374 }
00375 
00376 void timer1PWMCOff(void)
00377 {
00378     // turn off channel C (OC1C) PWM output
00379     // set OC1C (OutputCompare action) to none
00380     cbi(TCCR1A,COMC1);
00381     cbi(TCCR1A,COMC0);
00382 }
00383 
00384 void timer1PWMASet(u16 pwmDuty)
00385 {
00386     // set PWM (output compare) duty for channel A
00387     // this PWM output is generated on OC1A pin
00388     // NOTE:    pwmDuty should be in the range 0-255 for 8bit PWM
00389     //          pwmDuty should be in the range 0-511 for 9bit PWM
00390     //          pwmDuty should be in the range 0-1023 for 10bit PWM
00391     outb(OCR1AH, (pwmDuty>>8));     // set the high 8bits of OCR1A
00392     outb(OCR1AL, (pwmDuty&0x00FF)); // set the low 8bits of OCR1A
00393 }
00394 
00395 void timer1PWMBSet(u16 pwmDuty)
00396 {
00397     // set PWM (output compare) duty for channel B
00398     // this PWM output is generated on OC1B pin
00399     // NOTE:    pwmDuty should be in the range 0-255 for 8bit PWM
00400     //          pwmDuty should be in the range 0-511 for 9bit PWM
00401     //          pwmDuty should be in the range 0-1023 for 10bit PWM
00402     outb(OCR1BH, (pwmDuty>>8));     // set the high 8bits of OCR1B
00403     outb(OCR1BL, (pwmDuty&0x00FF)); // set the low 8bits of OCR1B
00404 }
00405 
00406 void timer1PWMCSet(u16 pwmDuty)
00407 {
00408     // set PWM (output compare) duty for channel C
00409     // this PWM output is generated on OC1C pin
00410     // NOTE:    pwmDuty should be in the range 0-255 for 8bit PWM
00411     //          pwmDuty should be in the range 0-511 for 9bit PWM
00412     //          pwmDuty should be in the range 0-1023 for 10bit PWM
00413     outb(OCR1CH, (pwmDuty>>8));     // set the high 8bits of OCR1C
00414     outb(OCR1CL, (pwmDuty&0x00FF)); // set the low 8bits of OCR1C
00415 }
00416 
00417 
00418 void timer3PWMInit(u08 bitRes)
00419 {
00420     // configures timer1 for use with PWM output
00421     // on pins OC3A, OC3B, and OC3C
00422 
00423     // enable Timer3 as 8,9,10bit PWM
00424     if(bitRes == 9)
00425     {   // 9bit mode
00426         sbi(TCCR3A,WGMA1);
00427         cbi(TCCR3A,WGMA0);
00428     }
00429     else if( bitRes == 10 )
00430     {   // 10bit mode
00431         sbi(TCCR3A,WGMA1);
00432         sbi(TCCR3A,WGMA0);
00433     }
00434     else
00435     {   // default 8bit mode
00436         cbi(TCCR3A,WGMA1);
00437         sbi(TCCR3A,WGMA0);
00438     }
00439 
00440     // set clear-timer-on-compare-match
00441     //cbi(TCCR3B,CTC1);
00442     // clear output compare value A
00443     outb(OCR3AH, 0);
00444     outb(OCR3AL, 0);
00445     // clear output compare value B
00446     outb(OCR3BH, 0);
00447     outb(OCR3BL, 0);
00448     // clear output compare value B
00449     outb(OCR3CH, 0);
00450     outb(OCR3CL, 0);
00451 }
00452 
00453 void timer3PWMInitICR(u16 topcount)
00454 {
00455     // set PWM mode with ICR top-count
00456     cbi(TCCR3A,WGM30);
00457     sbi(TCCR3A,WGM31);
00458     sbi(TCCR3B,WGM32);
00459     sbi(TCCR3B,WGM33);
00460     
00461     // set top count value
00462     ICR3H = (u08)(topcount>>8);
00463     ICR3L = (u08)topcount;
00464     
00465     // clear output compare value A
00466     outb(OCR3AH, 0);
00467     outb(OCR3AL, 0);
00468     // clear output compare value B
00469     outb(OCR3BH, 0);
00470     outb(OCR3BL, 0);
00471     // clear output compare value C
00472     outb(OCR3CH, 0);
00473     outb(OCR3CL, 0);
00474 }
00475 
00476 void timer3PWMOff(void)
00477 {
00478     // turn off PWM mode on Timer3
00479     cbi(TCCR3A,WGMA1);
00480     cbi(TCCR3A,WGMA0);
00481     // clear (disable) clear-timer-on-compare-match
00482     //cbi(TCCR3B,CTC1);
00483     // set OC3A/B/C (OutputCompare action) to none
00484     timer3PWMAOff();
00485     timer3PWMBOff();
00486     timer3PWMCOff();
00487 }
00488 
00489 void timer3PWMAOn(void)
00490 {
00491     // turn on channel A (OC3A) PWM output
00492     // set OC3A as non-inverted PWM
00493     sbi(TCCR3A,COMA1);
00494     cbi(TCCR3A,COMA0);
00495 }
00496 
00497 void timer3PWMBOn(void)
00498 {
00499     // turn on channel B (OC3B) PWM output
00500     // set OC3B as non-inverted PWM
00501     sbi(TCCR3A,COMB1);
00502     cbi(TCCR3A,COMB0);
00503 }
00504 
00505 void timer3PWMCOn(void)
00506 {
00507     // turn on channel C (OC3C) PWM output
00508     // set OC3C as non-inverted PWM
00509     sbi(TCCR3A,COMC1);
00510     cbi(TCCR3A,COMC0);
00511 }
00512 
00513 void timer3PWMAOff(void)
00514 {
00515     // turn off channel A (OC3A) PWM output
00516     // set OC3A (OutputCompare action) to none
00517     cbi(TCCR3A,COMA1);
00518     cbi(TCCR3A,COMA0);
00519 }
00520 
00521 void timer3PWMBOff(void)
00522 {
00523     // turn off channel B (OC3B) PWM output
00524     // set OC3B (OutputCompare action) to none
00525     cbi(TCCR3A,COMB1);
00526     cbi(TCCR3A,COMB0);
00527 }
00528 
00529 void timer3PWMCOff(void)
00530 {
00531     // turn off channel C (OC3C) PWM output
00532     // set OC3C (OutputCompare action) to none
00533     cbi(TCCR3A,COMC1);
00534     cbi(TCCR3A,COMC0);
00535 }
00536 
00537 void timer3PWMASet(u16 pwmDuty)
00538 {
00539     // set PWM (output compare) duty for channel A
00540     // this PWM output is generated on OC3A pin
00541     // NOTE:    pwmDuty should be in the range 0-255 for 8bit PWM
00542     //          pwmDuty should be in the range 0-511 for 9bit PWM
00543     //          pwmDuty should be in the range 0-1023 for 10bit PWM
00544     outb(OCR3AH, (pwmDuty>>8));     // set the high 8bits of OCR3A
00545     outb(OCR3AL, (pwmDuty&0x00FF)); // set the low 8bits of OCR3A
00546 }
00547 
00548 void timer3PWMBSet(u16 pwmDuty)
00549 {
00550     // set PWM (output compare) duty for channel B
00551     // this PWM output is generated on OC3B pin
00552     // NOTE:    pwmDuty should be in the range 0-255 for 8bit PWM
00553     //          pwmDuty should be in the range 0-511 for 9bit PWM
00554     //          pwmDuty should be in the range 0-1023 for 10bit PWM
00555     outb(OCR3BH, (pwmDuty>>8));     // set the high 8bits of OCR3B
00556     outb(OCR3BL, (pwmDuty&0x00FF)); // set the low 8bits of OCR3B
00557 }
00558 
00559 void timer3PWMCSet(u16 pwmDuty)
00560 {
00561     // set PWM (output compare) duty for channel B
00562     // this PWM output is generated on OC3C pin
00563     // NOTE:    pwmDuty should be in the range 0-255 for 8bit PWM
00564     //          pwmDuty should be in the range 0-511 for 9bit PWM
00565     //          pwmDuty should be in the range 0-1023 for 10bit PWM
00566     outb(OCR3CH, (pwmDuty>>8));     // set the high 8bits of OCR3C
00567     outb(OCR3CL, (pwmDuty&0x00FF)); // set the low 8bits of OCR3C
00568 }
00569 
00570 
00571 //! Interrupt handler for tcnt0 overflow interrupt
00572 TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
00573 {
00574     Timer0Reg0++;       // increment low-order counter
00575     if(!Timer0Reg0)     // if low-order counter rollover
00576         Timer0Reg1++;   // increment high-order counter 
00577 
00578     // if a user function is defined, execute it too
00579     if(TimerIntFunc[TIMER0OVERFLOW_INT])
00580         TimerIntFunc[TIMER0OVERFLOW_INT]();
00581 }
00582 
00583 //! Interrupt handler for Timer1 overflow interrupt
00584 TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW1)
00585 {
00586     // if a user function is defined, execute it
00587     if(TimerIntFunc[TIMER1OVERFLOW_INT])
00588         TimerIntFunc[TIMER1OVERFLOW_INT]();
00589 }
00590 
00591 //! Interrupt handler for Timer2 overflow interrupt
00592 TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2)
00593 {
00594     Timer2Reg0++;       // increment low-order counter
00595     if(!Timer2Reg0)     // if low-order counter rollover
00596         Timer2Reg1++;   // increment high-order counter 
00597 
00598     // increment pause counter
00599     TimerPauseReg++;
00600 
00601     // if a user function is defined, execute it
00602     if(TimerIntFunc[TIMER2OVERFLOW_INT])
00603         TimerIntFunc[TIMER2OVERFLOW_INT]();
00604 }
00605 
00606 //! Interrupt handler for Timer3 overflow interrupt
00607 TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW3)
00608 {
00609     // if a user function is defined, execute it
00610     if(TimerIntFunc[TIMER3OVERFLOW_INT])
00611         TimerIntFunc[TIMER3OVERFLOW_INT]();
00612 }
00613 
00614 //! Interrupt handler for OutputCompare0 match (OC0) interrupt
00615 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)
00616 {
00617     // if a user function is defined, execute it
00618     if(TimerIntFunc[TIMER0OUTCOMPARE_INT])
00619         TimerIntFunc[TIMER0OUTCOMPARE_INT]();
00620 }
00621 
00622 //! Interrupt handler for OutputCompare1A match (OC1A) interrupt
00623 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1A)
00624 {
00625     // if a user function is defined, execute it
00626     if(TimerIntFunc[TIMER1OUTCOMPAREA_INT])
00627         TimerIntFunc[TIMER1OUTCOMPAREA_INT]();
00628 }
00629 
00630 //! Interrupt handler for OutputCompare1B match (OC1B) interrupt
00631 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1B)
00632 {
00633     // if a user function is defined, execute it
00634     if(TimerIntFunc[TIMER1OUTCOMPAREB_INT])
00635         TimerIntFunc[TIMER1OUTCOMPAREB_INT]();
00636 }
00637 
00638 //! Interrupt handler for OutputCompare1C match (OC1C) interrupt
00639 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1C)
00640 {
00641     // if a user function is defined, execute it
00642     if(TimerIntFunc[TIMER1OUTCOMPAREC_INT])
00643         TimerIntFunc[TIMER1OUTCOMPAREC_INT]();
00644 }
00645 
00646 //! Interrupt handler for InputCapture1(IC1) interrupt
00647 TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE1)
00648 {
00649     // if a user function is defined, execute it
00650     if(TimerIntFunc[TIMER1INPUTCAPTURE_INT])
00651         TimerIntFunc[TIMER1INPUTCAPTURE_INT]();
00652 }
00653 
00654 //! Interrupt handler for OutputCompare2 match (OC2) interrupt
00655 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE2)
00656 {
00657     // if a user function is defined, execute it
00658     if(TimerIntFunc[TIMER2OUTCOMPARE_INT])
00659         TimerIntFunc[TIMER2OUTCOMPARE_INT]();
00660 }
00661 
00662 //! Interrupt handler for OutputCompare3A match (OC3A) interrupt
00663 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE3A)
00664 {
00665     // if a user function is defined, execute it
00666     if(TimerIntFunc[TIMER3OUTCOMPAREA_INT])
00667         TimerIntFunc[TIMER3OUTCOMPAREA_INT]();
00668 }
00669 
00670 //! Interrupt handler for OutputCompare3B match (OC3B) interrupt
00671 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE3B)
00672 {
00673     // if a user function is defined, execute it
00674     if(TimerIntFunc[TIMER3OUTCOMPAREB_INT])
00675         TimerIntFunc[TIMER3OUTCOMPAREB_INT]();
00676 }
00677 
00678 //! Interrupt handler for OutputCompare3C match (OC3C) interrupt
00679 TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE3C)
00680 {
00681     // if a user function is defined, execute it
00682     if(TimerIntFunc[TIMER3OUTCOMPAREC_INT])
00683         TimerIntFunc[TIMER3OUTCOMPAREC_INT]();
00684 }
00685 
00686 //! Interrupt handler for InputCapture3 (IC3) interrupt
00687 TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE3)
00688 {
00689     // if a user function is defined, execute it
00690     if(TimerIntFunc[TIMER3INPUTCAPTURE_INT])
00691         TimerIntFunc[TIMER3INPUTCAPTURE_INT]();
00692 }

Generated on Tue Sep 20 03:11:43 2005 for Procyon AVRlib by  doxygen 1.4.2