mpiMotorIoGet (Deprecated)
NOTE:
mpiMotorIoGet was moved to meiDeprecated.h in the 03.02.00 MPI software release.
Declaration
Description
mpiMotorIoGet gets a Motor’s (motor) dedicated I/O bits and writes them into 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 cleaner 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);
}
}
|
Sample Code
|
/* Poll io inputs for a motor and print to the screen */
void readIo(MPIMotor motor)
{
MPIMotorIo io;
long returnValue;
while (meiPlatformKey(MPIWaitPOLL) <= 0)
{
returnValue = mpiMotorIoGet(motor, &io);
msgCHECK(returnValue);
printf("\rIO %x", io.input);
meiPlatformSleep(100); /* Wait 100 mSec */
}
}
|
See Also
mpiMotorIoSet
|