Ejemplo n.º 1
0
        public PortPLC()
        {
            try
            {
                switch (ParSetPLC.P_I.TypePLC_e)
                {
                case TypePLC_enum.MIT:
                    g_BasePortPLC = new PortPLC_MIT();
                    break;

                case TypePLC_enum.SEM:
                    break;

                case TypePLC_enum.PAN:
                    break;

                case TypePLC_enum.MIT_NEW:
                    g_BasePortPLC = new PortPLC_MITNew();
                    break;

                case TypePLC_enum.MIT_Hls:
                    g_BasePortPLC = new PortPLC_MITHls();
                    break;

                default:
                    g_BasePortPLC = new PortPLC_MIT();
                    break;
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// PLC端口
        /// </summary>
        void InitPort()
        {
            try
            {
                #region 通用端口
                switch (ParSetPLC.P_I.TypePLC_e)
                {
                case TypePLC_enum.MIT:
                    g_BasePortPLC = new PortPLC_MIT();
                    break;

                case TypePLC_enum.SEM:
                    break;

                case TypePLC_enum.PAN:
                    break;

                case TypePLC_enum.MIT_NEW:
                    g_BasePortPLC = new PortPLC_MITNew();
                    break;

                case TypePLC_enum.MIT_Hls:
                    g_BasePortPLC = new PortPLC_MITHls();
                    break;

                default:

                    break;
                }
                #endregion 通用端口

                #region 写端口
                //端口1
                if (ParSetPLC.P_I.BlWritePort1)
                {
                    g_BasePortPLC1 = new PortPLC_MITHls(ParSetPLC.P_I.PortWrite1);
                }
                //端口2
                if (ParSetPLC.P_I.BlWritePort2)
                {
                    g_BasePortPLC2 = new PortPLC_MITHls(ParSetPLC.P_I.PortWrite2);
                }
                //端口3
                if (ParSetPLC.P_I.BlWritePort3)
                {
                    g_BasePortPLC3 = new PortPLC_MITHls(ParSetPLC.P_I.PortWrite3);
                }
                //端口4
                if (ParSetPLC.P_I.BlWritePort4)
                {
                    g_BasePortPLC4 = new PortPLC_MITHls(ParSetPLC.P_I.PortWrite4);
                }
                //端口5
                if (ParSetPLC.P_I.BlWritePort5)
                {
                    g_BasePortPLC5 = new PortPLC_MITHls(ParSetPLC.P_I.PortWrite5);
                }
                //端口6
                if (ParSetPLC.P_I.BlWritePort6)
                {
                    g_BasePortPLC6 = new PortPLC_MITHls(ParSetPLC.P_I.PortWrite6);
                }
                #endregion 写端口
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
        }