From RSI - Robotic Systems Integration - SynqNet Systems
Contents |
General Information
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. Below is a sample SynqNet Slice I/O Node attached to the controller without any other drives.

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.

Two ways to reference Slice I/O in SynqNet
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
- Verification: Before you start to read/change the state of Digital/Analog Inputs/Outputs, you will need to verify which Slice I/O's have been 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
- 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.
Accessing Slice IO modules
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.
List of 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
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.
Examples: Slice IO Input Modules
Slice IO Input Module: Example 1:
Now as an example let's say we want to get the state of the input bits (3, 4 and 5) on Segment 1 as shown in screen shot below:

Solution: printf("State of the input bits for the Segment 1: 0x%x.\n", io->SegmentDigitalInGet(1, 3, 3));
Result: Shown below. Result is in hexadecimal which means that bits 3, 4 and 5 on segment 1 are low.
Slice IO Input Module: Example 2:
Question: We want to get the state of the input bits (0 to 7) on Segment 1.

Solution: printf("State of the input bits for the Segment 1: 0x%x.\n", io->SegmentDigitalInGet(1, 0, 8));
Result: Shown below
0x14 in hexadecimal in binary is shown below, which might make more sense:
Slice IO Input Module: Example 3:
Question: How to read a different section (i.e. bits 2, 3 & 4) of the same slice IO module. (Using the same table as Example 2 for states Slice IO)
Solution: printf("State of the input bits for the Segment 1: 0x%x.\n", io->SegmentDigitalInGet(1, 2, 3));
Result: As shown below:
0x5 in Hexadecimal to binary would be as shown below:
Slice IO Input Module: Example 4:
Question: Get state of Digital input using Node instead of Segment approach. (Using the same state table as Example 2)
Solution:There are 8 Digital inputs on Segment 0. Segment 1 has digital inputs numbered from 8 to 15. Therefore (Segment 1 Digital Input 1) is the same as (Node Digital Input 9) and so on.
printf("State of the input bits for the Segment 1: 0x%x.\n", io->DigitalInGet(9, 5));
Result:The output would be as follows:
0x14 in hexadecimal is following in Binary:
Examples: Slice IO Output Modules
Slice IO Output Module: 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)

In this case, the bit representation would be as follows:
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);
Slice IO Output Module: Example 2:
Now changing bit 0 and bit 3 to be HIGH. (Our desired state table as seen from RapidSetup)

In the case above the bit representation would be as follows:
The hexadecimal value for the above bit representation is 0x9.
Call the following method: io->SegmentDigitalOutSet(2, 0, 4, 0x9, true);
Slice IO Output Module: Example 3:
Reading an Output is similar to reading Inputs. (Our state table as seen from RapidSetup)

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.
RapidCode Sample Applications
Please review the Slice I/O sample applications available at www.roboticsys.com/rapidcode/examples.php for a full example of proper use.
- SliceIO.cpp - C++
- SliceIO.cs - C#