OPC 读写

<textarea cols="50" rows="15" name="code" class="c-sharp">static void Main(string[] args) { Opc.Da.Server _server = new Opc.Da.Server(new OpcCom.Factory(), new URL(&quot;opcda://&quot; + &quot;127.0.0.1&quot; + &quot;/&quot; + &quot;Matrikon.OPC.Simulation.1&quot;)); _server.Connect(); _server.Write(new ItemValue[]{ new ItemValue{ ItemName = &quot;Bucket Brigade.Int4&quot;,Value=4, Timestamp = System.DateTime.Now,Quality = Quality.Good } }); ItemValueResult[] result = _server.Read( new Item[]{ new Item{ ItemName = &quot;Random.Int2&quot; }, new Item{ ItemName = &quot;Bucket Brigade.Int4&quot; } } ); Console.Write(result[1].Value); _server.Disconnect(); _server.Dispose(); }</textarea>

你可能感兴趣的:(String,server,url)