Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Nios2 and timer

Hi all forumers !!

I'm totally new to fpgas and I'm trying to get my best !!

But now I really need some suggestions.. I'm implementing a routine in C with quartus that uses a timer but I cannot find how to get it... I need to implement something like that:

#include<time.h>
..... some code here .....
time_t start,now;
time(&start);
seconds = 0;
while seconds < 1 {
     ... do something...
     time(&now);
     seconds=(uint8_t) difftime(now,start);
}

by the way it seems not working... i always get seconds==0.

There is a better way to get it works ??

Thank you for your support !!

Have a nice day !

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Solved it.

    It was sufficient to add and configure "interval timer" in my qsys. I have called it sys_clck_timer. Than, in eclipse, I have added the sys_clck_timer in the bsp editor of my project.