.

Overview of MPI I/O

Modules/Slices/Segments Terminology
I/O Example Network
What I/O does a Node support?
What information is available about each I/O segment?
I/O Faults
Accessing Digital Data
Accessing Analog Data
Analog Inputs on RMB nodes
User Data
Output Waits
Diagnostic Slices
Slice Parameters
Slice Memory
Using the Counter Slice

Modules/Slices/Segments Terminology

Modules
A SQID network adaptor is expanded with modules (e.g. DIN32DOUT32, ADC4DAC4).

Slices
A Slice network adaptor is expanded with slices.

Segments
The software uses the same MPI functions to access I/O on both slices or modules. The software uses the generic term "segment" for slices or modules, depending on the type of the SynqNet I/O node.

I/O Example Network

The following diagram shows how a Slice I/O, SynqNet I/O and RMB node could be connected. The first node, Node 0, is a Slice I/O node with three slices attached: two digital input slices and one digital output slice. The second node, Node 1, is a SynqNet I/O node with a SQID network adaptor with two modules attached, a DIN32DOUT32 and an ADC4DAC4. The third node, Node 2, is an RMB-10V2 node, this node has four analog inputs that are not associated with any motion, and these analog inputs are accessed with the same functions as the other two node types.

What I/O does a node support?

To determine if a node supports I/O and how much I/O is supported, you can use the mpiSqNodeInfo function. This function fills out the MPISqNodeInfo structure that contains an io field that gives details about the I/O capabilities of the node.

The first four values hold the total number of each type of I/O available on the node. The segmentCount field shows how many slices/modules this node supports.

The following MPI code shows how to read the number of supported digital inputs on a node.


MPISqNodeInfo sqNodeInfo;
mpiSqNodeInfo( sqNode0, &sqNodeInfo );

long x = sqNodeInfo.io.digitalInputCount;

The MPISqNodeInfoIo structure for the nodes in the example network would be:

Node 0
Node 1
Node 2
digitalInCount
12
32
0
digitalOutCount
4
32
0
analogInCount
0
4
4
analogOutCount
0
4
0
segmentCount
3
2
0

What Information is Available About Each I/O Segment?

The I/O on each node is comprised of a number of segments. The mpiSqNodeSegmentInfo can be used to find out how much I/O is supported by each segment and also provides some production data (ex: serial number and version). This function fills in the fields of the following structure.

typdef struct MPISqNodeSegmentInfo{
    long id;
long option;
char serialNumber[];
char modelName[];
long digitalInCount;
long digitalOutCount;
long analogInCount;
long analogOutCount;
long version;
long paramCount;
long memoryCount;
char manufacturerData[];
} MPISqNodeSegmentInfo;

The first field id provides a unique number to identify the kind of segment. For SynqNet I/O modules:

Type Code
MEI PN
Description
C0FE C001
T020-0001
DIN32DOUT32
C0FE C002
T021-0001
ADC4DAC4
C0FE C003
T022-0001
ADC4DAC4

The MPISqNodeSegmentInfo structure for each of the slices in the example network would be:

Node 0
Node 1
Segment 0
Segment 1
Segment 2
Segment 0
Segment 1
id
00030041h
00070041h
000E0081h
C0FEC001h
C0FEC002h
option
0
0
0
0
0
serialNumber
9008h
902Ah
4503h
0
0
modelName
TSIO-2003
TSIO-2007
TSIO-4003
T021-0001
T021-0001
digitalInCount
4
8
0
32
0
digitalOutCount
0
0
4
32
0
analogInCount
0
0
0
0
4
analogOutCount
0
0
0
0
4
version
5
5
5
0
0
paramCount
0
0
0
0
0
memoryCount
0
0
0
0
0
manufacturerData
""
""
""
""
""

Since Node 2 is an RMB-10V2 and does not have any slices, mpiSqNodeSegmentInfo will return an error if it is used with Node 2.

The following MPI code shows how to read the number of digital inputs on Slice 1 of Node0.


MPISqNodeSegmentInfo segmentInfo;
mpiSqNodeSegmentInfo( sqNode0, 1, &segmentInfo );

long x = segmentInfo.digitalInCount;

I/O Faults

Slice and SynqNet (SQID) nodes use serial communications between the SynqNet interface and the Slice or SynqNet Modules that make up the node. This communication is continuously monitored to ensure that it is working correctly. If a problem is detected, an I/O Fault is generated.

Poorly connected I/O segments, dirty connections between segments, or excessive EMC disturbances, can generate an I/O Fault.

SQID nodes use four independent communication channels for the different types of I/O (digital In, digital Out, analog In and analog Out). Since the channels are independent if a fault is detected on one communication channel, the others will still continue to work. Four flags indicate if a fault has been detected with each of the I/O signals. The overall I/O Fault is generated if one or more of the I/O types has detected a fault.

Slice nodes share a single communication channel to all the I/O types. If this communication channel detects a fault, all the I/O faults will be set simultaneously.

The current state of all I/O Fault flags can be monitored using mpiSqNodeStatus. The following MPI code shows how to read the current state of the I/O fault flags.


MPISqNodeStatus SqNodeStatus;
mpiSqNodeStatus( sqNode0, &SqNodeStatus );

printf( “IO Fault = %d\n”,
mpiEventMaskBitGET( SqNodeStatus.eventMask,
MPIEventTypeSQNODE_IO_FAULT ) );

printf( “Digital In Fault = %d\n”, SqNodeStatus.ioFaults.digitalIn );
printf( “Digital Out Fault = %d\n”,
SqNodeStatus.ioFaults.digitalOut );
printf( “Analog In Fault = %d\n”,
SqNodeStatus.ioFaults.analogIn );
printf( “Analog Out Fault = %d\n”,
SqNodeStatus.ioFaults.analogOut );

Accessing Digital Data

The following digital I/O functions allow single or multiple digital input or output bits on a node or segment on a node to be accessed.

Addressing relative to the node:
mpiSqNodeDigitalIn
mpiSqNodeDigitalOutSet
mpiSqNodeDigitalOutGet

Addressing I/O bits relative to each segment:
mpiSqNodeSegmentDigitalIn
mpiSqNodeSegmentDigitalOutSet
mpiSqNodeSegmentDigitalOutGet

The function prototypes for these functions are similar to:


long mpiSqNodeDigitalIn( MPISqNode node, long bitStart, long bitCount, unsigned long *value );


This function will return the state of up to 32 input bits. The arguments bitStart and bitCount specify which bits are returned as the left justified value. If the number of bits (bitCount) is greater than 32, these functions will return an error.

The following MPI code will get the current state of digital inputs 3, 4, and 5 of Node 0 (in the example network these bits spread over segments 0 and 1):


long x;
mpiSqNodeDigitalIn( sqNode0, 3, 3, &x );

The result is right justified so that the first bit of the result is at least a significant bit position; the bits greater than the bitCount are padded with zeros.

The following MPI code will get the current state of all the digital inputs (the following slice has 8 inputs) on segment 1 of node 0:


long x;
mpiSqNodeSegmentDigitalIn( sqNode0, 1, 0, 8, &x );


The following MPI code will set the top 16 bits and clear the bottom 16 bits of Node 1:



long x = 0xFFFF0000;

mpiSqNodeDigitalOutSet( sqNode1, 0, 32, &x );


The following MPI code will only set the fifth bit on a node 0 (the second bit of the segment 1):


mpiSqNodeDigitalOutSet( sqNode0, 5, 1, 1 );

See Also: SQIO-DIN32DOUT32: Output Pinouts | SQIO-DIN32DOUT32: Input Pinouts

Accessing Analog Data

Analog input segments allow different types of analog signals to be sampled, for example:
±10V
0-10V
4-20mA
0-20mA
Temperature via direct connection to thermocouples
Resistance from RTD sensors (Resistance Temperature Detectors)

The following MPI functions allow the analog data from these segments to be accessed.

The analog channel is addressed relative to the node:
mpiSqNodeAnalogIn
mpiSqNodeAnalogOutSet
mpiSqNodeAnalogOutGet

The analog channel is addressed relative to each segment:
mpiSqNodeSegmentAnalogIn
mpiSqNodeSegmentAnalogOutSet
mpiSqNodeSegmentAnalogOutGet

The analog value is a 16-bit number that contains the raw bits going to or from the SynqNet node. The relationship between the 16-bit number and the analog value is described with the documentation for each analog module or slice. For example, the analog data for the ADC4DAC4 module have the following relationship:

7FFFh
+10V
8000h
–10V

The following MPI code sets the analog output Number 2 on Segment 1 of Node 1 to +5V.


mpiSqNodeSegmentAnalogOutSet( sqNode1, 1, 2, 0x3FFF );

The following MPI code reads the current state of the first analog input on Node 2:


long x;
mpiSqNodeAnalogIn( sqNode2, 0, &x );


NOTE: Some slices use specific analog values to indicate fault conditions. For example, the 4-20mA input slice (TSIO-6006) will return the number 8000h if the current is below the minimum sensor threshold of 3mA.

RMB-10V2 nodes do have some analog inputs but do not have any segments, so the mpiSqNodeSegmentAnalogIn function will always return an error. However, the mpiSqNodeAnalogIn function will work and return the requested analog data.

See Also: SQIO-ADC4DAC4: Output Pinouts | SQIO-ADC4DAC4: Input Pinouts

Analog Inputs on RMB Nodes

The analog inputs on RMB-10V2 nodes support software configurable input ranges. The following functions allow you to change the range of the analog data returned by mpiSqNodeAnalogIn:
rmbAnalogInRangeSet
rmbAnalogInRangeGet

Type Code
7FFFh
8000h
RMBAnalogInRange10V
+10V
–10V
RMBAnalogInRange5V
+5V
–5V
RMBAnalogInRange2_5V
+2.5V
–2.5V
RMBAnalogInRange1_25V
+1.25V
–1.25V

User Data

Each module that can be connected to the SQID module contains some non-volatile memory. Some of this non-volatile memory has been reserved and is available for storing data specific to a user's application.

16 bytes are reserved and can be accessed with the following MPI functions:
mpiSqNodeSegmentUserDataGet
mpiSqNodeSegmentUserDataSet

The following MPI code reads the contents on the non-volatile memory on segment 0 of node 1:


MPISqNodeSegmentUserData nodeData;

mpiSqNodeSegmentUserDataGet( sqNode1, 0, &nodeData );

The following MPI code changes the contents on the non-volatile memory to a string:

MPISqNodeSegmentUserData nodeData;

strncpy( nodeData.data, “test” , MPISqNodeUserDATA_CHAR_MAX );

mpiSqNodeSegmentUserDataSet( sqNode1, 0,&nodeData );

Output Waits

mpiSqNodeSegmentDigitalOutSet and mpiSqNodeAnalogOutSet have a Boolean argument wait. SynqNet is a cyclic network and each new state, after a call to an output function, can only be transmitted over SynqNet at the SynqNet rate. The wait argument determines what happens if two output functions are called in short succession.

When an output function is first called, the new output state is held on the controller and the function will return immediately, allowing the host application to continue with other tasks. The new output state will wait on the controller until the next cycle before being transmitted over SynqNet and being applied to the physical pin on the node.

If an output function is called again for the same node before this data has been transmitted, then the wait argument selects between two choices, either wait for the previous output state to be transmitted before continuing to apply the new state or to overwrite the existing held state in the controller and immediately exit.

wait
Advantage
Disadvantage
FALSE
Some output states may never appear at the output pins. No delay is introduced into the execution of the output function.
TRUE
Guarantees that each output state in a sequence will appear at the output pins. Adds a delay to the execution of the output function.

The wait decision is independent for each node.

The following MPI code with wait true will ensure that the physical pin will definitely generate a short pulse.


mpiSqNodeDigitalOutSet( sqNode1, 0, 1, 1, /*wait*/ 1 );
mpiSqNodeDigitalOutSet( sqNode1, 0, 1, 0, /*wait*/ 1 );


The following MPI code shows the use of not introducing a wait. This code is updating two bits on the same node. Both calls will immediately exit and since the timing of these two bits in this application are not related, this code can execute faster.


mpiSqNodeDigitalOutSet( sqNode1, 7, 1, 1, /*wait*/ 0 );
mpiSqNodeDigitalOutSet( sqNode1, 8, 1, 1, /*wait*/ 0 );


The maxWait field of the MPISqNodeInfoIo structure, which is returned by the mpiSqNodeInfo function, is the maximum number of controller samples wait introduced.

You can find the SynqNet sample rate from the sampleRate field of the MPIControlConfig structure, which is returned by the mpiControlConfigGet function.

Diagnostic Slices

Some of the digital output slices include diagnostic feedback (TSIO-4009, TSIO-4010, TSIO-4011, TSIO-4012). The diagnostic slices provide a set of output bits but also provide the same number of input bits. These input bits report the actual state of the output at the external connector, after any internal drive circuitry.

These slices appear to the MPI software as slices that support digital inputs and digital outputs. You can set the outputs using the conventional digital output commands, for example, mpiSqNodeDigitalOutSet, and check the diagnostic inputs with the digital input commands (mpiSqNodeDigitalIn).

Slice Parameters

Some of the Slice I/O modules also support parameters. Parameters are NOT supported on SQID nodes. Slice parameters allow the local behavior of the slice to be configured.

For example, the 4 channel 24V output slice (TSIO-4003) has the following two parameters.

Parameter
Access
Bits
Description
Default
0
Read
and
Write
0-3
Fault Action for outputs 0 to 3
0: Fault Value (see parameter 1)
1: Hold Last State
0
4-7
Reserved
0
1
Read
and
Write
0-3
Fault Value for outputs 0 to 3
0: OFF
1: ON
0
4-7
Reserved
0

These slice parameters allow you to define the state of the outputs after a fault condition. By default, the outputs on this slice will switch off when a fault is detected, such as when the SynqNet cable is detached from the node.

The parameterCount field of the MPISqNodeSegmentInfo structure returns the number of parameters bytes supported by each slice.

The following two functions are provided to access the parameters on each slice.


long mpiSqNodeSegmentParamGet( MPISqNode node, long slice, long paramStart, long paramCount, char *values ); long mpiSqNodeSegmentParamSet( MPISqNode node,
long slice,
long paramStart,
long paramCount,
char *values );

For example, to set both (the first two) slice parameters on slice 2, use the following code.


char parameters[2] = { ‘\x00’, ‘\x0F’ };
mpiSqNodeSegmentParamSet( sqNode0, 2, 0, 2, parameters );

The current working set of parameters are held within volatile memory in each slice on a node. However, these values will be lost if the power to the node is lost. When the node powers up or is reset, it loads its parameters from a set of parameters stored in non-volatile memory in the network adapter.

The mpiSqNodeSegmentParamStore function copies the current working set of parameters to the set of stored parameters held in non-volatile memory. These parameters will be used when a node is power on or reset.

When the node is powered up, it verifies that the set of stored slice parameters in non-volatile memory match the attached slices. If there is a mismatch, the default set of parameters will be loaded on the slices. (See the documentation for each slice to see the default parameters.) If a slice is swapped for another slice of the same type (part number) then the stored parameters for the existing slices on the node will be preserved when the node powers on.

The mpiSqNodeSegmentParamDefault function allows the current set of parameters to be overwritten with the default set of parameters.

The slice parameters are stored on the network adapter. If the node changes position in the network or is moved to another network, the slice parameters are preserved with the node.
The mpiSqNodeSegmentParamClear function will delete any slice parameters previously stored on non-volatile memory. The next time the node powers up, the slices will have their default parameters loaded.

SynqNet I/O (SQID) nodes and all drive nodes do not have any slice parameters and will generate an error message if these functions are used.

Slice Memory

Some of the slices used with the Slice I/O network adapters support additional memory locations that can be accessed over SynqNet. Parameters are NOT supported on SQID nodes.

For example, the 4 channel 12bit 4-20mA analog input slice (TSIO-6006) has ten memory locations.

Memory
Offset
Access
Description
0
R
Channel 0 low bits
1
R
Channel 0 high bits
2
R
Channel 1 low bits
3
R
Channel 1 high bits
4
R
Channel 2 low bits
5
R
Channel 2 high bits
6
R
Channel 3 low bits
7
R
Channel 4 high bits
8
R
Bits 0-3: Alarm status bits for each channel. When set, the input signal is below the minimum current of 3mA.
9
R
Reserved, always 0

The memoryCount field of the MPISqNodeSegmentInfo structure returns the number of memory bytes that are available on each slice.

SynqNet I/O nodes and all other drive nodes do not have any slice memory and will generate an error message if these functions are used.

The following two functions are provided to access the memory locations on each slice.


long mpiSqNodeSegmentMemoryGet( MPISqNode node, long slice, long memoryStart, long memoryCount, char *data ); long mpiSqNodeSegmentMemorySet( MPISqNode node,
long slice,
long memoryStart,
long memoryCount,
char *data );

For example, the following MPI code demonstrates how to read the first ten memory parameters on slice 2.


char memory[10];
mpiSqNodeSegmentMemoryGet( sqNode, 2, 0, 10, memory );

Using the Counter Slice

The counter slices (TSIO-9001, TSIO-9002) have three digital inputs and one digital output available at the connectors of the slice. Over SynqNet, 48 input bits (a 24-bit count value and some status bits) and 16 output bits (control bits mostly for the physical output) are cyclically communicated over SynqNet and appear as digital I/O bits from the slice. The slice also has two parameters for configuring things like the counter mode (pulse/direction, up/down pulses) and 24 memory locations for monitoring and changing the internals of the counter.

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