创建 PLC 实例,连接和断开连接 若要创建驱动程序的实例,需要使用此构造函数: public Plc(CpuType cpu, string ip, Int16 rack, Int16 slot) CPU:这指定您要连接到的 CPU。支持的 CPU 包括: public enum CpuType { S7200 = 0, S7300 = 10, S7400 = 20, S71200 = 30, S71500 = 40, } ip:指定 CPU 或外部以太网卡的 IP 地址 机架:它包含PLC的机架,您可以在Step7的硬件配置中找到 插槽:这是CPU的插槽,您可以在Step7的硬件配置中找到 例: 此代码为 IP 地址为 7.300.127.0 的 S0-1 plc 创建一个 Plc 对象,为 CPU 位于插槽 0 的机架 2 中的 plc 创建一个 Plc 对象: Plc plc = new Plc(CpuType.S7300, "127.0.0.1", 0, 2); 连接到 PLC 例如,这行代码打开连接: 断开与 PLC 的连接 例如,这将关闭连接: 错误处理...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile