- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI
I made a Project in qu@rtus II 5.0sp1 Web edition, and in SOPC Builder, I added NIOS II cpu, AvalonTri-State Bridge to an external SRAM, Jtag UART and a Interval Timer. The system generation and hardware configuration went fine. When did a simple application for the design in Nios II IDE Evaluation Edition 5.0, it alsow worked fine, although the aplication didn´t use the Interval Timer. So I want to try the Timer. I want to use the Intervall timer to mesure the time for som executions for example Sum = 5; So I want to initalize the timer, start it, then after the execution stop it and then read the value. For example like this : int main(Void) { int Sum = 0; int Time = 0; ........ // Here I want to initalize the timer ........ // Start the timer Sum = 5; ........ // Stop the timer Time = ........ // Read the value of the timer return 0; } Can someone give me an example C code. /MrZLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Start looking at the documentation provided for the timer component. There you will find on what adresses you must write to initialse the timer, and to read it out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you should have a look at the performance counter peripheral...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
simpler still, you can just use the timestamp feature in the HAL. See the section "High Resolution Time Measurement" in the Nios II Software Developer's Manual for a description and a code example.
Remember to set the timestamp device to be your timer in the system library properties page in the Nios II IDE.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page