Enable the elapsed time counter.

The M2 series have an internal elapsed time counter. This is a word variable called 'time' which increments once per second. This seconds counter starts automatically on a power-on reset, but can also be enabled/disabled by the disabletime / enabletime commands.

The 'time' variable will not increment while a sleep command is executing.

Effect of increased clock speed

The time function will increment every second at 4 MHz or 16 MHz. At 2 MHz and 8 MHz the interval will be 2s, at 32 MHz the time interval will be 0.5s.

Applies To:
08M2, 14M2, 18M2, 20M2
See Also:
Related Create:

    Time example

    Demonstrate use of enabletime and disabletime.

    Code Example:
    main:	pause 5000
    	disabletime	; disable time
    	pause 5000	; wait 5 seconds
    	enabletime	; enable time
    	debug		; display time value
    	goto main	; loop back to start
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.


    • Login to leave a comment.