Jump to content
IGNORED

F18A high-resolution timer


retroclouds

Recommended Posts

The high resolution timer is still there, but I don't think it has been used outside of the demos Rasmus did. The counter ticks every 10ns and counts in base-10, which I hope makes it easier to use. The "seconds" part of the counter is a full 16-bit value, which means the count will roll-over after about 18.2 hours (65536 seconds / 60 / 60). Since the time resolution is 10ns, the nanoseconds component will always be a multiple of 10, i.e. 10, 20, 30 .. 970, 980, 990, 0 ...

 

SR4..SR11 are used to read the various components of the count, i.e. SR5:SR4 are a 16-bit value that represent the number of nanoseconds from 0..999, SR7:SR6 are the microseconds from 0..999, SR9:SR8 are the milliseconds from 0..999, and SR11:SR10 are the number of seconds from 0..65535.

 

There are 3-bits in VR15 used to control the counter:

 

VR15, bit >40 is a self-clearing trigger that resets the counter, i.e. you set the bit to trigger the counter reset, and the bit goes back to zero automatically. If the counter is running when the reset happens, it will be reset to zero and continue counting. Resetting the counter to zero does not stop the counter.

 

VR15, bit >20 is a self-clearing trigger that grabs a snap-shot of the counter's value for reading via SR4..SR11. This works just like the reset, and the bit will go back to zero automatically. You must perform a snap-shot to update the value that is read back via SR4..SR11. If you do not do a snap-shot, reading SR4..SR11 will always return the same values. A snap-shot does not affect the counter's running/stopped status, and you can take a snap-shot while the counter is running if necessary. Since starting/stopping the counters takes time, snap-shots allow you to grab time samples without effecting the counter and thus the accuracy of the timing.

 

VR15, bit >10 is the running / stopped status of the counter. Set this bit to allow the counter to run, clear the bit to stop the counter. Note: as mentioned above, you do not need to stop the counter to reset it or grab a snap-shot of the value.

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...