Purpose: | Determine if a desired time period has passed, based on the entire 4-byte system millis value. | |||
Assumes: | System interrupts are enabled, so the Operating System is able to update ulT0_Millis and ulT0_Seconds. | |||
Passed: | R25:R24:R23:R22 | WORD | ulStart | the millis value saved at the starting time |
R21:R20:R19:R18 | ULONG | ulDuration | the timer delay time, 0 to 4,294,967,290 milliseconds | |
Returns: | R24 | BYTE | bIfDone | 0 (or FALSE) if the specified amount of time has NOT passed OR 1 (or TRUE) if the specified amount of time has passed |
FLAGS | ZERO | flag | set (TRUE) when the time has NOT expired (i.e., when R24 is 0) OR clear (FALSE) when the timer has timed out (i.e., when R24 is 1) |
|
Alters: | R0, R22 through R27, R30, R31, and the FLAGS, and R18 through R21 if ulDuration > 4,294,967,290 (= 0xFFFFFFFA) |
Example: | This example uses the constant duration of 86,400 Seconds, which is 0x05265C00 milliseconds. It is loaded as a ULONG value into R21:R20:19:R18 below. Although more often than not, the duration would be a variable, this example shows that it doesn't always have to be. |
| |
Notes: | See the notes in the msTimerBYTE and SecTimerBYTE functions. |
Dropin: (setup code) |
; Setup for the msTimerULONG() call: ; Passed: R25:R24:R23:R22 ULONG the millis() value saved at the starting time ; R21:R20:R19:R18 ULONG the delay duration (0 to 4,294,967,290 mSec) ; Note: values from 4,294,967,291 to 4,294,967,295 may be passed, ; will limit it 4,294,967,290 and will not cause an error. ; Returns: R24 BYTE 0 if the time delay is not done yet OR ; 1 if (at least) the desired amount of time has passed ; (Also): ZERO FLAG TRUE when the time has NOT passed yet OR ; FALSE when the time has passed ; Alters: R0, R22 through R27 and FLAGS (R24 has the return value) ; R18 through R21 if the value passed in it is overrange |
Also see: | The millis and SystemSeconds variables, the msTimerBYTE, SecTimerBYTE, msTimerWORD, and SecTimerWORD timers. |