using HighWayIot.Log4net; using HslCommunication; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HighWayIot.Plc.PlcHelper { public class RecipeSignal { /// /// 读取排程信号 /// /// public Dictionary ReadSchedulingSignal() { Dictionary result = new Dictionary(); OperateResult operateResult = PlcConnect.MelsecInstance2.Read("B991", 8); if (!operateResult.IsSuccess) { LogHelper.Instance.Error("排程监视信息读取失败"); return null; } byte[] bytes = operateResult.Content; int boolIndex = 0; for (int i = 0x901 - 0x901; i < 0x93E - 0x901 + 1; i++) { result.Add(boolIndex, bytes[i / 8].GetBoolByIndex(i % 8)); boolIndex++; } for (int i = 0x941 - 0x941; i < 0x97E - 0x941 + 1; i++) { result.Add(boolIndex, bytes[i / 8].GetBoolByIndex(i % 8)); boolIndex++; } return result; } } }