Altera_Forum
Honored Contributor
12 years agotimer problem
I'm new to altera and c-programming. Just can't make the internal timer work.
int main(void){
volatile int * red_leds =(int*) 0x10000000;
volatile int * timer =(int*) 0x10002000;
int data, exit_data, delay, run;
//turning timer on
int counter = 0xee6b280; // 1/(50 mhz) x (0xee6b280) = 5 sec
*(timer + 0x8) = (counter & 0xffff);
*(timer + 0xc) = (counter >> 16) & 0xffff;
*(timer + 0x4) = 0x4;
run=*(timer);
*(red_leds)=0;
/////////////////////////////////////////////
while (run==0x00000001) //
{
*(red_leds)=0x000002aa;
}
while(1)
{
*(red_leds)=0;
}
}