Ejemplo n.º 1
0
        public void GetIoInBoardAndAxisIndexByIO_IN_Type(IO_IN_Type IoInType, ref int BoadrIndex, ref int IoInIndex)
        {
            switch (IoInType)
            {
            case IO_IN_Type.IO_IN_KeyRun:
            {
                BoadrIndex = Profile.m_Config.IO_IN_KeyRun.BoardIndex;
                IoInIndex  = Profile.m_Config.IO_IN_KeyRun.IoInIndex;
            }
            break;

            case IO_IN_Type.IO_IN_KeyPause:
            {
                BoadrIndex = Profile.m_Config.IO_IN_KeyPause.BoardIndex;
                IoInIndex  = Profile.m_Config.IO_IN_KeyPause.IoInIndex;
            }
            break;

            case IO_IN_Type.IO_IN_KeyStop:
            {
                BoadrIndex = Profile.m_Config.IO_IN_KeyStop.BoardIndex;
                IoInIndex  = Profile.m_Config.IO_IN_KeyStop.IoInIndex;
            }
            break;

            case IO_IN_Type.IO_IN_KeyReset:
            {
                BoadrIndex = Profile.m_Config.IO_IN_KeyReset.BoardIndex;
                IoInIndex  = Profile.m_Config.IO_IN_KeyReset.IoInIndex;
            }
            break;

            case IO_IN_Type.IO_IN_KeyScramSignal:
            {
                BoadrIndex = Profile.m_Config.IO_IN_KeyScramSignal.BoardIndex;
                IoInIndex  = Profile.m_Config.IO_IN_KeyScramSignal.IoInIndex;
            }
            break;

            default:
                break;
            }

            IoInIndex = IoInIndex - 1;  //配置文件中都是从1开始,和单片机交互时从0开始

            int IoTotal = IO_POINT_TOTAL;

            if (IoInIndex < 0)
            {
                IoInIndex = 0;
            }
            else if (IoInIndex >= IoTotal)
            {
                IoInIndex = IoTotal - 1;
            }
        }
Ejemplo n.º 2
0
        public IOValue ReadInputPoint(IO_IN_Type IoIn)
        {
            bool Re = false;

            int BoardIndex = 0;
            int IoInIndex  = 0;

            m_ControlerBoard.GetIoInBoardAndAxisIndexByIO_IN_Type(IoIn, ref BoardIndex, ref IoInIndex);

            uint mask = (uint)1 << IoInIndex;

            Re = (m_InputValue[BoardIndex] & mask) > 0;

            if (Re)
            {
                return(IOValue.High);
            }
            else
            {
                return(IOValue.Low);
            }
        }
Ejemplo n.º 3
0
        public void SendCommandToSetControlBoardOutputByInput(IO_IN_Type Io_In, int Value, IO_OUT_Type Io_Out1, int Out1_Value, IO_OUT_Type Io_Out2, int Out2_Value)
        {
            int BoardIndex = 0;
            int IoInIndex  = 0;

            GetIoInBoardAndAxisIndexByIO_IN_Type(Io_In, ref BoardIndex, ref IoInIndex);

            int indexBoardOut1 = 0;
            int IoOut1Index    = 0;

            GetIoOutBoardAndAxisIndexByIO_OUT_Type(Io_Out1, ref indexBoardOut1, ref IoOut1Index);

            int indexBoardOut2 = 0;
            int IoOut2Index    = 0;

            GetIoOutBoardAndAxisIndexByIO_OUT_Type(Io_Out2, ref indexBoardOut2, ref IoOut2Index);

            if (!IsControlerConnected((Board)BoardIndex))
            {
                return;
            }

            byte[] temp = new byte[CommunicationProtocol.MessageLength];
            CommunicationProtocol.MakeSendArrayByCode((byte)ControlerCommandCode.SetOutputByInput, ref temp);

            const int DataIndex = CommunicationProtocol.MessageCommandIndex + 1;

            temp[DataIndex + 0] = (byte)IoInIndex;
            temp[DataIndex + 1] = (byte)Value;
            temp[DataIndex + 2] = (byte)IoOut1Index;
            temp[DataIndex + 3] = (byte)Out1_Value;
            temp[DataIndex + 4] = (byte)IoOut2Index;
            temp[DataIndex + 5] = (byte)Out2_Value;

            temp[CommunicationProtocol.MessageSumCheck] = 0x00;
            temp[CommunicationProtocol.MessageSumCheck] = MyMath.CalculateSum(temp, CommunicationProtocol.MessageLength);

            AddCommandMessageToQueue((Board)BoardIndex, ControlerCommandCode.SetOutputByInput, ref temp);
        }
Ejemplo n.º 4
0
 public IOValue ReadInputPointStateBackups(IO_IN_Type Point)
 {
     return(m_InputPointStateBackups[(int)Point]);
 }
Ejemplo n.º 5
0
 public void SetInputPointStateBackups(IO_IN_Type Point, IOValue Value)
 {
     m_InputPointStateBackups[(int)Point] = Value;
 }