The startTmr Command

STARTTMR.GIF

Command Summary

Returns the value of the clock timer on the TI-84+/SE.

Command Syntax

startTmr→Variable

Menu Location

This command can only be found in the catalog. Press:

  1. 2nd CATALOG to enter the command catalog
  2. T to skip to command starting with T
  3. Scroll up to startTmr and select it

Calculator Compatibility

TI-84+/SE

Token Size

2 bytes

The startTmr command is used with the built-in timer that is available on the TI-84+/SE calculators. It is used together with the checkTmr( command to determine how much time has elapsed since the timer was started. An application of these commands is timing different commands or pieces of code, as well as countdowns in games, or a time-based score (such as in Minesweeper).

To use the timer, you first store startTmr to a variable (usually, a real variable) whenever you want the count to start. Now, whenever you want to check the elapsed time, you can use checkTmr( with the variable from above, giving you the number of seconds that have passed. Using checkTmr( doesn't stop the timer, you can do it as many times as you want to.

In the case of Minesweeper, for example, you would store startTmr to, for example, T, after setting up and displaying the board, display the result of checkTmr(T) in the game's key-reading loop, and store checkTmr(T) to the player's score if he wins.

Despite the name of the command, startTmr doesn't start the clock if it's stopped; use ClockOn instead to start the clock.

Advanced Uses

To time a command or routine using startTmr and checkTmr(, use the following template:

:ClockOn
:startTmr→T
:For(A,1,(number)
   (command(s) to be tested)
:End
:checkTmr(T)/(number)

Making (number) higher increases accuracy, but takes longer. Also, make sure not to modify the variables A or T inside the For( loop.

While this method eliminates human error from counting, it's prone to its own faults. A major one is that startTmr and checkTmr( always return whole numbers, but time is continuous. Depending on how close the start and end of the loop were to a clock tick, the number of seconds may be off by up to one second in either direction. To take this into account, you could replace the last line:

:(checkTmr(T)+{-1,1})/(number)

This will give you a list of the maximum and minimum possible times — the true time that the command takes is guaranteed to be somewhere in between.

The other thing you need to be aware of when testing code is that there are many different things that will affect the time: the strength of the batteries, the amount of free RAM, and including the closing parenthesis on the For( loop. The last one, in particular, has an impact when using a lone If command or one of the IS>( or DS<( commands.

Related Commands

.

Page tags: 84plus clock command
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License