Purpose: | Determine if a desired medium time period has passed. | |||
Assumes: | System interrupts are enabled, so the Operating System is able to update ulT0_Millis and ulT0_Seconds. | |||
Passed: | R25:R24 | WORD | wStart | the millisLowWORD() value saved at the starting time, OR the SystemSecondsLowWORD() value saved at the starting time |
R23:R22 | WORD | wDuration | the timer delay time, 0 to 65,530 milliseconds (for msTimerWORD), OR the timer delay time, 0 to 65,530 Seconds (for SecTimerWORD) |
|
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, and the FLAGS |
Example: | This example assumes "normal" Register usage rules: able to change R0, R18 through R27 and R31:R30 without saving and restoring them. |
| |
The "@" command could be used to initially test the example routine above. | |
Notes: | See the notes in the msTimerBYTE and SecTimerBYTE functions. |
Dropin: (setup code) |
; Setup for the msTimerWORD() or SecTimerWORD() call: ; Passed: R25:R24 WORD the millisLowBYTE() value saved at the starting time ; or the SystemSecondsLowBYTE saved at starting time ; R23:R22 WORD the duration of the delay (0 to 65,530, milliseconds) ; or the delay duration in seconds (0 to 65,530 seconds) ; Note: values from 65,531 to 65,535 may be passed, will be ; limited to 65,530, 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) |
Also see: | The millis and SystemSeconds variables, the msTimerBYTE, SecTimerBYTE, and msTimerULONG timers. |