Controller Digital I/O Overview
Introduction
All MEI motion controllers (XMP, ZMP and eXMP) support some I/O directly connected to the controller. The following table summarizes which of the input or output bits in the software are mapped to which physical hardware pin.
The XESTOP input pin does NOT perform any special function on the controller.
Bits |
XMP
|
ZMP |
eXMP
|
PCI |
CPCI |
PMC |
PCI |
PMC |
IN0 |
OPTO_A* |
OPTO_A* |
OPTO_A* |
|
OPTO_A* |
OPTO_A* |
IN1 |
OPTO_B* |
OPTO_B* |
OPTO_B* |
|
OPTO_B* |
OPTO_B* |
IN2 |
OPTO_C* |
OPTO_C* |
OPTO_C* |
|
OPTO_C* |
OPTO_C* |
IN3 |
OPTO_D* |
OPTO_D* |
OPTO_D* |
IN3 |
OPTO_D* |
OPTO_D* |
IN4 |
OPTO_E* |
OPTO_E* |
OPTO_E* |
IN4 |
OPTO_E* |
OPTO_E* |
IN5 |
OPTO_F* |
OPTO_F* |
OPTO_F* |
IN5 |
OPTO_F* |
OPTO_F* |
IN6 |
XESTOP |
XESTOP |
XESTOP |
XESTOP |
XESTOP |
XESTOP |
OUT0 |
OPTO_A* |
OPTO_A* |
OPTO_A* |
OUT0 |
OPTO_A* |
OPTO_A* |
OUT1 |
OPTO_B* |
OPTO_B* |
OPTO_B* |
OUT1 |
OPTO_B* |
OPTO_B* |
OUT2 |
OPTO_C* |
OPTO_C* |
OPTO_C* |
OUT2 |
OPTO_C* |
OPTO_C* |
OUT3 |
OPTO_D* |
OPTO_D* |
OPTO_D* |
|
OPTO_D* |
OPTO_D* |
OUT4 |
OPTO_E* |
OPTO_E* |
OPTO_E* |
|
OPTO_E* |
OPTO_E* |
OUT5 |
OPTO_F* |
OPTO_F* |
OPTO_F* |
|
OPTO_F* |
OPTO_F* |
|
* These pins share the physical output pins. The pin is either an input or output, and depends on the external wiring to the controller. |
See Also
Connect Controller I/O: XMP-SynqNet Series
What I/O does a Controller Support?
The io field of the MPIControlInfo structure returned by the mpiControlInfo function, returns if each pin is supported on the specific controller along with a descriptive string, if the input or output is supported.
|
typedef struct MPIControlInfoIoDigitalIn { MPI_BOOL supported; const char *name; } MPIControlInfoIoDigitalIn;
typedef struct MPIControlInfoIoDigitalOut {
MPI_BOOL supported;
const char *name;
} MPIControlInfoIoDigitalOut;
typedef struct MPIControlInfoIo {
MPIControlInfoIoDigitalIn digitalIn[MPIControlInMAX+1];
MPIControlInfoIoDigitalOut digitalOut[MPIControlOutMAX+1];
} MPIControlInfoIo;
typedef struct MPIControlInfo {
...
MPIControlInfoIo io;
} MPIControlInfo;
|
|
For example, executing the following piece of code on a ZMP-PCI controller
|
MPIControlInfo controlInfo; mpiControlInfo( control, &controlInfo );
|
|
would return the following contents:
|
Supported
0 = No
1 = Yes |
Bit |
controlInfo.io.digitalIn[0] |
1 |
IN0 |
controlInfo.io.digitalIn[1] |
1 |
IN1 |
controlInfo.io.digitalIn[2] |
1 |
IN2 |
controlInfo.io.digitalIn[3] |
0 |
|
controlInfo.io.digitalIn[4] |
0 |
|
controlInfo.io.digitalIn[5] |
0 |
|
controlInfo.io.digitalIn[6] |
1 |
XESTOP |
controlInfo.io.digitalOut[0] |
1 |
OUT0 |
controlInfo.io.digitalOut[1] |
1 |
OUT1 |
controlInfo.io.digitalOut[2] |
1 |
OUT2 |
controlInfo.io.digitalOut[3] |
0 |
|
controlInfo.io.digitalOut[4] |
0 |
|
controlInfo.io.digitalOut[5] |
0 |
|
Accessing the I/O on the Controller
The controller I/O can be set or monitored using the following MPI functions:
mpiControlDigitalIn
mpiControlDigitalOutSet
mpiControlDigitalOutGet
These functions take two arguments, bitStart and bitCount, which allow either a single bit to be accessed (bitCount equals one) or multiple, adjacent I/O bits to be accessed (bitCount is greater than one).
The following code shows how to get the state of controller input 1.
|
unsigned long input1; mpiControlDigitalIn( control, 1, 1, &input1 );
|
|
The next piece of code shows how to set three controller outputs (2, 3 and 4):
|
mpiControlDigitalOutSet( control, 2, 3, 7, TRUE );
|
|
|