I am working with an existing C# program communicating with a PLC over using Kepserver (I know the PLC and Kepserver sides, but am new on C#). I keep getting "Opc.Da.Item" as the value (not the actual PLC value). I know it's probably a basic question, but where do I get the actual value (what do I put in the last line of logic)? Thanks for any help.
This is how the other sections that read data from the OPC are, but I can't seem to see what I am doing wrong.
I am finally getting back to this issue and am still having a problem. With the method added below, I get a null value in results[0].value.
private void ReadCompleteCallback_NotApplicable (object clientHandle, Opc.Da.ItemValueResult[] results)
{
HMINotApp_TextBox.Invoke(new EventHandler(delegate { HMINotApp_TextBox.Text = Convert.ToString(results[0].Value); }));
}
Opc.Da.Item[] OPC_NotApplicable = new Opc.Da.Item[1];
OPC_NotApplicable[0] = new Opc.Da.Item();
OPC_NotApplicable[0].ItemName = Brake_Press_ID + "B1156_barcode_DINT_value";
OPC_Not_Applicable.Add(OPC_NotApplicable[0]);
NotApplicable_GroupRead.AddItems(OPC_Not_Applicable.ToArray());
Opc.IRequest req;
NotApplicable_GroupRead.Read(NotApplicable_GroupRead.Items, 123, new Opc.Da.ReadCompleteEventHandler(ReadCompleteCallback_NotApplicable), out req);
label23.Text = OPC_Not_Applicable[0].ToString();
I expect the value to be 9999999 but I get Opc.Da.Item.