| | |
| | | private readonly object _lockWrite = new object(); |
| | | public SiemensS7Net siemensPLCClient { get; set; } |
| | | |
| | | public SiemensPLCClient() |
| | | public SiemensPLCClient(string model) |
| | | { |
| | | siemensPLCClient = new SiemensS7Net(SiemensPLCS.S1200); |
| | | if (model == "S300") |
| | | siemensPLCClient = new SiemensS7Net(SiemensPLCS.S300); |
| | | else |
| | | siemensPLCClient = new SiemensS7Net(SiemensPLCS.S1500); |
| | | base.siemensPLCClient = this.siemensPLCClient; |
| | | } |
| | | |
| | |
| | | else if (typeof(DataType) == typeof(string))//å符串 |
| | | { |
| | | var str = GetContent(siemensPLCClient.ReadString(item.dbAddress, (ushort)item.dataLen), item).ToString(); |
| | | str = str.Replace("\0", "")?.Replace("\\", "")?.Replace("\u0014", "")?.Replace("?\u0006", ""); |
| | | str = str.Replace("\0", "")?.Replace("\\", "")?.Replace("\u0014", "")?.Replace("?\u0006", "")?.Replace("\n","")?.Replace("?", "")?.Trim(); |
| | | return (DataType)(str as object); |
| | | } |
| | | else |