Nuvo-2500 Series User’s Manual
Copyright © 2015 Neousys Technology Inc. All Right Reserved.
Page 147 of 154
5.8.1.5 QEI_GetVelocity
Gets the current encoder speed.
Syntax
BOOL QEI_GetVelocity(DWORD idx, DWORD *lpVelocity);
Description
This function gets the current position of the encoder. Depending upon the
con
figuration of
the encoder, and the incident of an index pulse, this value may or
may not contain the expected data (that is, if in reset on index mode, if an index
pulse has not been encountered, the position counter is not yet aligned with the
index pulse).
Parameter
idx
[in]
Specifies the index of QEI controllers. Currently there is only one QEI
controller.
lpVelocity
[out]
Points to a DWORD value specifies the number of pulses captured in the
given time period.
Return Value
Returns TRUE if operation successes, FALSE if operation failed.
Usage
DWORD vel = 0;
BOOL ret = QEI_GetVelocity(0, &vel);