// Built with BFTC Rev. 1.0.0, mer 13 agosto 2014 14:23:15

 

/*

    Copyright 2014 Digital Technology Art SRL

    This file is part of Blackfin Toolchain (BFTC) project.

 

    BFTC is free software: you can redistribute it and/or modify

    it under the terms of the GNU General Public License as published by

    the Free Software Foundation, either version 3 of the License, or

    (at your option) any later version.

 

    BFTC is distributed in the hope that it will be useful,

    but WITHOUT ANY WARRANTY; without even the implied warranty of

    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

    GNU General Public License for more details.

 

    You should have received a copy of the GNU General Public License

    along with Nome-Programma.  If not, see <http://www.gnu.org/licenses/>.

*/

 

#include "main.h"

 

int counter[3] = { 0, 0, 0 };

 

void callBack_0()

{

    printf("Counter[0]: %6d\n", counter[0]++);

}

 

void callBack_1()

{

    printf("Counter[1]: %6d\n", counter[1]++);

}

 

void callBack_2()

{

    printf("Counter[2]: %6d\n", counter[2]++);

}

 

int main(void)

{

    Set_PLL(16, 4); // CORE: 25MHz * 16 = 400MHz, SCLK: 400MHz / 4 = 100MHz

    Set_Port();

    Set_Uart0(115200);

   

    Set_TimerInterruptService(TIMER_0, &callBack_0, 500000);

    Set_TimerEnable(TIMER_0, true);

    DelayUs(100);

   

    Set_TimerInterruptService(TIMER_1, &callBack_1, 500000);

    Set_TimerEnable(TIMER_1, true);

    DelayUs(100);

   

    Set_TimerInterruptService(TIMER_2, &callBack_2, 500000);

    Set_TimerEnable(TIMER_2, true);

 

    while(1)

    {

        *pPORTGIO ^= _PG0;

        DelayUs(1000);

    }

    return 0;

}