APIs, concepts, guides, and more
io-network-pdo-sdo.cs
/* This sample demonstrates how to read network inputs and outputs (PDOs and SDOs).
Shows how to enumerate through all network inputs/outputs and read their properties,
including size, offset, name, and value information.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 IO: Network PDOs and SDOs");
// get rmp objects
try
{
Helpers.CheckErrors(controller);
// get Input values
int inputCount = controller.NetworkInputCountGet(); // get number of Network Inputs (PDOs)
Console.WriteLine($"Network Input Count: {inputCount}");
for (int i = 0; i < inputCount; i++)
{
int size = controller.NetworkInputBitSizeGet(i); // read Input BitSize
int offset = controller.NetworkInputBitOffsetGet(i); // read Input BitOffset
string name = controller.NetworkInputNameGet(i); // read Input Name
UInt64 value = controller.NetworkInputValueGet(i); // read Input Value
Console.WriteLine($"Input {i}: {name}, Size: {size}, Offset: {offset}, Value: {value}");
}
// get Output values
int outputCount = controller.NetworkOutputCountGet(); // get number of Network Outputs (SDOs)
Console.WriteLine($"Network Output Count: {outputCount}");
for (int i = 0; i < outputCount; i++)
{
int size = controller.NetworkOutputBitSizeGet(i); // read Output BitSize
int offset = controller.NetworkOutputBitOffsetGet(i); // read Output BitOffset
string name = controller.NetworkOutputNameGet(i); // read Output Name
UInt64 value = controller.NetworkOutputSentValueGet(i); // read Output Value
Console.WriteLine($"Output {i}: {name}, Size: {size}, Offset: {offset}, Value: {value}");
controller.NetworkOutputOverrideValueSet(i, value);
}
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Definition _helpers.cs:15
Helpers class provides static methods for common tasks in RMP applications.
Definition _helpers.cs:5
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800