示例#1
0
        public static int GetPortValue(TransferStation station, CNCCheckPort port)
        {
            int data = -1;

            if (!GetPLCAdreesData(station, port, out data))
            {
                data = -1;
            }
            return(data);
        }
示例#2
0
        public static bool GetPLCAdreesData(CNCMachine machine, CNCCheckPort port, out int data)
        {
            data = -1;
            if ((machine == null) || (port == null))
            {
                return(false);
            }
            byte num  = 0;
            bool flag = false;

            switch (port.AddressType)
            {
            case EnumCNCAddress.I:
                flag = GetPlcIBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.O:
                flag = GetPlcOBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.C:
                flag = GetPlcCBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.S:
                flag = GetPlcSBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.A:
                flag = GetPlcABit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.R:
                return(GetRegisterData(machine, port.PortNumber, out data));
            }
            return(flag);
        }
示例#3
0
 public static bool GetMachineRunMode(CNCMachine machine, out int data, CNCCheckPort port)
 {
     data = -1;
     return(((machine != null) && (port != null)) && GetMachineRunMode(GetCNCStation(machine.MachineIP.ToString()), out data, port.PortNumber));
 }