MotorWare f2806x Module API Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions
enc.h File Reference

Contains the public interface to the encoder module routines. More...

#include "sw/modules/types/src/types.h"
#include "sw/modules/iqmath/src/32b/IQmathLib.h"

Go to the source code of this file.

Data Structures

struct  _ENC_Obj_
 Defines the encoder object. More...
 

Macros

#define ENC_SPEED_SCALING_FACTOR   16777216.0
 
#define ENC_ZERO_OFFSET   3813071.0
 
#define ENC_SPEED_CUTOFF_FREQ   100.0
 
#define ENC_SPEED_COEFF_Q   6
 
#define ENC_SPEED_COEFF_SCALING   (1<<ENC_SPEED_COEFF_Q)
 
#define ENC_2PI   (2.0*3.14159)
 
#define ENC_LOG_LEN   256
 
#define ENC_RPM_Q1   8
 
#define ENC_RPM_Q2   16
 
#define ENC_LOG_DELTA_TRIGGER_THRES   400
 

Typedefs

typedef struct _ENC_Obj_ ENC_Obj
 Defines the encoder object. More...
 
typedef struct _ENC_Obj_ENC_Handle
 Defines the encoder handle. More...
 

Enumerations

enum  ENC_LOG_State_e { ENC_LOG_STATE_IDLE =0, ENC_LOG_STATE_FREERUN, ENC_LOG_STATE_ACQUIRE }
 Enumeration for the encoder log states. More...
 

Functions

void ENC_calcElecAngle (ENC_Handle encHandle, uint32_t posnCounts)
 Reads encoder and returns the electrical degrees in Q24 format. More...
 
_iq ENC_getElecAngle (ENC_Handle encHandle)
 Returns the electrical angle. More...
 
_iq ENC_getMagneticAngle (ENC_Handle encHandle)
 Returns the magnetic angle. More...
 
_iq ENC_getFilteredSpeed (ENC_Handle encHandle)
 Returns the low-pass filtered speed output. More...
 
int16_t ENC_getSpeedRPM (ENC_Handle encHandle)
 Returns the filtered speed in RPM. More...
 
ENC_Handle ENC_init (void *pMemory, const size_t numBytes)
 Initializes the encoder object. More...
 
void ENC_run (ENC_Handle encHandle, uint32_t posnCounts, uint16_t indextFlag, uint16_t dirFlag, int16_t log_flag)
 Based on the encoder reading, computes the electrical angle and the electrical "speed". More...
 
void ENC_setIncrementalSlip (ENC_Handle encHandle, _iq incrementalSlip)
 Set the amount of incremental slip. More...
 
void ENC_setRunFlag (ENC_Handle encHandle)
 Start logging encoder data. More...
 
void ENC_setZeroOffset (ENC_Handle encHandle, uint32_t zeroOffset)
 Sets the value for the encoder object zero offset. More...
 
void ENC_setup (ENC_Handle encHandle, const int16_t sample_period, const uint16_t num_pole_pairs, const uint16_t num_enc_slots, const uint32_t enc_zero_offset, const float_t full_scale_freq, const float_t speed_update_freq, const float_t speed_cutoff)
 Initializes encoder object parameters. More...
 

Detailed Description

Contains the public interface to the encoder module routines.

(C) Copyright 2011, Texas Instruments, Inc.

Definition in file enc.h.