赞
踩
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using S7.Net;
-
-
- class Program
- {
- static Plc my200 = new Plc(CpuType.S71200, "192.168.110.60", 0, 1);
- static void Main(string[] args)
- {
- try
- {
- my200.Open();
- Console.WriteLine(my200.Read("DB1.DBX300.1")); //读取bool类型
- Console.WriteLine(my200.Read("DB1.DBD200")); //读取VD类型
- my200.Write("DB1.DBX400.1", 0);
- my200.Write("DB1.DBD450", 666);
- Console.ReadLine();
- my200.Close();
- }
- catch (Exception)
- {
- Console.WriteLine($"连接到PLC设备失败:IsConnect = {my200.IsConnected}");
- return;
- }
-
-
-
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。