RobotStudio event

PC SDK Reading Writing Group Inputs Outputs

Options
DavidLanham
DavidLanham ✭✭✭
edited January 2023 in Developer Tools
I am using PC SDK 2022 to read and write group outputs to controller. 
Group Output goOutput size = 32 bit
Group Input giInput size =32 bit
When Using objController.IOSystem.GetSignal("giInput") it reads the value correctly until the value gets large enough that bit 30 of 32 would be on and then the value read is in Exponential format instead of the actual value.  Does anyone know why it's doing this and if there is something in C# VS 2022 Pro that I need to change to make it still be in Int format.

So I have worked with this and figured out some more information.  First, what I stated above is correct, it does change the value to Exponential when the bit 30 comes on, but the value is still correct.  Here is the code I use to read the value:

GroupInput = objController.IOSystem.GetSignal("giInput");
      GroupSignal giSig = (GroupSignal)GroupInput;
      decimal x = decimal.Parse(giSig.Value.ToString(), NumberStyles.Number | NumberStyles.AllowExponent); 

It is when bit 32 comes on that the ObjController.IOSystem.GetSignal then returns a negative Exponential value that is incorrect.  So it seems that the function has a problem with negative values?  I need to be able to send positive and negative values between my application and the controller.  Is this a bug with the function or am I doing something wrong?

Post edited by DavidLanham on
Tagged: