Error when access Register's value with RegLong using PCDK C#

  • Hi all,


    I am trying to access and manipulate FANUC V9.30P/08 controller's registers using PCDK (version V9.30(Rev.B)) in C#. Please help me understanding why the following code does not work:


    The outputs (belows) indicates that "RegLong" does not exist in "FRCVar" object.

    Code
    Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
      HResult=0x80131500
      Message='System.__ComObject' does not contain a definition for 'RegLong'
      Source=<Cannot evaluate the exception source>
      StackTrace:
    <Cannot evaluate the exception stack trace>




    However, I have followed these threads and this seeing that the similar syntax work. Can anyone please help?

  • Place your Ad here!
  • I think I found the solution already. Since layer.Value returns back a dynamic object that does not support RegLong property, I had to transform it back to FRCRegNumeric first.


    The solution is:

    C#
    {
      ...
                FRCVars robot_registers = myrobot.RegNumerics;
    
                FRCVar layer = robot_registers[6];
                FRCRegNumeric layer_value = layer.Value;
                Console.WriteLine(layer_value.RegLong);
      ...
    }

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners