# Read/write general purpose registers via real-time interface

**URL:** <https://forum.universal-robots.com/t/read-write-general-purpose-registers-via-real-time-interface/36764>\
**Category:** Robot Communication\
**Created:** [October 30, 2024, 1:53pm UTC](https://forum.universal-robots.com/t/read-write-general-purpose-registers-via-real-time-interface/36764 "2024-10-30T13:53:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mar.pc.24](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@mar.pc.24](https://forum.universal-robots.com/u/mar.pc.24)\
**Post date:** [October 30, 2024, 1:53pm UTC](https://forum.universal-robots.com/t/read-write-general-purpose-registers-via-real-time-interface/36764/1 "2024-10-30T13:53:20Z")

</div>

Hi there, is it possible to read/write general purpose registers through TCP/IP communication not using RTDE? I need to write and read data from registers, and I can’t find the way to do that using the Real-time interface through port 30003. Also, I am having many difficulties to do that via RTDE because I am not using Python or C++, I am using C# instead and it is a bit complicated to make it work.

Please I would highly appreciate any hint or help you can provide. Thank you!

---

<div class="post-metadata">

**Author:** ![lxop](https://avatars.discourse-cdn.com/v4/letter/l/8491ac/32.png) [@lxop](https://forum.universal-robots.com/u/lxop)\
**Post date:** [November 5, 2024, 2:30am UTC](https://forum.universal-robots.com/t/read-write-general-purpose-registers-via-real-time-interface/36764/2 "2024-11-05T02:30:23Z")

</div>

If you’ve got budget for extra libraries, UnderAutomation has a C# library for communicating with UR bots, including RTDE. It has a free trial option, so you can test it out to see if it serves your needs.

---

<div class="post-metadata">

**Author:** ![androidflorent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/androidflorent/32/3314_2.png) [@androidflorent](https://forum.universal-robots.com/u/androidflorent)\
**Post date:** [January 22, 2025, 9:31am UTC](https://forum.universal-robots.com/t/read-write-general-purpose-registers-via-real-time-interface/36764/3 "2025-01-22T09:31:40Z")

</div>

Yes, you can take a look at the UnderAutomatrion library. It provides a complete implementation of RTDE in C#:

[https://underautomation.com/universal-robots/documentation/rtde](https://underautomation.com/universal-robots/documentation/rtde)

```auto
using UnderAutomation.UniversalRobots;
using UnderAutomation.UniversalRobots.Common;
using UnderAutomation.UniversalRobots.Rtde;
using UnderAutomation.UniversalRobots.Rtde.Internal;

class Rtde
{
    static void Main(string[] args)
    {
        var robot = new UR();

        var param = new ConnectParameters("192.168.0.1");

        // Enable RTDE
        param.Rtde.Enable = true;

        // Exchange data at 500Hz
        param.Rtde.Frequency = 500;

        // Select data you want to write in robot controller
        param.Rtde.InputSetup.Add(RtdeInputData.StandardAnalogOutput0);
        param.Rtde.InputSetup.Add(RtdeInputData.InputIntRegisters, 0);

        // Select data you want the robot to send
        param.Rtde.OutputSetup.Add(RtdeOutputData.ActualTcpPose);
        param.Rtde.OutputSetup.Add(RtdeOutputData.ToolOutputVoltage);
        param.Rtde.OutputSetup.Add(RtdeOutputData.OutputDoubleRegisters, 10);

        // Connect to robot
        robot.Connect(param);

        // Be notified at 500Hz when data is received
        robot.Rtde.OutputDataReceived += Rtde_OutputDataReceived;

        // Get last received data in cache
        Pose actualTcpPose = robot.Rtde.OutputDataValues.ActualTcpPose;
        int toolOutputVoltage = robot.Rtde.OutputDataValues.ToolOutputVoltage;
        double outputDoubleRegisters10 = robot.Rtde.OutputDataValues.OutputDoubleRegisters.X10;

        // Write input values in robot
        var inputValues = new RtdeInputValues();
        inputValues.StandardAnalogOutput0 = 0.2;
        inputValues.InputIntRegisters.X0 = 12;
        robot.Rtde.WriteInputs(inputValues);

        // Disconnect every interfaces (Primary Interface, Dashboard, RTDE, ...)
        robot.Disconnect();
    }

    private static void Rtde_OutputDataReceived(object sender, RtdeDataPackageEventArgs e)
    {
        // Get frequency of received message (OutputSetup contains Timestamp by default)
        var realMessageFrequency = e.MeasuredFrequency;

        // Get the value of the data you have selected in the setup 
        Pose actualTcpPose = e.OutputDataValues.ActualTcpPose;
        int toolOutputVoltage = e.OutputDataValues.ToolOutputVoltage;
        double outputDoubleRegisters10 = e.OutputDataValues.OutputDoubleRegisters.X10;

        // Write inputs at 500Hz
        var inputValues = new RtdeInputValues();
        inputValues.StandardAnalogOutput0 = 0.5;
        inputValues.InputIntRegisters.X0 = -10;
        (sender as RtdeClientBase)?.WriteInputs(inputValues);
    }
}

```
