This works very well, indeed! C# example follows:
// C# example
var workOrder = new WO();
// Read one complete WorkOrder from the PLC
workOrder = ReadWO("WorkOrderTag")
// Work Order Structure
public class WO
{
public int Sequence;
public string Description;
public string ProductID;
public string CustWO;
publice string ThisWO;
public float CasingLen;
public float TubingLen;
public int Qty;
public int Priority;
}
// Method to read Work Order from PLC
private WO ReadWO(string tag)
{
Byte[] bytes = ethernetIPforCLXCom1.ReadRaw(tag);
WO wO = new WO
{
Sequence = BitConverter.ToInt32(bytes, 0),
Description = System.Text.Encoding.Default.GetString(bytes, 8, BitConverter.ToInt32(bytes, 4)),
ProductID = System.Text.Encoding.Default.GetString(bytes, 96, BitConverter.ToInt32(bytes, 92)),
CustWO = System.Text.Encoding.Default.GetString(bytes, 116, BitConverter.ToInt32(bytes, 112)),
ThisWO = System.Text.Encoding.Default.GetString(bytes, 136, BitConverter.ToInt32(bytes, 132)),
CasingLen = BitConverter.ToSingle(bytes, 152),
TubingLen = BitConverter.ToSingle(bytes, 156),
Qty = BitConverter.ToInt32(bytes, 160),
Priority = BitConverter.ToInt32(bytes, 164)
};
return wO;
}