Skip to content

Cannot write to Unsigned Ints with the nuget package 1.52 #456

Description

@bschrauf

I keep getting an out of bounds error when trying to write to an unsigned int16 and int32 registers on a control Logix plc. Can read the ints, and I can both read and write bools and strings with no issues using the same controller settings.

The code is:

libplctag.ITag _nativeTag = new TagInt();

_nativeTag.Gateway = controller.PlcGateWay;
_nativeTag.Path = controller.PlcPath;
_nativeTag.UseConnectedMessaging = controller.UseUCCM; // true = cip connection , false = ucmm (dh+ and micro 800 bridged links must be true)
_nativeTag.PlcType = (PlcType)Enum.Parse(typeof(PlcType), controller.PlcBrand, true);
_nativeTag.Protocol = (Protocol)Enum.Parse(typeof(Protocol), controller.PlcProtocol, true);
_nativeTag.Initialize();
_nativeTag.Value = Tagvalue; // tried 0, 1, and some other random values under 100
_nativeTag.Write();

The write to a DInt did seem to work with a value of 1 (even though I get an error from the write), but the read returned a crazy large number, I assume because of some sort of signed to unsigned conversion in the PLC or this library.

The PLC programmer confirmed that the registers are UInt16 and UInit32, but there do not seem to be any uint converters in the nuget. Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions