MPICompareConfig

Declaration

typedef struct MPICompareConfig { 
   int32_t                             motorNumber;
   int32_t                             engineNumber;
   MPICompareConfigFeedbackSelect      feedbackSelect;
   MPICompareConfigOutputInvert        outputInvert;
   MPICompareConfigMode                compareMode;
   MPICompareConfigBufferSize          bufferSize;
   MPICompareCompensate                positionCompensation;
   double                              userCompensationValue; 
   int                                 compareWidth;	 
}MPICompareConfig;

 

Required Header: compare.h

Change History: 04.04.00

Description

MPICompareConfig specifies configuration for the compare module for one engine.

motorNumber The number of the motor associated with the compare object.
engineNumber The compare engine number to be used.
feedbackSelect Use one of the valid enumeration to select between time, primary or secondary.
outputInvert Use one of the valid enumeration to select between normal or inverted output.
compareMode Use one of the valid enumeration to select between single, streamed, multiple or delta mode.
bufferSize Use one of the valid enumeration to select between 1, 2, 4, 8, 16.
positionCompensation Use one of the valid enumeration to select between axis origin, raw encoder value or user compensation value
userCompensationValue Stores the user compensation value. Only used if user compensation selected at positionCompensation field.
compareWidth This read-only field updates the width of the hardware comparator inside the FPGA. It may differ for each node type and each feedback source. Smallest value is 32 bits and largest value is 64 bits. (See discussion on quadrant comparator).

Sample Code

This code fragment shows how to configure a compare module:


/*Configure compare module to have a streaming mode of operation 
 *with a cyclic buffer having depth of 16 words. 
 *Also to monitor the Primary feedback of motor 0 for the position and
 *to invert the output event signal*/
 
MPICompareConfig compareConfig;
compareConfig.motorNumber           = 0;
compareConfig.engineNumber          = 0;
compareConfig.compareMode           = MPICompareConfigModeSTREAMING;
compareConfig.bufferSize            = MPICompareConfigBufferSize16_WORDS;
compareConfig.feedbackSelect        = ICompareConfigFeedbackSelectPRIMARY_FEEDBACK_DATA;
compareConfig.outputInvert          = MPICompareConfigOutputInvertInvertOutputPolarity;
compareConfig.positionCompensation  = MPICompareCompensateRAW_VALUE;

See Also

mpiCompare