. |
Overview of SynqNet I/O for the MPX MPX Software Topics > I/O Modules/Slices/Segments Terminology Modules/Slices/Segments TerminologyModules Slices Segments
I/O Example NetworkThe 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 SqNode.DigitalInCount, SqNode.DigitalOutCount, SqNode.AnalogInCount, and SqNode.DigitalOutCount properties. The SqNode.SegmentCount property returns the number of segments present on a node. The following MPX code shows how to read the number of supported digital inputs on a node 0: Visual Basic
C#
The SqNode properties the nodes in the example network would be:
What Information is Available About Each I/O Segment?The I/O on each node is comprised of a number of segments. To access information about these segments, one must use the SqNodeSegment object. One can obtain access to an SqNodeSegment object through the Segment property of the SqNode object. Visual Basic
C#
The SqNodeSegment object has its own DigitalInCount, DigitalOutCount, AnalogInCount, and AnalogOutCount properties. These tell how much I/O is available on the segment. The SegmentId, Option, SerialNumber, Model, Version, and ManufacturerData properties provide additional production data. The SegmentId property provides a unique number to identify the kind of segment. For SynqNet I/O modules:
These properties have the following values for each of the slices in the example network:
Since Node 2 is an RMB-10V2 and does not have any slices, attempting to access a child SqNodeSegment object from SqNode(2) will generate an error. The following MPX Visual Basic code shows how to read the number of digital inputs on Slice 1 of Node 0.
Accessing Digital DataThe following digital I/O members 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: Addressing I/O bits relative to each segment: The following MPX 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 following MPX code will get the current state of all the digital inputs on segment 1 of node 0:
The following MPX code will set the top 16 bits and clear the bottom 16 bits of Node 1: Visual Basic
C#
The following MPX code will only set the fifth bit on node 0: Visual Basic
C#
Accessing Analog Data Analog input segments allow different types of analog signals to be sampled, for example: The AnalogIn and AnalogOut properties of the SqNode and SqNodeSegment objects allow the analog data from these segments to be accessed. The analog channel is addressed relative to the node: The analog channel is addressed relative to each segment: The analog value is a 16-bit number that contains the raw bits going to/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 MPX code sets the analog output Number 2 on Segment 1 of Node 1 to +5V. Visual Basic
C#
The following MPX code reads the current state of the first analog input on Node 2: Visual Basic
C#
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 attempting to access an SqNodeSegment object will return an error. However, the SqNode.AnalogIn property will work as expected. User DataEach 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 SqNodeSegment.UserData property. The following MPX code reads the contents on the non-volatile memory on segment 0 of node 1: Visual Basic
C#
The following MPI code changes the contents on the non-volatile memory: Visual Basic
C#
Output WaitsSqNode and SqNodeSegment both have properties named DigitalOutWait. 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. DigitalOutWait determines what happens if two output functions are called in short succession. When setting a new output state, the new output state is held on the controller and the MPX 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 another output state is set for the same node before the original data has been transmitted, then DigitalOutWait selects between two choices: it either waits for the previous output state to be transmitted before continuing to apply the new state or it overwrites the existing held state in the controller and immediately exits.
The wait decision is independent for each node. The following MPX code sets DigitalOutWait to True will ensure that the physical pin will generate a short pulse: Visual Basic
C#
The following MPX code shows an implementation that does not introduce 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 is not related in this application, this code can execute faster. Visual Basic
C#
The SqNode.IoWaitMax property is the maximum delay, measured in seconds, that may be introduced between setting bits when DigitalOutWait = True.
|
| | Copyright © 2001-2021 Motion Engineering |