mpiMotorIoSet (Deprecated)
NOTE:
mpiMotorIoSet was moved to meiDeprecated.h in the 03.02.00 MPI software release.
Declaration
Description
mpiMotorIoSet sets a Motor’s (motor) dedicated I/O bits using data from the structure pointed to by io.
NOTE: When using I/O on SynqNet nodes, use the motor I/O masks
in the drive's header file for clearer code. Most SynqNet
nodes have a header file that defines things that are specific
to that drive. The header files are found in C:\mei\XMP\sqNodeLib\include.
An example is shown below that reads the hall sensors from
the Trust TA802.
/*
Shows the hall sensors.
Make sure you include trust_ta800.h. Ex:
#include "C:\mei\XMP\sqNodeLib\include\trust_ta800.h"
The hall sensor masks are found in the enum TA800MotorIoMask.
*/
void showHalls(MPIMotor motor)
{
MPIMotorIo io;
long returnValue;
long a, b, c;
while (meiPlatformKey(MPIWaitPOLL) <= 0)
{
returnValue = mpiMotorIoGet(motor, &io);
msgCHECK(returnValue);
a = ((io.input & TA800MotorIoMaskHALL_A) == TA800MotorIoMaskHALL_A);
b = ((io.input & TA800MotorIoMaskHALL_B) == TA800MotorIoMaskHALL_B);
c = ((io.input & TA800MotorIoMaskHALL_C) == TA800MotorIoMaskHALL_C);
/* Prints a 1 or 0 indicating the hall state */
printf("Hall A %d B %d C %d\t\t\r", a, b, c);
meiPlatformSleep(100);
}
}
|
See Also
mpiMotorIoGet
|