![]() ZBasic System Library
144
ZBasic Microcontrollers
Type
Subroutine
Invocation
GetMicroTime(timeBuf)
Parameter
Method
Type
Description
timeBuf
ByRef
Microtime_t structure or
array of Byte
A buffer to be populated with time data.
Discussion
This routine populates the provided buffer, which must be at least 5 bytes long (6 bytes for xmega
devices), with high resolution timing data. This information is most useful in conjunction with a
subsequent call to GetElapsedMicroTime() to compute an elapsed time.
The data in the time buffer comprises of the value of the TCNT register of the RTC Timer at the moment
of the call followed by the RTC tick value converted to fast ticks (that typically occur at 1024Hz for ZX
devices).
The pre-defined structure, Microtime_t, can be incorporated in your application using the directive
Option Include Microtime_t. Using this structure instead of an array of bytes is preferable not
least because it automatically adapts if you change the target device.
Example
Dim start(1 to 5) as Byte ' must be 6 bytes for xmega devices
Dim mt0 as Microtime_t
Call GetMicroTime(start)
Call GetMicroTime(mt0)
Compatibility
This subroutine is not available on ZX models that are based on the ATmega32 processor (e.g. the ZX-
24) nor is it available if the RTC is not enabled in your application. Moreover, it is not available in BasicX
compatibility mode.
See Also
|