Tick Count (ms) is probably the best and easiest way to perform this
task, however you do need to be aware of the wrap around, whereby the
function starts at 0 after the maximum number of counts has elapsed.

You can get over this by simply checking for this event and handling
it by adding a constant.

You do also need to be aware that this method does rely on giving back
CPU time by using the Wait until next ms function. This will aid error
in the measurement of the time function as it waits for x ms.

A more complex but better implmentation of this method especially if a
smaller time in ms is required would be to implement this using an a
design pattern like the Producer/Consumer with Events.

Hope this also helps.

Reply via email to