| | |
| | | short slot; |
| | | short.TryParse(CommunicatorConnections["端口"].ToString(), out slot); |
| | | S7.Net.CpuType cpuType = (CpuType)CommunicatorConnections["型号"]; |
| | | variable = CommunicatorConnections["变量地址"].ToString(); |
| | | plc = new Plc(cpuType, IP, 0, slot); |
| | | plc.Open(); |
| | | return true; |
| | |
| | | { |
| | | try |
| | | { |
| | | plc.Write(variable, message); |
| | | return true; |
| | | if (plc!=null) |
| | | { |
| | | if (string.IsNullOrEmpty(variable)) |
| | | { |
| | | variable = CommunicatorConnections["变量地址"].ToString(); |
| | | } |
| | | plc.Write(variable, message); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | catch |
| | | { |