Jump to main content

##

# 1.2.11.4.13 SYS_TIME_CountToUS Function

## C

    uint32_t SYS_TIME_CountToUS ( uint32_t count )

## Summary

Converts a counter value to time interval in microseconds.

## Description

This function converts a counter value to time interval in microseconds, based on the hardware timer frequency as configured and as reported by SYS_TIME_FrequencyGet.

## Precondition

The SYS_TIME_Initialize function should have been called before calling this function.

## Parameters

Param | Description
--- | ---
count | Counter value to be converted to an equivalent value in microseconds.

## Returns

Number of microseconds represented by the given counter value. |

## Example

Given a previously captured 32-bit counter value called "timestamp" captured using the SYS_TIME_CounterGet function, the following example will calculate the number of microseconds elapsed since timestamp was captured.

    uint32_t count = SYS_TIME_CounterGet() - timestamp;
    uint32_t us = SYS_TIME_CountToUS(count);

## Remarks

None.