using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using S7.Net;
using System.Threading;
namespace s7_net_测试
{
public partial class Form1 : Form
{
public static Plc plc;
public Thread InitThread = new Thread(Con);
public static byte[] ReadArray = new byte[4];
public Form1()
{
InitializeComponent();
InitThread.Start();
}
#region 创建连接至PLC
public static void Con()
{
// ( 1500plc ,IP 地址, 机架号 ,卡槽号)
plc = new Plc(CpuType.S71500, “192.168.0.1”, 0, 1);
plc.Open();
if (plc.IsConnected)
{
MessageBox.Show(“连接成功!!”);
}
else
{
MessageBox.Sho