APIs, concepts, guides, and more
IOPoint

Manage diverse inputs and outputs conveniently using the IOPoint class.

🔹 What is IOPoint?

The IOPoint class provides a simple standardized interface for interacting with the various things that can be thought of as an input or output.

An IOPoint can be an input or an output and can be Digital or Analog.

An IOPoint can be created from:

  • An Axis's dedicated input/output
  • An Axis's general input/output
  • An NetworkNode object and a bit number
  • A memory address
  • A network PDO input/output

📜 Sample Code

IO Points Basics

This sample apps will demonstrate how to use the IO point object to read and write to network data.

  • C#

    const int NODE_INDEX = 0; // the EtherCAT Node we will be communicating with
    const int OUTPUT_INDEX = 0; // the PDO Index in that Node
    // create IOPoint for digital output - automatically gets memory index of specified node and output index
    IOPoint output0 = IOPoint.CreateDigitalOutput(controller.NetworkNodeGet(NODE_INDEX), OUTPUT_INDEX);
    // set the output to false
    output0.Set(false);
    Console.WriteLine($"Output {OUTPUT_INDEX} set to: false");
    // wait one sample for the change to take effect
    controller.SampleWait(1);
    // read back the value
    bool outputValue = output0.Get();
    Console.WriteLine($"Output {OUTPUT_INDEX} value: {outputValue}");
    // set the output to true
    output0.Set(true);
    Console.WriteLine($"Output {OUTPUT_INDEX} set to: true");
    controller.SampleWait(1);
    outputValue = output0.Get();
    Console.WriteLine($"Output {OUTPUT_INDEX} value: {outputValue}");

IO Point User Buffer

This sample application will show you how to create a simulated IOPoint from base on a memory address and index.

  • C#

    const int INPUT_INDEX = 0;
    const int OUTPUT_INDEX = 1; // the PDO Index in the user buffer
    // get user buffer address for simulated IO point storage
    UInt64 userBufferAddress = controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER, 0);
    // create simulated IOPoints based on memory address and index
    IOPoint input0 = IOPoint.CreateDigitalInput(controller, userBufferAddress, INPUT_INDEX);
    IOPoint output0 = IOPoint.CreateDigitalOutput(controller, userBufferAddress, OUTPUT_INDEX);
    // get & set an output
    bool outVal = output0.Get();
    output0.Set(outVal);
    Console.WriteLine($"Output 0 value: {outVal}");
    // test input operations by directly writing to memory
    controller.MemorySet(input0.AddressGet(), 1);
    bool inVal = input0.Get();
    Console.WriteLine($"Input 0 memory set to 1, value: {inVal}");
    controller.MemorySet(input0.AddressGet(), 0);
    inVal = input0.Get();
    Console.WriteLine($"Input 0 memory set to 0, value: {inVal}");