Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

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.