Jump to main content

##

# 2.80.4 PDECx_QDECPositionGet Function

## C

    uint16_t PDECx_QDECPositionGet ( void ) // x is instance of the peripheral and it is applicable only for devices having multiple instances of the peripheral.

## Summary

Reads the angular position from the quadrature encoder.

## Description

This function reads the position from the quadrature encoder by reading as tracked by the channel counter.

## Precondition

PDECx_QDECInitialize function must have been called first for the given channel.

## Parameters

None.

## Returns

Returns Position of the encoder. This consists of the angular position and revolution counter.

## Example

    int16_t position;

    PDEC_QDECInitialize();
    PDEC_QDECStart();
    position = PDEC_QDECPositionGet();

## Remarks

In counter-clockwise direction, position counter works in down counting mode. Returned position must be decoded as angular position and revolution counter based on the ANGULAR bit field value.