Jump to main content

##

# 2.123.8 TMRx_CounterGet Function

## C

    /* x = TMR instance number */
    uint16_t TMRx_CounterGet(void);

## Summary

Reads the timer counter value.

## Description

This function reads the timer counter value.

## Precondition

TMRx_Initialize() function must have been called first.

## Parameters

None.

## Returns

The timer's current count value.

## Example

    uint16_t counter;

    TMR2_Initialize();
    TMR2_Start();
    counter = TMR2_CounterGet();

## Remarks

If timer is operating on 32 bit mode then return value should be uint32_t type.