Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.

Nios2 and timer

Honored Contributor II

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 !
0 Kudos
1 Reply
Honored Contributor II

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.
0 Kudos