im trying to read this data block from Siemens S300 PLC using s7netplus libary
and my mapped code struct looks like this
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct CIP_B
{
public bool Start_Req;
public bool Start_Ack;
public bool End_Req;
public bool End_Ack;
public bool Ended_OK;
public bool Step_Interupted;
public bool Value_Changed;
public Byte CIP_OBJ;
public Byte CIP_TYPE;
[MarshalAs(UnmanagedType.U2, SizeConst = 16)]
public ushort[] VCM_Setpoint;
public Int16 Step_Num;
public Int16 changedValue;
[MarshalAs(UnmanagedType.U1, SizeConst = 10)]
public Byte[] Spare;
}
I'm using this command to read the struct
var res = (CIP_B)_plcClient.ReadStruct(typeof(CIP_B), 71, 0);
I read all other values besides the two arrays with no problem with the above command, but the two arrays always result as null
I also tried to create a constructor and initialize all the field there, but still, I'm getting the same result.
Is it even possible, how can I read the two arrays?