MPIComparePoint
Declaration
typedef struct MPIComparePoint{ long position; MPIComparePointDirection direction; MPIComparePointAction action; long width; }MPIComparePoint;
Required Header: compare.h
Change History: 04.00.07
Description
MPIComparePoint specifies the information required to specify a single point for compare.
position | Represents the position(or delta in case of delta point) to trigger the output action. . |
---|---|
direction | Represents the direction of motion (positive or negative). |
action | Represents the action to perform when the position from feedback matches the compare value. |
width | Represents the output pulse width. Width maybe specified in either time (ns) or position counts. |
Sample Code
This code fragment shows how to initialize a point before loading it into the controller:
MPIComparePoint comparePoint;
/*Generate an output pulse starting when position feedback >= 10000
*and ending when postion feedback >= 12000*/
comparePoint.position = 10000;
comparePoint.direction = MPIComparePointDirectionPOSITIVE;
comparePoint.action = MPIComparePointActionPOSITION;
comparePoint.width = 2000;
/*Generate an output pulse starting when position feedback < 10000
*and ending after 2000 ns */
comparePoint.position = 1000;
comparePoint.direction = MPIComparePointDirectionNEGATIVE;
comparePoint.action = MPIComparePointActionTIMED;
comparePoint.width = 2000;
/*Assert the output signal when position feedback >= 15000*/
comparePoint.position = 15000;
comparePoint.direction = MPIComparePointDirectionPOSITIVE;
comparePoint.action = MPIComparePointActionNEGATED;
comparePoint.width = 0; /*Not applicable*/
/*Negate output signal when position feedback < 20000 */
comparePoint.position = 20000;
comparePoint.direction = MPIComparePointDirectionNEGATIVE;
comparePoint.action = MPIComparePointActionASSERTED;
comparePoint.width = 0; /*Not applicable*/
/*Compare hardware waits for position feedback >= 25000 (no output signal) */
comparePoint.position = 25000;
comparePoint.direction = MPIComparePointDirectionPOSITIVE;
comparePoint.action = MPIComparePointActionNOP;
comparePoint.width = 200; /*Width for NOP is ignored*/
/*Generate position delta in positive direction */
comparePoint.position = 500;
comparePoint.direction = MPIComparePointDirectionPOSITIVE;
comparePoint.action = MPIComparePointActionPOSITION;
comparePoint.width = 200;
/*Generate time delta in positive direction */
comparePoint.position = 500;
comparePoint.direction = MPIComparePointDirectionPOSITIVE;
comparePoint.action = MPIComparePointActionTIMED;
comparePoint.width = 200;
See Also