xmpl_timer.c - Using the Timer Macros

Timer Macro Example

/* $Id: pgXmplTmr.html,v 1.1.1.4 2013/04/09 21:11:49 awachtler Exp $ */
/* Example for using the timer macros */
#include "board.h"
#include "timer.h"
#include "ioutil.h"

#ifndef NO_TIMER
int main(void)
{
    LED_INIT();
    TIMER_INIT();
    sei();
    while(1)
    {
        DELAY_MS(100);
    }
}

ISR(TIMER_IRQ_vect)
{
static time_t  ticktime = 0;
    ticktime ++;
    /* LED_0 blinks with the calling frequency of the IRQ routine */
    LED_TOGGLE(0);
    if (ticktime > MSEC(500))
    {
        /* LED_1 blinks with a period of 1s */
        LED_TOGGLE(1);
        ticktime  = 0;
    }
}
#endif
/*EOF*/


This documentation for µracoli was generated on Tue Apr 9 2013 by  doxygen 1.7.1