1.8.22.22 TCx_CHy_CaptureBGet Function

C

/* x = TC instance number, y = channel number */

/* 16 bit counter */
uint16_t TCx_CHy_CaptureBGet ( void )

/* 32 bit counter */
uint32_t TCx_CHy_CaptureBGet ( void )

Summary

Returns the Capture-B value.

Description

This function provides the Capture-B value that was stored when the selected event occurred on the input signal. The caller should call the TCx_CHy_CaptureBEventOccured function to identify if the Capture-B value has been updated by the selected signal event.

Precondition

TCx_CHy_TimerInitialize function must have been called first for the given channel to configure channel in capture mode.

Parameters

None

Returns

Most recent Capture-B value. Type of the return value varies with the bit depth of the counter

Example

16 bit counter

uint16_t capture;

if (TC0_CH1_CaptureBEventOccured() == true)
{
    capture = TC0_CH1_CaptureBGet();
}

32 bit counter

uint16_t capture;

if (TC0_CH1_CaptureBEventOccured() == true)
{
    capture = TC0_CH1_CaptureBGet();
}

Remarks

This function is applicable only for capture mode.