Slice I/O

When selecting an I/O schema for your Motion Control System, it is often desirable to have a flexible, powerful option which can evolve with your design. Slice I/O is intended to handle variety and change. Slice I/O is an expandable set of I/O blocks which can be modeled into the vision of your system.


Slice I/O is comprised of a communications block with attached segments of Digital and Analog IO. In slices of 2-16 IO, you can add blocks to meet the demands of your system. Bellow is a sample SynqNet Slice I/O Node attached to the controller without any other drives.

sliceio1.jpg


All examples below will be based on the above system:

  • Segment 1 - Digital Input (8 available)
  • Segment 2 - Digital Input (8 available)
  • Segment 3 - Digital Output (4 available)


The following shows the Slice I/O as seen in RapidSetup.

sliceio2.jpg


Using Slice I/O: There are basically two ways to reference I/O. You can decide to use either one available: 1. Addressing relative to nodes. 2. Addressing relative to segment.


  • Verification Before you start to read/change the state of Digital/Analog Inputs/Outputs, you will need to verify what Slice I/O’s you have connected to the system. The following methods are useful for collecting data on your system: (Object Verification) io->IOExists() – Confirms your “io” variable is mapped to a I/O Node. (Verification by Node) io->SqNode->DigitalInCountGet() – The number of Digital Input Bits on a node. io->SqNode->DigitalOutCountGet() – The number of Digital Output Bits on a node. io->SqNode->AnalogInCountGet() – The number of Analog Input Bits on a node. io->SqNode->AnalogOutCountGet() – The number of Analog Output Bits on a node. io->SqNode->SegmentCountGet() – The number of segments attached to your Slice I/O. (Verification by Segment – Recommended before use) io->SegmentDigitalInCountGet(segmentNumber) – The number of Digital Input Bits on a segment. io->SegmentDigitalOutCountGet(segmentNumber) - The number of Digital Output Bits on a segment. io->SegmentAnalogInCountGet(segmentNumber) - The number of Analog Input Bits on a segment. io->SegmentAnalogOutcountGet(segmentNumber) - The number of Analog Output Bits on a segment.


  • Access There are a variety of ways to access Slice IO. You can access a single bit or a collection of bits by node reference or segment reference. Functions which reference by Node use the direct call. Reference by Segment is possible with a preceding “Segment” on the function name. Single bit and multiple bit access is determined by the parameters passed to these functions.


Here are a list of the 9 Node based Access Functions: DigitalInGet(bitNumber) – Single bit access based on number by Node. DigitalOutGet(bitNumber) – Single bit access based on number by Node. DigitalOutSet(bitNumber, value) – Single bit access based on number by Node.


DigitalInGet(startingBit, numberToCollect) - A range of bit(s) accessed by Node. DigitalOutGet(startingBit, numberToCollect) - A range of bit(s) accessed by Node. DigitalOutSet(startingBit, numberToSet, value) - A range of bit(s) accessed by Node.


AnalogInGet(channel) - A channel which is referenced by Node. AnalogOutGet(channel) - A channel which is referenced by Node. AnalogOutSet(channel, value) - A channel which is referenced by Node.


Here is the list of 9 Segment based Access Functions: SegmentDigitalInGet(segmentNumber, bitNumber) – Single bit access based on number by Segment. SegmentDigitalOutGet(segmentNumber, bitNumber) – Single bit access based on number by Segment. SegmentDigitalOutSet(segmentNumber, bitNumber, value) – Single bit access based on number by Segment.


SegmentDigitalInGet(segmentNumber, startingBit, numberToCollect) - A range of bit(s) accessed by Segment. SegmentDigitalOutGet(segmentNumber, startingBit, numberToCollect) - A range of bit(s) accessed by Segment. SegmentDigitalOutSet(segmentNumber, startingBit, numberToSet, value) - A range of bit(s) accessed by Segment.


SegmentAnalogInGet(segmentNumber, channel) - A channel which is referenced by Segment. SegmentAnalogOutGet(segmentNumber, channel) - A channel which is referenced by Segment. SegmentAnalogOutSet(segmentNumber, channel, value) - A channel which is referenced by Segment.


I will give several examples of reading and writing Digital IO to make you more comfortable with these function calls.


Input Example 1: Now as an example let’s say that you want to get the state of the input bits (3, 4 and 5) on Segment 1. (Our state table as seen from RapidSetup)

sliceio3.jpg


The code would be as follows: printf("State of the input bits for the Segment 1: 0x%x.\n", io->SegmentDigitalInGet(1, 3, 3));


The display for the above code would be as follows. This display is in hexadecimal which means that bits 3, 4 and 5 on segment 1 are low.

sliceio4.jpg


Input Example 2: Now let’s say that you want to get the state of the input bits (0-7) on Segment 1. (Using different values, our state table as seen from RapidSetup)

sliceio5.jpg


Running the following command: printf("State of the input bits for the Segment 1: 0x%x.\n", io->SegmentDigitalInGet(1, 0, 8));


The output would be as follows:

sliceio6.jpg


A return of 14 from our function call:

sliceio7.jpg


0 0 0 1 0 1 0 0 is binary for the hexadecimal address representation 14 as displayed above.


Input Example 3: Reading a different section (bits 2, 3, 4) of the same slice. (Using the same state table as Example 2.)


Running the following command: printf("State of the input bits for the Segment 1: 0x%x.\n", io->SegmentDigitalInGet(1, 2, 3));


The output would be as follows:

sliceio8.jpg


The reason is as follows:

sliceio9.jpg


The Binary is 1 0 1 and the hexadecimal address would be 0x5 as displayed above.


Input Example 4: Here is another different section (1, 2, 3, 4, 5) of the same slice but with reference by relationship to the Node rather than a Segment. (Using the same state table as Example 2.)


As there are 8 Digital inputs on Segment 0, Segment 1’s digital inputs are numbered 8-15. Therefore (Segment 1 Digital Input 1) is the same as (Node Digital Input 9) and so on.


Running the following command: printf("State of the input bits for the Segment 1: 0x%x.\n", io->DigitalInGet(9, 5)); The output would be as follows:

sliceio10.jpg


The reason is as follows:

sliceio11.jpg


The Binary is 0 1 0 1 0 and the hexadecimal address would be 0xa as displayed above.


Output Example 1: Set the state of the output bits (1 and 2) on Segment 2 to HIGH. (Our desired state table as seen from RapidSetup)

sliceio12.jpg


In this case, the bit representation would be as follows:

sliceio13.jpg


The hexadecimal value for the above bit representation is 0x6 from bit 0 or 0x3 from bit 1.


The code would be as follows: io->SegmentDigitalOutSet(2, 0, 4, 0x6, true); -or- io->SegmentDigitalOutSet(2, 1, 2, 0x3, true);


Output Example 2: Now changing bit 0 and bit 3 to be HIGH. (Our desired state table as seen from RapidSetup)

sliceio14.jpg


In the case above the bit representation would be as follows:

sliceio15.jpg


The hexadecimal value for the above bit representation is 0x9.


Call the following method: io->SegmentDigitalOutSet(2, 0, 4, 0x9, true);


Output Example 3: Reading an Output is similar to reading Inputs. (Our state table as seen from RapidSetup)

sliceio16.jpg


Passing the following code: printf("State of the output bits (0 and 3) for Segment 2: 0x%x. ", io->SegmentDigitalOutGet(2, 0, 4));


This will display below: 0x9 which is 1001 in binary meaning that bits 0 and bit 3 are HIGH.

sliceio17.jpg


Please review the Slice I/O sample applications available at www.roboticsys.com/rapidcode/examples.php for a full example of proper use.