MyItem 
= new OPCItem[10];
            MyServer 
= new OPCAutomation.OPCServer();
            
object aopcserver = MyServer.GetOPCServers();

            
for (int i = 1; i < ((Array)(aopcserver)).Length; i++)
            {
                listBox1.Items.Add(((Array)(aopcserver)).GetValue(i));
            }
            MyServer.Connect(listBox1.Items[
0].ToString(), "");

            MyGroup 
= MyServer.OPCGroups.Add("group0");
            MyGroup.UpdateRate 
= 2000;
            MyGroup.IsSubscribed 
= true;


            MyGroup.DataChange 
+= new DIOPCGroupEvent_DataChangeEventHandler(GroupDataChange);
            MyGroup.AsyncWriteComplete 
+= new DIOPCGroupEvent_AsyncWriteCompleteEventHandler(GroupAsyncWriteComplete);
            MyGroup.AsyncReadComplete 
+= new DIOPCGroupEvent_AsyncReadCompleteEventHandler(GroupAsyncReadComplete);

            MyItem[
0= MyGroup.OPCItems.AddItem("Channel_1.Device_1.Tag_1"0);

 

        
void GroupDataChange(int TransactionID, int NumItems, ref Array ClientHandles, ref Array ItemValues, ref Array Qualities, ref Array TimeStamps)
        {

        }

        
void GroupAsyncWriteComplete(int TransactionID, int NumItems, ref Array ClientHandles, ref Array Errors)
        {

        }

        
void GroupAsyncReadComplete(int TransactionID, int NumItems, ref System.Array ClientHandles, ref System.Array ItemValues, ref System.Array Qualities, ref System.Array TimeStamps, ref System.Array Errors)
        {

        }

 

相关文章:

  • 2021-08-03
  • 2021-11-19
  • 2021-07-31
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-09-29
  • 2022-02-10
  • 2022-01-07
  • 2021-09-14
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案