Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

startTmr and checkTmr

Peter Tillema edited this page Nov 26, 2018 · 2 revisions

In ICE you can use one general-purpose timer, and it works basically the same as the TI-OS one. There is one main difference, and that is that this is a 32KHz timer, which means it ticks 32768 times per second. That is, if you wait exactly 1000ms, the timer advanced 32768 ticks. ICE has the power to read the current status of the timer at any moment, allowing you time certain code very precisely. startTmr always turns the timer on (if it wasn't already) and returns the current value of the timer (timestamp). checkTmr( does that as well, but directly substracts the argument from the timestamp. That is, if you give it the timestamp from startTmr, you know how many ticks have been passed, which you can convert to milliseconds or something. Example:

startTmr→TIME
Pause 1000
checkTmr(TIME)→PASSED
Disp PASSED

This should display 32768 or something very similar (note that there's always some overhead).

Clone this wiki locally