.

Transitioning to the New Motor I/O Functions

Why were the Motor I/O functions changed?

As a result of the increased functionality of the MPI and SynqNet nodes in every software release, the number of dedicated inputs has increased beyond 16. The original functions used to access the dedicated inputs (mpiMotorIoGet and mpiMotorIoSet) had to be changed in order to cope with this increased number of inputs. The changes should allow the interface to adapt to future expansions of the I/O capabilities and provide a clearer interface for accessing the motor I/O.

What has changed?

Deprecated Interface
(03.01.xx)
New Interface
(03.02.00 and after)
Functions:
mpiMotorIoGet
mpiMotorIoSet
meiControlIoBitGet
meiControlIoBitSet
Structures:
MPIMotorIo
Enumerations:
MEIMotorDedicatedIn
MEIMotorDedicatedOut
MEIMotorIoMask
MEIMotorInput

The original functions and enumerations are still available and will have the same functionality as they prior to MPI version 03.02.00. See MPI Version Numbering. The original definitions have been moved to meiDepricated.h.

NOTE:
An existing application can still use the deprecated interface without any source code changes. However, new or existing applications that want to use the extended functions should use the new interface.

See Also

Introduction to Motor I/O Interface
Dedicated Motor I/O
Motor Digital Output Waits
General Purpose Motor I/O

 

Sample Code

Example 1:

If the original code to check the current state of the positive hardware limit switch was:

 

MPIControlIo controlIo;

mpiMotorIoGet( motor, &motorIo );

if( motorIo.input & MEIMotorDedicatedInLIMIT_HW_POS ) {
    printf( "Positive Hardware Limit Set\n" );
} else {
    printf( "Positive Hardware Limit Clear\n" );
}

The equivalent code using the new interface would be:

 

unsigned long limitHWPos;
mpiMotorDedicatedIn( motor,
                    MPIMotorDedicatedInLIMIT_HW_POS,
                    1,
                    &limitHWPos );

if( limitHWPos ) {
    printf( "Positive Hardware Limit Set\n" );
} else {
     printf( "Positive Hardware Limit Clear\n" );
}

 

Example 2:

If the original code to set the first general purpose output was:

 

MPIControlIo controlIo;

mpiMotorIoGet( motor, &motorIo );

motorIo.output |= MEIMotorIoMask0;

mpiMotorIoSet( motor, &motorIo );

The equivalent code using the new interface would be:

 

mpiMotorGeneralOutSet( motor, 0, 1, 1 );

mpiMotorGeneralOutSet( motor, 0, 1, 1, TRUE );

 

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2010 Motion Engineering