Overview of MPI I/O
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.
To determine if a node supports I/O and how much I/O is supported, you can use the meiSqNodeInfo function. This function fills out the MEISqNodeInfo 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.
The I/O on each node is comprised of a number of segments. The meiSqNodeSegmentInfo 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.
The first field id provides a unique number to identify the kind of segment. For SynqNet I/O modules:
The MEISqNodeSegmentInfo structure for each of the slices in the example network would be:
Since Node 2 is an RMB-10V2 and does not have any slices, meiSqNodeSegmentInfo 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 Node 0.
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 meiSqNodeStatus. The following MPI code shows how to read the current state of the I/O fault flags.
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.
The function prototypes for these functions are similar to:
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):
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:
The following MPI code will set the top 16 bits and clear the bottom 16 bits of Node 1:
The following MPI code will only set the fifth bit on a node 0 (the second bit of the segment 1):
Analog input segments allow different types of analog signals to be sampled, for example:
The following MPI functions allow the analog data from these segments to be accessed.
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:
The following MPI code sets the analog output Number 2 on Segment 1 of Node 1 to +5V.
The following MPI code reads the current state of the first analog input on Node 2:
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 meiSqNodeSegmentAnalogIn function will always return an error. However, the meiSqNodeAnalogIn function will work and return the requested analog data.
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 meiSqNodeAnalogIn:
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.
The following MPI code reads the contents on the non-volatile memory on segment 0 of node 1:
The following MPI code changes the contents on the non-volatile memory to a string:
meiSqNodeSegmentDigitalOutSet and meiSqNodeAnalogOutSet 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.
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.
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.
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, meiSqNodeDigitalOutSet, and check the diagnostic inputs with the digital input commands (meiSqNodeDigitalIn).
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.
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 MEISqNodeSegmentInfo structure returns the number of parameters bytes supported by each slice.
The following two functions are provided to access the parameters on each slice.
For example, to set both (the first two) slice parameters on slice 2, use the following code.
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 meiSqNodeSegmentParamStore 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 meiSqNodeSegmentParamDefault 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.
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.
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.
The memoryCount field of the MEISqNodeSegmentInfo 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.
For example, the following MPI code demonstrates how to read the first ten memory parameters on slice 2.
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.
|| | Copyright © 2001-2010 Motion Engineering|